summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/CMakeLists.txt
blob: c42bd7b6b2db8a320f6e132816a49c96e8e22693 (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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# -*- cmake -*-

project(llcorehttp)

include(00-Common)
include(GoogleMock)
include(CURL)
include(OpenSSL)
include(NGHTTP2)
include(ZLIB)
include(LLCoreHttp)
include(LLAddBuildTest)
include(LLMessage)
include(LLCommon)
include(Tut)

include_directories (${CMAKE_CURRENT_SOURCE_DIR})

include_directories(
    ${LLMESSAGE_INCLUDE_DIRS}
    ${LLCOMMON_INCLUDE_DIRS}
    ${LLCOREHTTP_INCLUDE_DIRS}
    )

set(llcorehttp_SOURCE_FILES
    bufferarray.cpp
    bufferstream.cpp
    httpcommon.cpp
    llhttpconstants.cpp
    httpheaders.cpp
    httpoptions.cpp
    httprequest.cpp
    httpresponse.cpp
    httpstats.cpp
    _httplibcurl.cpp
    _httpopcancel.cpp
    _httpoperation.cpp
    _httpoprequest.cpp
    _httpopsetget.cpp
    _httpopsetpriority.cpp
    _httppolicy.cpp
    _httppolicyclass.cpp
    _httppolicyglobal.cpp
    _httpreplyqueue.cpp
    _httprequestqueue.cpp
    _httpservice.cpp
    _refcounted.cpp
    )

set(llcorehttp_HEADER_FILES
    CMakeLists.txt

    bufferarray.h
    bufferstream.h
    httpcommon.h
    llhttpconstants.h
    httphandler.h
    httpheaders.h
    httpoptions.h
    httprequest.h
    httpresponse.h
    httpstats.h
    _httpinternal.h
    _httplibcurl.h
    _httpopcancel.h
    _httpoperation.h
    _httpoprequest.h
    _httpopsetget.h
    _httpopsetpriority.h
    _httppolicy.h
    _httppolicyclass.h
    _httppolicyglobal.h
    _httpreadyqueue.h
    _httpreplyqueue.h
    _httprequestqueue.h
    _httpservice.h
    _mutex.h
    _refcounted.h
    _thread.h
    )

set_source_files_properties(${llcorehttp_HEADER_FILES}
                            PROPERTIES HEADER_FILE_ONLY TRUE)
if (DARWIN OR LINUX)
  # Boost headers define unused members in condition_variable so...
  set_source_files_properties(${llcorehttp_SOURCE_FILES}
                              PROPERTIES COMPILE_FLAGS -Wno-unused-variable)
endif (DARWIN OR LINUX)

list(APPEND llcorehttp_SOURCE_FILES ${llcorehttp_HEADER_FILES})

add_library (llcorehttp ${llcorehttp_SOURCE_FILES})
buildscripts_block(llcorehttp)
target_link_libraries(
  llcorehttp
  ${CURL_LIBRARIES}
  ${OPENSSL_LIBRARIES}
  ${CRYPTO_LIBRARIES}
  ${NGHTTP2_LIBRARIES}
  ${BOOST_THREAD_LIBRARY}
  ${BOOST_SYSTEM_LIBRARY}
  )

# tests
if (LL_TESTS)
  SET(llcorehttp_TEST_SOURCE_FILES
      tests/test_allocator.cpp
      )

  set(llcorehttp_TEST_HEADER_FILS
      tests/test_httpstatus.hpp
      tests/test_refcounted.hpp
      tests/test_httpoperation.hpp
      tests/test_httprequest.hpp
      tests/test_httprequestqueue.hpp
      tests/test_httpheaders.hpp
      tests/test_bufferarray.hpp
      tests/test_bufferstream.hpp
      )

  set_source_files_properties(${llcorehttp_TEST_HEADER_FILES}
                              PROPERTIES HEADER_FILE_ONLY TRUE)

  list(APPEND llcorehttp_TEST_SOURCE_FILES ${llcorehttp_TEST_HEADER_FILES})

  # LL_ADD_PROJECT_UNIT_TESTS(llcorehttp "${llcorehttp_TEST_SOURCE_FILES}")

  #    set(TEST_DEBUG on)
  set(test_libs
      ${LLCOREHTTP_LIBRARIES}
      ${WINDOWS_LIBRARIES}
      ${LLMESSAGE_LIBRARIES}
      ${LLCOMMON_LIBRARIES}
      ${GOOGLEMOCK_LIBRARIES}
      ${CURL_LIBRARIES}
      ${OPENSSL_LIBRARIES}
      ${CRYPTO_LIBRARIES}
      ${NGHTTP2_LIBRARIES}
      ${BOOST_THREAD_LIBRARY}
      ${BOOST_SYSTEM_LIBRARY}
      )

  # If http_proxy is in the current environment (e.g. to fetch s3-proxy
  # autobuild packages), suppress it for this integration test: it screws up
  # the tests.
  LL_ADD_INTEGRATION_TEST(llcorehttp
                          "${llcorehttp_TEST_SOURCE_FILES}"
                          "${test_libs}"
                          "-Dhttp_proxy"
                          ${PYTHON_EXECUTABLE}
                          "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_llcorehttp_peer.py"
                          )

if (DARWIN)
  # Path inside the app bundle where we'll need to copy libraries
  set(LL_TEST_DESTINATION_DIR
    ${CMAKE_BINARY_DIR}/sharedlibs/Resources
  )

  # Create the Contents/Resources directory
  add_custom_command(
    TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD
    COMMAND ${CMAKE_COMMAND}
    ARGS
      -E
      make_directory
      ${LL_TEST_DESTINATION_DIR}
    COMMENT "Creating Resources directory in app bundle."
  )
  
  # Copy the required libraries to the package app. We used to use a sequence
  # of '${CMAKE_COMMAND} -E copy' commands, but 'cmake -E copy' does only a
  # single file at a time: it doesn't understand wildcards. 'cmake -E copy' is
  # for portability. This operation is Darwin-specific. We can count on the
  # 'cp' command.
  set(copy_dylibs
    libapr-1.0.dylib
    libaprutil-1.0.dylib
    libexception_handler.dylib
    libnghttp2*.dylib
    ${EXPAT_COPY}
    )

  add_custom_command(TARGET INTEGRATION_TEST_llcorehttp PRE_BUILD
    WORKING_DIRECTORY "${AUTOBUILD_INSTALL_DIR}/lib/release"
    COMMAND cp -v
    ${copy_dylibs}
    ${LL_TEST_DESTINATION_DIR}
    DEPENDS ${copy_dylibs}
  )

endif (DARWIN)

  #
  # Example Programs
  #
  SET(llcorehttp_EXAMPLE_SOURCE_FILES
      examples/http_texture_load.cpp
      )

  set(example_libs
      ${LLCOREHTTP_LIBRARIES}
      ${WINDOWS_LIBRARIES}
      ${LLMESSAGE_LIBRARIES}
      ${LLCOMMON_LIBRARIES}
      ${GOOGLEMOCK_LIBRARIES}
      ${CURL_LIBRARIES}
      ${OPENSSL_LIBRARIES}
      ${CRYPTO_LIBRARIES}
      ${NGHTTP2_LIBRARIES}
      ${BOOST_THREAD_LIBRARY}
      ${BOOST_SYSTEM_LIBRARY}
      )

  add_executable(http_texture_load
                 ${llcorehttp_EXAMPLE_SOURCE_FILES}
                 )
  buildscripts_block(http_texture_load)
  set_target_properties(http_texture_load
                        PROPERTIES
                        RUNTIME_OUTPUT_DIRECTORY "${EXE_STAGING_DIR}"
                        )

  if (WINDOWS)
    # The following come from LLAddBuildTest.cmake's INTEGRATION_TEST_xxxx target.
    set_target_properties(http_texture_load
                          PROPERTIES
                          LINK_FLAGS "/debug /NODEFAULTLIB:LIBCMT /SUBSYSTEM:CONSOLE"
                          LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\" /INCREMENTAL:NO"
                          LINK_FLAGS_RELEASE ""
                          )
  endif (WINDOWS)

  target_link_libraries(http_texture_load ${example_libs})

endif (LL_TESTS)