summaryrefslogtreecommitdiff
path: root/indra/test/CMakeLists.txt
blob: 9d8e781d4896024218fda9bada07a2d54742d35f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# -*- cmake -*-

project (test)

include(00-Common)
include(LLCommon)
include(LLDatabase)
include(LLInventory)
include(LLMath)
include(LLMessage)
include(LLVFS)
include(LLXML)
include(LScript)
include(Linking)
include(Tut)
include(Boost)

include_directories(
    ${LLCOMMON_INCLUDE_DIRS}
    ${LLDATABASE_INCLUDE_DIRS}
    ${LLMATH_INCLUDE_DIRS}
    ${LLMESSAGE_INCLUDE_DIRS}
    ${LLINVENTORY_INCLUDE_DIRS}
    ${LLVFS_INCLUDE_DIRS}
    ${LLXML_INCLUDE_DIRS}
    ${LSCRIPT_INCLUDE_DIRS}
    )

set(test_SOURCE_FILES
    io.cpp
#    llapp_tut.cpp						# Temporarily removed until thread issues can be solved
    llblowfish_tut.cpp
    llbuffer_tut.cpp
    lldependencies_tut.cpp
    lldoubledispatch_tut.cpp
    llevents_tut.cpp
    llhttpdate_tut.cpp
    llhttpclient_tut.cpp
    llhttpnode_tut.cpp
    llinventoryparcel_tut.cpp
    lliohttpserver_tut.cpp
    llmessageconfig_tut.cpp
    llpermissions_tut.cpp
    llpipeutil.cpp
    llsaleinfo_tut.cpp
    llscriptresource_tut.cpp
    llsdmessagebuilder_tut.cpp
    llsdmessagereader_tut.cpp
    llsd_new_tut.cpp
    llsdutil_tut.cpp
    llservicebuilder_tut.cpp
    llstreamtools_tut.cpp
    lltemplatemessagebuilder_tut.cpp
    lltimestampcache_tut.cpp
    lltranscode_tut.cpp
    lltut.cpp
    lluuidhashmap_tut.cpp
    llxfer_tut.cpp
    message_tut.cpp
    reflection_tut.cpp
    stringize_tut.cpp
    test.cpp
    )

set(test_HEADER_FILES
    CMakeLists.txt

    llpipeutil.h
    llsdtraits.h
    lltut.h
    )

if (NOT WINDOWS)
  list(APPEND test_SOURCE_FILES
       llmessagetemplateparser_tut.cpp
       )
endif (NOT WINDOWS)

if (NOT DARWIN)
  list(APPEND test_SOURCE_FILES
    lldatabase_tut.cpp
    )
endif (NOT DARWIN)

set_source_files_properties(${test_HEADER_FILES}
                            PROPERTIES HEADER_FILE_ONLY TRUE)

list(APPEND test_SOURCE_FILES ${test_HEADER_FILES})

add_executable(test ${test_SOURCE_FILES})

target_link_libraries(test
    ${LLDATABASE_LIBRARIES}
    ${LLINVENTORY_LIBRARIES}
    ${LLMESSAGE_LIBRARIES}
    ${LLMATH_LIBRARIES}
    ${LLVFS_LIBRARIES}
    ${LLXML_LIBRARIES}
    ${LSCRIPT_LIBRARIES}
    ${LLCOMMON_LIBRARIES}
    ${APRICONV_LIBRARIES}
    ${PTHREAD_LIBRARY}
    ${WINDOWS_LIBRARIES}
    ${BOOST_PROGRAM_OPTIONS_LIBRARY}
    ${BOOST_REGEX_LIBRARY}
    ${DL_LIBRARY}
    ${GOOGLE_PERFTOOLS_LIBRARIES}
    )

if (WINDOWS)
  set_target_properties(test
          PROPERTIES 
          LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
          LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
          )
endif (WINDOWS)

get_target_property(TEST_EXE test LOCATION)

add_custom_command(
  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
  COMMAND ${TEST_EXE}
  ARGS
    --output=${CMAKE_CURRENT_BINARY_DIR}/cpp_test_results.txt
    --touch=${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt
  DEPENDS test
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  COMMENT "C++ unit tests"
  )

set(test_results ${CMAKE_CURRENT_BINARY_DIR}/cpp_tests_ok.txt)

if (EXISTS /etc/debian_version_FAIL)
  # The Python tests have all kinds of wacky non-portable assumptions
  # built in.

  add_custom_command(
    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt
    COMMAND ${PYTHON_EXECUTABLE}
    ARGS
      ${CMAKE_CURRENT_SOURCE_DIR}/test.py
      --mode=static
      --output=${CMAKE_CURRENT_BINARY_DIR}/py_test_results.txt
      --touch=${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt
      --mode=static
    DEPENDS test.py
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMENT "Python unit tests"
    )

  list(APPEND test_results ${CMAKE_CURRENT_BINARY_DIR}/py_tests_ok.txt)
endif (EXISTS /etc/debian_version_FAIL)
    
add_custom_target(tests_ok ALL DEPENDS ${test_results})