1# CMakeFile for qphelper library. 2 3# PNG support enabled by default. 4add_definitions(-DQP_SUPPORT_PNG) 5 6set(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 20set(QPHELPER_LIBS 21 debase 22 depool 23 dethread 24 deutil 25 ${PNG_LIBRARY} 26 ) 27 28if (DE_OS_IS_UNIX OR DE_OS_IS_QNX) 29 # For vsnprintf() 30 add_definitions(-D_XOPEN_SOURCE=600) 31endif () 32 33if (DE_OS_IS_WIN32 AND DE_COMPILER_IS_MSC) 34 set(QPHELPER_LIBS ${QPHELPER_LIBS} DbgHelp) 35endif () 36 37add_library(qphelper STATIC ${QPHELPER_SRCS}) 38target_link_libraries(qphelper ${QPHELPER_LIBS}) 39 40# Should qpInfo.c attempt to include qpReleaseInfo.inl 41set(USE_RELEASE_INFO_FILE OFF) 42 43if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qpReleaseInfo.inl") 44 set(USE_RELEASE_INFO_FILE ON) 45 46elseif (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND) 47 find_package(PythonInterp 2.7) 48 49 if (PYTHON_EXECUTABLE) 50 message(STATUS "Using git revision as release identifier") 51 52 execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${CMAKE_SOURCE_DIR}/.git rev-parse --git-dir 53 OUTPUT_VARIABLE DE_GIT_DIR 54 OUTPUT_STRIP_TRAILING_WHITESPACE) 55 56 add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl 57 COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/gen_release_info.py --git --git-dir=${DE_GIT_DIR} --out=${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl 58 DEPENDS gen_release_info.py ${DE_GIT_DIR}/HEAD ${DE_GIT_DIR}/index) # \note HEAD updated only when changing branches 59 add_custom_target(git-rel-info DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl) 60 add_dependencies(qphelper git-rel-info) 61 include_directories(${CMAKE_CURRENT_BINARY_DIR}) 62 set(USE_RELEASE_INFO_FILE ON) 63 endif () 64endif () 65 66if (USE_RELEASE_INFO_FILE) 67 add_definitions(-DDEQP_USE_RELEASE_INFO_FILE) 68endif () 69