diff options
author | Jacek Antonelli | 2009-04-30 13:04:20 -0500 |
---|---|---|
committer | Jacek Antonelli | 2009-04-30 13:07:16 -0500 |
commit | ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch) | |
tree | 8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/cmake/LLAddBuildTest.cmake | |
parent | Second Life viewer sources 1.22.11 (diff) | |
download | meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2 meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz |
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r-- | linden/indra/cmake/LLAddBuildTest.cmake | 154 |
1 files changed, 154 insertions, 0 deletions
diff --git a/linden/indra/cmake/LLAddBuildTest.cmake b/linden/indra/cmake/LLAddBuildTest.cmake new file mode 100644 index 0000000..08151bc --- /dev/null +++ b/linden/indra/cmake/LLAddBuildTest.cmake | |||
@@ -0,0 +1,154 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | INCLUDE(APR) | ||
4 | INCLUDE(LLMath) | ||
5 | |||
6 | MACRO(ADD_BUILD_TEST_NO_COMMON name parent) | ||
7 | # MESSAGE("${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
8 | IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
9 | SET(no_common_libraries | ||
10 | ${APRUTIL_LIBRARIES} | ||
11 | ${APR_LIBRARIES} | ||
12 | ${PTHREAD_LIBRARY} | ||
13 | ${WINDOWS_LIBRARIES} | ||
14 | ) | ||
15 | SET(no_common_source_files | ||
16 | ${name}.cpp | ||
17 | tests/${name}_test.cpp | ||
18 | ${CMAKE_SOURCE_DIR}/test/test.cpp | ||
19 | ) | ||
20 | ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${no_common_libraries}" "${no_common_source_files}") | ||
21 | ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
22 | ENDMACRO(ADD_BUILD_TEST_NO_COMMON name parent) | ||
23 | |||
24 | |||
25 | MACRO(ADD_BUILD_TEST name parent) | ||
26 | # optional extra parameter: list of additional source files | ||
27 | SET(more_source_files "${ARGN}") | ||
28 | |||
29 | # MESSAGE("${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
30 | IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
31 | |||
32 | SET(basic_libraries | ||
33 | ${LLCOMMON_LIBRARIES} | ||
34 | ${APRUTIL_LIBRARIES} | ||
35 | ${APR_LIBRARIES} | ||
36 | ${PTHREAD_LIBRARY} | ||
37 | ${WINDOWS_LIBRARIES} | ||
38 | ) | ||
39 | SET(basic_source_files | ||
40 | ${name}.cpp | ||
41 | tests/${name}_test.cpp | ||
42 | ${CMAKE_SOURCE_DIR}/test/test.cpp | ||
43 | ${CMAKE_SOURCE_DIR}/test/lltut.cpp | ||
44 | ${more_source_files} | ||
45 | ) | ||
46 | ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${basic_libraries}" "${basic_source_files}") | ||
47 | |||
48 | ENDIF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/tests/${name}_test.cpp") | ||
49 | ENDMACRO(ADD_BUILD_TEST name parent) | ||
50 | |||
51 | |||
52 | MACRO(ADD_VIEWER_BUILD_TEST name parent) | ||
53 | # This is just like the generic ADD_BUILD_TEST, but we implicitly | ||
54 | # add the necessary precompiled header .cpp file (anyone else find that | ||
55 | # oxymoronic?) because the MSVC build errors will NOT point you there. | ||
56 | ADD_BUILD_TEST("${name}" "${parent}" llviewerprecompiledheaders.cpp) | ||
57 | ENDMACRO(ADD_VIEWER_BUILD_TEST name parent) | ||
58 | |||
59 | |||
60 | MACRO(ADD_SIMULATOR_BUILD_TEST name parent) | ||
61 | ADD_BUILD_TEST("${name}" "${parent}" llsimprecompiledheaders.cpp) | ||
62 | |||
63 | if (WINDOWS) | ||
64 | SET_SOURCE_FILES_PROPERTIES( | ||
65 | "tests/${name}_test.cpp" | ||
66 | PROPERTIES | ||
67 | COMPILE_FLAGS "/Yullsimprecompiledheaders.h" | ||
68 | ) | ||
69 | endif (WINDOWS) | ||
70 | ENDMACRO(ADD_SIMULATOR_BUILD_TEST name parent) | ||
71 | |||
72 | MACRO(ADD_BUILD_TEST_INTERNAL name parent libraries source_files) | ||
73 | # Optional additional parameter: pathname of Python wrapper script | ||
74 | SET(wrapper "${ARGN}") | ||
75 | #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} wrapper = ${wrapper}") | ||
76 | |||
77 | SET(TEST_SOURCE_FILES ${source_files}) | ||
78 | SET(HEADER "${name}.h") | ||
79 | set_source_files_properties(${HEADER} | ||
80 | PROPERTIES HEADER_FILE_ONLY TRUE) | ||
81 | LIST(APPEND TEST_SOURCE_FILES ${HEADER}) | ||
82 | INCLUDE_DIRECTORIES("${LIBS_OPEN_DIR}/test") | ||
83 | ADD_EXECUTABLE(${name}_test ${TEST_SOURCE_FILES}) | ||
84 | TARGET_LINK_LIBRARIES(${name}_test | ||
85 | ${libraries} | ||
86 | ) | ||
87 | |||
88 | GET_TARGET_PROPERTY(TEST_EXE ${name}_test LOCATION) | ||
89 | SET(TEST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}_test_ok.txt) | ||
90 | |||
91 | IF ("${wrapper}" STREQUAL "") | ||
92 | SET(TEST_CMD ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) | ||
93 | ELSE ("${wrapper}" STREQUAL "") | ||
94 | SET(TEST_CMD ${PYTHON_EXECUTABLE} ${wrapper} ${TEST_EXE} --touch=${TEST_OUTPUT} --sourcedir=${CMAKE_CURRENT_SOURCE_DIR}) | ||
95 | ENDIF ("${wrapper}" STREQUAL "") | ||
96 | |||
97 | #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} test_cmd = ${TEST_CMD}") | ||
98 | SET(TEST_SCRIPT_CMD | ||
99 | ${CMAKE_COMMAND} | ||
100 | -DLD_LIBRARY_PATH=${ARCH_PREBUILT_DIRS}:/usr/lib | ||
101 | -DTEST_CMD:STRING="${TEST_CMD}" | ||
102 | -P ${CMAKE_SOURCE_DIR}/cmake/RunBuildTest.cmake | ||
103 | ) | ||
104 | |||
105 | #MESSAGE(STATUS "ADD_BUILD_TEST_INTERNAL ${name} test_script = ${TEST_SCRIPT_CMD}") | ||
106 | ADD_CUSTOM_COMMAND( | ||
107 | OUTPUT ${TEST_OUTPUT} | ||
108 | COMMAND ${TEST_SCRIPT_CMD} | ||
109 | DEPENDS ${name}_test | ||
110 | WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
111 | ) | ||
112 | |||
113 | ADD_CUSTOM_TARGET(${name}_test_ok ALL DEPENDS ${TEST_OUTPUT}) | ||
114 | IF (${parent}) | ||
115 | ADD_DEPENDENCIES(${parent} ${name}_test_ok) | ||
116 | ENDIF (${parent}) | ||
117 | |||
118 | ENDMACRO(ADD_BUILD_TEST_INTERNAL name parent libraries source_files) | ||
119 | |||
120 | |||
121 | MACRO(ADD_COMM_BUILD_TEST name parent wrapper) | ||
122 | ## MESSAGE(STATUS "ADD_COMM_BUILD_TEST ${name} wrapper = ${wrapper}") | ||
123 | # optional extra parameter: list of additional source files | ||
124 | SET(more_source_files "${ARGN}") | ||
125 | ## MESSAGE(STATUS "ADD_COMM_BUILD_TEST ${name} more_source_files = ${more_source_files}") | ||
126 | |||
127 | SET(libraries | ||
128 | ${LLMESSAGE_LIBRARIES} | ||
129 | ${LLMATH_LIBRARIES} | ||
130 | ${LLVFS_LIBRARIES} | ||
131 | ${LLCOMMON_LIBRARIES} | ||
132 | ${APRUTIL_LIBRARIES} | ||
133 | ${APR_LIBRARIES} | ||
134 | ${PTHREAD_LIBRARY} | ||
135 | ${WINDOWS_LIBRARIES} | ||
136 | ) | ||
137 | SET(source_files | ||
138 | ${name}.cpp | ||
139 | tests/${name}_test.cpp | ||
140 | ${CMAKE_SOURCE_DIR}/test/test.cpp | ||
141 | ${CMAKE_SOURCE_DIR}/test/lltut.cpp | ||
142 | ${more_source_files} | ||
143 | ) | ||
144 | |||
145 | ADD_BUILD_TEST_INTERNAL("${name}" "${parent}" "${libraries}" "${source_files}" "${wrapper}") | ||
146 | ENDMACRO(ADD_COMM_BUILD_TEST name parent wrapper) | ||
147 | |||
148 | MACRO(ADD_VIEWER_COMM_BUILD_TEST name parent wrapper) | ||
149 | # This is just like the generic ADD_COMM_BUILD_TEST, but we implicitly | ||
150 | # add the necessary precompiled header .cpp file (anyone else find that | ||
151 | # oxymoronic?) because the MSVC build errors will NOT point you there. | ||
152 | ## MESSAGE(STATUS "ADD_VIEWER_COMM_BUILD_TEST ${name} wrapper = ${wrapper}") | ||
153 | ADD_COMM_BUILD_TEST("${name}" "${parent}" "${wrapper}" llviewerprecompiledheaders.cpp) | ||
154 | ENDMACRO(ADD_VIEWER_COMM_BUILD_TEST name parent wrapper) | ||