• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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# freebsd needs libexecinfo for backtrace symbols
41if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
42	target_link_libraries(qphelper execinfo)
43endif ()
44
45# Should qpInfo.c attempt to include qpReleaseInfo.inl
46set(USE_RELEASE_INFO_FILE OFF)
47
48if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/qpReleaseInfo.inl")
49	set(USE_RELEASE_INFO_FILE ON)
50
51elseif (EXISTS "${PROJECT_SOURCE_DIR}/.git" AND GIT_FOUND)
52	find_package(PythonInterp 2.7)
53
54	if (PYTHON_EXECUTABLE)
55		message(STATUS "Using git revision as release identifier")
56
57		execute_process(COMMAND ${GIT_EXECUTABLE} --git-dir=${PROJECT_SOURCE_DIR}/.git rev-parse --git-dir
58						OUTPUT_VARIABLE DE_GIT_DIR
59						OUTPUT_STRIP_TRAILING_WHITESPACE
60						ENCODING UTF8)
61
62		add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl
63						   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
64						   DEPENDS gen_release_info.py ${DE_GIT_DIR}/HEAD ${DE_GIT_DIR}/index) # \note HEAD updated only when changing branches
65		add_custom_target(git-rel-info DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/qpReleaseInfo.inl)
66		add_dependencies(qphelper git-rel-info)
67		include_directories(${CMAKE_CURRENT_BINARY_DIR})
68		set(USE_RELEASE_INFO_FILE ON)
69	endif ()
70endif ()
71
72if (USE_RELEASE_INFO_FILE)
73	add_definitions(-DDEQP_USE_RELEASE_INFO_FILE)
74endif ()
75