1 # CMakeFile for qphelper library. 2 3 # PNG support enabled by default. 4 add_definitions(-DQP_SUPPORT_PNG) 5 6 set(QPHELPER_SRCS 7 qpCrashHandler.c 8 qpCrashHandler.h 9 qpDebugOut.c 10 qpDebugOut.h 11 qpInfo.c 12 qpInfo.h 13 qpTestLog.c 14 qpTestLog.h 15 qpWatchDog.c 16 qpWatchDog.h 17 qpXmlWriter.c 18 qpXmlWriter.h) 19 20 set(QPHELPER_LIBS 21 debase 22 depool 23 dethread 24 deutil 25 ${PNG_LIBRARY} 26 ) 27 28 if (DE_OS_IS_UNIX) 29 # For vsnprintf() 30 add_definitions(-D_XOPEN_SOURCE=600) 31 endif () 32 33 if (DE_OS_IS_WIN32 AND DE_COMPILER_IS_MSC) 34 set(QPHELPER_LIBS ${QPHELPER_LIBS} DbgHelp) 35 endif () 36 37 add_library(qphelper STATIC ${QPHELPER_SRCS}) 38 target_link_libraries(qphelper ${QPHELPER_LIBS}) 39 40 # Should qpInfo.c attempt to include qpReleaseInfo.inl 41 set(USE_RELEASE_INFO_FILE OFF) 42 43 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qpReleaseInfo.inl") 44 set(USE_RELEASE_INFO_FILE ON) 45 46 elseif (EXISTS "${CMAKE_SOURCE_DIR}/.git") 47 find_program(PYTHON_BIN python) 48 49 if (PYTHON_BIN) 50 message(STATUS "Using git revision as release identifier") 51 52 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl 53 COMMAND ${PYTHON_BIN} -B ${CMAKE_CURRENT_SOURCE_DIR}/gen_release_info.py --git --out=${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl 54 DEPENDS gen_release_info.py ${CMAKE_SOURCE_DIR}/.git/HEAD ${CMAKE_SOURCE_DIR}/.git/index) # \note HEAD updated only when changing branches 55 add_custom_target(git-rel-info DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl) 56 add_dependencies(qphelper git-rel-info) 57 include_directories(${CMAKE_CURRENT_BINARY_DIR}) 58 set(USE_RELEASE_INFO_FILE ON) 59 endif () 60 endif () 61 62 if (USE_RELEASE_INFO_FILE) 63 add_definitions(-DDEQP_USE_RELEASE_INFO_FILE) 64 endif () 65