diff options
-rw-r--r-- | CMakeLists.txt | 141 | ||||
-rw-r--r-- | cmake/CompileGTest.cmake | 9 | ||||
-rw-r--r-- | cmake/ModulePackage.cmake | 10 |
3 files changed, 40 insertions, 120 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 9acb97d2..a16c1220 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -211,7 +211,7 @@ endif() | |||
211 | # LAYER 1: Crypto core | 211 | # LAYER 1: Crypto core |
212 | # -------------------- | 212 | # -------------------- |
213 | apidsl(toxcore/crypto_core.api.h) | 213 | apidsl(toxcore/crypto_core.api.h) |
214 | add_submodule(toxcore toxcrypto | 214 | set(toxcore_SOURCES ${toxcore_SOURCES} |
215 | toxcore/ccompat.h | 215 | toxcore/ccompat.h |
216 | toxcore/crypto_core.c | 216 | toxcore/crypto_core.c |
217 | toxcore/crypto_core.h | 217 | toxcore/crypto_core.h |
@@ -219,34 +219,33 @@ add_submodule(toxcore toxcrypto | |||
219 | include(CheckFunctionExists) | 219 | include(CheckFunctionExists) |
220 | check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) | 220 | check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO) |
221 | check_function_exists(memset_s HAVE_MEMSET_S) | 221 | check_function_exists(memset_s HAVE_MEMSET_S) |
222 | target_link_modules(toxcrypto ${LIBSODIUM_LIBRARIES}) | 222 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${LIBSODIUM_LIBRARIES}) |
223 | set(toxcrypto_PKGCONFIG_REQUIRES ${toxcrypto_PKGCONFIG_REQUIRES} libsodium) | 223 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} libsodium) |
224 | 224 | ||
225 | # LAYER 2: Basic networking | 225 | # LAYER 2: Basic networking |
226 | # ------------------------- | 226 | # ------------------------- |
227 | add_submodule(toxcore toxnetwork | 227 | set(toxcore_SOURCES ${toxcore_SOURCES} |
228 | toxcore/logger.c | 228 | toxcore/logger.c |
229 | toxcore/logger.h | 229 | toxcore/logger.h |
230 | toxcore/network.c | 230 | toxcore/network.c |
231 | toxcore/network.h | 231 | toxcore/network.h |
232 | toxcore/util.c | 232 | toxcore/util.c |
233 | toxcore/util.h) | 233 | toxcore/util.h) |
234 | target_link_modules(toxnetwork toxcrypto) | ||
235 | 234 | ||
236 | message("CMAKE_THREAD_LIBS_INIT: ${CMAKE_THREAD_LIBS_INIT}") | 235 | message("CMAKE_THREAD_LIBS_INIT: ${CMAKE_THREAD_LIBS_INIT}") |
237 | if(CMAKE_THREAD_LIBS_INIT) | 236 | if(CMAKE_THREAD_LIBS_INIT) |
238 | target_link_modules(toxnetwork ${CMAKE_THREAD_LIBS_INIT}) | 237 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${CMAKE_THREAD_LIBS_INIT}) |
239 | set(toxnetwork_PKGCONFIG_LIBS ${toxnetwork_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT}) | 238 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${CMAKE_THREAD_LIBS_INIT}) |
240 | endif() | 239 | endif() |
241 | 240 | ||
242 | if(RT_LIBRARIES) | 241 | if(RT_LIBRARIES) |
243 | target_link_modules(toxnetwork ${RT_LIBRARIES}) | 242 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${RT_LIBRARIES}) |
244 | set(toxnetwork_PKGCONFIG_LIBS ${toxnetwork_PKGCONFIG_LIBS} "-lrt") | 243 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lrt") |
245 | endif() | 244 | endif() |
246 | 245 | ||
247 | if(WIN32) | 246 | if(WIN32) |
248 | target_link_modules(toxnetwork ws2_32 iphlpapi) | 247 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ws2_32 iphlpapi) |
249 | set(toxnetwork_PKGCONFIG_LIBS ${toxnetwork_PKGCONFIG_LIBS} "-lws2_32 -liphlpapi") | 248 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} "-lws2_32 -liphlpapi") |
250 | endif() | 249 | endif() |
251 | 250 | ||
252 | # LAYER 3: Distributed Hash Table | 251 | # LAYER 3: Distributed Hash Table |
@@ -254,7 +253,7 @@ endif() | |||
254 | apidsl(toxcore/LAN_discovery.api.h) | 253 | apidsl(toxcore/LAN_discovery.api.h) |
255 | apidsl(toxcore/ping.api.h) | 254 | apidsl(toxcore/ping.api.h) |
256 | apidsl(toxcore/ping_array.api.h) | 255 | apidsl(toxcore/ping_array.api.h) |
257 | add_submodule(toxcore toxdht | 256 | set(toxcore_SOURCES ${toxcore_SOURCES} |
258 | toxcore/DHT.c | 257 | toxcore/DHT.c |
259 | toxcore/DHT.h | 258 | toxcore/DHT.h |
260 | toxcore/LAN_discovery.c | 259 | toxcore/LAN_discovery.c |
@@ -263,11 +262,10 @@ add_submodule(toxcore toxdht | |||
263 | toxcore/ping.h | 262 | toxcore/ping.h |
264 | toxcore/ping_array.c | 263 | toxcore/ping_array.c |
265 | toxcore/ping_array.h) | 264 | toxcore/ping_array.h) |
266 | target_link_modules(toxdht toxnetwork) | ||
267 | 265 | ||
268 | # LAYER 4: Onion routing, TCP connections, crypto connections | 266 | # LAYER 4: Onion routing, TCP connections, crypto connections |
269 | # ----------------------------------------------------------- | 267 | # ----------------------------------------------------------- |
270 | add_submodule(toxcore toxnetcrypto | 268 | set(toxcore_SOURCES ${toxcore_SOURCES} |
271 | toxcore/TCP_client.c | 269 | toxcore/TCP_client.c |
272 | toxcore/TCP_client.h | 270 | toxcore/TCP_client.h |
273 | toxcore/TCP_connection.c | 271 | toxcore/TCP_connection.c |
@@ -284,40 +282,35 @@ add_submodule(toxcore toxnetcrypto | |||
284 | toxcore/onion_announce.h | 282 | toxcore/onion_announce.h |
285 | toxcore/onion_client.c | 283 | toxcore/onion_client.c |
286 | toxcore/onion_client.h) | 284 | toxcore/onion_client.h) |
287 | target_link_modules(toxnetcrypto toxdht) | ||
288 | 285 | ||
289 | # LAYER 5: Friend requests and connections | 286 | # LAYER 5: Friend requests and connections |
290 | # ---------------------------------------- | 287 | # ---------------------------------------- |
291 | add_submodule(toxcore toxfriends | 288 | set(toxcore_SOURCES ${toxcore_SOURCES} |
292 | toxcore/friend_connection.c | 289 | toxcore/friend_connection.c |
293 | toxcore/friend_connection.h | 290 | toxcore/friend_connection.h |
294 | toxcore/friend_requests.c | 291 | toxcore/friend_requests.c |
295 | toxcore/friend_requests.h) | 292 | toxcore/friend_requests.h) |
296 | target_link_modules(toxfriends toxnetcrypto) | ||
297 | 293 | ||
298 | # LAYER 6: Tox messenger | 294 | # LAYER 6: Tox messenger |
299 | # ---------------------- | 295 | # ---------------------- |
300 | add_submodule(toxcore toxmessenger | 296 | set(toxcore_SOURCES ${toxcore_SOURCES} |
301 | toxcore/Messenger.c | 297 | toxcore/Messenger.c |
302 | toxcore/Messenger.h) | 298 | toxcore/Messenger.h) |
303 | target_link_modules(toxmessenger toxfriends) | ||
304 | 299 | ||
305 | # LAYER 7: Group chats | 300 | # LAYER 7: Group chats |
306 | # -------------------- | 301 | # -------------------- |
307 | add_submodule(toxcore toxgroup | 302 | set(toxcore_SOURCES ${toxcore_SOURCES} |
308 | toxcore/group.c | 303 | toxcore/group.c |
309 | toxcore/group.h) | 304 | toxcore/group.h) |
310 | target_link_modules(toxgroup toxmessenger) | ||
311 | 305 | ||
312 | # LAYER 8: Public API | 306 | # LAYER 8: Public API |
313 | # ------------------- | 307 | # ------------------- |
314 | apidsl(toxcore/tox.api.h) | 308 | apidsl(toxcore/tox.api.h) |
315 | add_submodule(toxcore toxapi | 309 | set(toxcore_SOURCES ${toxcore_SOURCES} |
316 | toxcore/tox_api.c | 310 | toxcore/tox_api.c |
317 | toxcore/tox.c | 311 | toxcore/tox.c |
318 | toxcore/tox.h) | 312 | toxcore/tox.h) |
319 | target_link_modules(toxapi toxgroup) | 313 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxcore/tox.h^tox) |
320 | set(toxapi_API_HEADERS ${toxcore_SOURCE_DIR}/toxcore/tox.h^tox) | ||
321 | 314 | ||
322 | ################################################################################ | 315 | ################################################################################ |
323 | # | 316 | # |
@@ -327,7 +320,7 @@ set(toxapi_API_HEADERS ${toxcore_SOURCE_DIR}/toxcore/tox.h^tox) | |||
327 | 320 | ||
328 | if(BUILD_TOXAV) | 321 | if(BUILD_TOXAV) |
329 | apidsl(toxav/toxav.api.h) | 322 | apidsl(toxav/toxav.api.h) |
330 | add_submodule(toxcore toxav | 323 | set(toxcore_SOURCES ${toxcore_SOURCES} |
331 | toxav/audio.c | 324 | toxav/audio.c |
332 | toxav/audio.h | 325 | toxav/audio.h |
333 | toxav/bwcontroller.c | 326 | toxav/bwcontroller.c |
@@ -345,11 +338,10 @@ if(BUILD_TOXAV) | |||
345 | toxav/toxav_old.c | 338 | toxav/toxav_old.c |
346 | toxav/video.c | 339 | toxav/video.c |
347 | toxav/video.h) | 340 | toxav/video.h) |
348 | target_link_modules(toxav toxgroup ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) | 341 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) |
349 | set(toxav_PKGCONFIG_REQUIRES ${toxav_PKGCONFIG_REQUIRES} opus vpx) | 342 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} opus vpx) |
350 | 343 | ||
351 | set(toxav_API_HEADERS ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) | 344 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) |
352 | make_version_script(toxav ${toxav_API_HEADERS}) | ||
353 | endif() | 345 | endif() |
354 | 346 | ||
355 | ################################################################################ | 347 | ################################################################################ |
@@ -359,11 +351,10 @@ endif() | |||
359 | ################################################################################ | 351 | ################################################################################ |
360 | 352 | ||
361 | apidsl(toxencryptsave/toxencryptsave.api.h) | 353 | apidsl(toxencryptsave/toxencryptsave.api.h) |
362 | add_submodule(toxcore toxencryptsave | 354 | set(toxcore_SOURCES ${toxcore_SOURCES} |
363 | toxencryptsave/toxencryptsave.c | 355 | toxencryptsave/toxencryptsave.c |
364 | toxencryptsave/toxencryptsave.h) | 356 | toxencryptsave/toxencryptsave.h) |
365 | target_link_modules(toxencryptsave toxcrypto) | 357 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsave.h^tox) |
366 | set(toxencryptsave_API_HEADERS ${toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsave.h^tox) | ||
367 | 358 | ||
368 | ################################################################################ | 359 | ################################################################################ |
369 | # | 360 | # |
@@ -375,26 +366,8 @@ set(toxencryptsave_API_HEADERS ${toxcore_SOURCE_DIR}/toxencryptsave/toxencryptsa | |||
375 | add_module(toxcore ${toxcore_SOURCES}) | 366 | add_module(toxcore ${toxcore_SOURCES}) |
376 | 367 | ||
377 | # Link it to all dependencies. | 368 | # Link it to all dependencies. |
378 | foreach(sublib ${toxcore_SUBLIBS}) | ||
379 | set(toxcore_LINK_MODULES ${toxcore_LINK_MODULES} ${${sublib}_LINK_MODULES}) | ||
380 | endforeach() | ||
381 | target_link_modules(toxcore ${toxcore_LINK_MODULES}) | 369 | target_link_modules(toxcore ${toxcore_LINK_MODULES}) |
382 | 370 | ||
383 | # Concatenate all the pkg-config Libs: lines. | ||
384 | foreach(sublib ${toxcore_SUBLIBS}) | ||
385 | set(toxcore_PKGCONFIG_LIBS ${toxcore_PKGCONFIG_LIBS} ${${sublib}_PKGCONFIG_LIBS}) | ||
386 | endforeach() | ||
387 | |||
388 | # Concatenate all the pkg-config Requires: lines. | ||
389 | foreach(sublib ${toxcore_SUBLIBS}) | ||
390 | set(toxcore_PKGCONFIG_REQUIRES ${toxcore_PKGCONFIG_REQUIRES} ${${sublib}_PKGCONFIG_REQUIRES}) | ||
391 | endforeach() | ||
392 | |||
393 | # Collect all API headers. | ||
394 | foreach(sublib ${toxcore_SUBLIBS}) | ||
395 | set(toxcore_API_HEADERS ${toxcore_API_HEADERS} ${${sublib}_API_HEADERS}) | ||
396 | endforeach() | ||
397 | |||
398 | # Make version script (on systems that support it) to limit symbol visibility. | 371 | # Make version script (on systems that support it) to limit symbol visibility. |
399 | make_version_script(toxcore ${toxcore_API_HEADERS}) | 372 | make_version_script(toxcore ${toxcore_API_HEADERS}) |
400 | 373 | ||
@@ -404,59 +377,12 @@ install_module(toxcore DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tox) | |||
404 | 377 | ||
405 | ################################################################################ | 378 | ################################################################################ |
406 | # | 379 | # |
407 | # :: Tox specification tests | ||
408 | # | ||
409 | ################################################################################ | ||
410 | |||
411 | # find_program(SPECTEST NAMES | ||
412 | # tox-spectest | ||
413 | # ../.stack-work/install/x86_64-linux/lts-2.22/7.8.4/bin/tox-spectest) | ||
414 | # | ||
415 | # if(NOT SPECTEST) | ||
416 | # find_program(STACK NAMES stack) | ||
417 | # if(STACK) | ||
418 | # set(SPECTEST | ||
419 | # ${STACK} --stack-yaml ${toxcore_SOURCE_DIR}/../stack.yaml exec -- | ||
420 | # tox-spectest) | ||
421 | # endif() | ||
422 | # endif() | ||
423 | # | ||
424 | # if(MSGPACK_FOUND) | ||
425 | # add_executable(toxcore-sut | ||
426 | # testing/hstox/binary_decode.c | ||
427 | # testing/hstox/binary_encode.c | ||
428 | # testing/hstox/driver.c | ||
429 | # testing/hstox/methods.c | ||
430 | # testing/hstox/packet_kinds.c | ||
431 | # testing/hstox/test_main.c | ||
432 | # testing/hstox/util.c) | ||
433 | # target_link_modules(toxcore-sut | ||
434 | # toxcore | ||
435 | # toxdht | ||
436 | # toxnetcrypto | ||
437 | # ${MSGPACK_LIBRARIES}) | ||
438 | # if(SPECTEST) | ||
439 | # add_test(NAME spectest COMMAND ${SPECTEST} $<TARGET_FILE:toxcore-sut>) | ||
440 | # endif() | ||
441 | # endif() | ||
442 | |||
443 | ################################################################################ | ||
444 | # | ||
445 | # :: Unit tests: no networking, just pure function calls. | 380 | # :: Unit tests: no networking, just pure function calls. |
446 | # | 381 | # |
447 | ################################################################################ | 382 | ################################################################################ |
448 | 383 | ||
449 | include(CompileGTest) | 384 | include(CompileGTest) |
450 | 385 | ||
451 | function(unit_test subdir target) | ||
452 | if(HAVE_GTEST) | ||
453 | add_executable(unit_${target}_test ${subdir}/${target}_test.cpp) | ||
454 | target_link_modules(unit_${target}_test ${toxcore_SUBLIBS} gtest) | ||
455 | set_target_properties(unit_${target}_test PROPERTIES COMPILE_FLAGS "${TEST_CXX_FLAGS}") | ||
456 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} unit_${target}_test) | ||
457 | endif() | ||
458 | endfunction() | ||
459 | |||
460 | # The actual unit tests follow. | 386 | # The actual unit tests follow. |
461 | # | 387 | # |
462 | unit_test(toxav rtp) | 388 | unit_test(toxav rtp) |
@@ -488,11 +414,7 @@ endif() | |||
488 | function(auto_test target) | 414 | function(auto_test target) |
489 | if(NOT (MSVC AND ARGV1 STREQUAL "MSVC_DONT_BUILD")) | 415 | if(NOT (MSVC AND ARGV1 STREQUAL "MSVC_DONT_BUILD")) |
490 | add_executable(auto_${target}_test auto_tests/${target}_test.c) | 416 | add_executable(auto_${target}_test auto_tests/${target}_test.c) |
491 | target_link_modules(auto_${target}_test | 417 | target_link_modules(auto_${target}_test toxcore) |
492 | toxcore | ||
493 | toxcrypto | ||
494 | toxmessenger | ||
495 | toxnetcrypto) | ||
496 | if(NOT ARGV1 STREQUAL "DONT_RUN") | 418 | if(NOT ARGV1 STREQUAL "DONT_RUN") |
497 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test) | 419 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test) |
498 | set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") | 420 | set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}") |
@@ -505,12 +427,7 @@ if(BUILD_TOXAV) | |||
505 | add_executable(auto_monolith_test | 427 | add_executable(auto_monolith_test |
506 | auto_tests/monolith_test.cpp | 428 | auto_tests/monolith_test.cpp |
507 | ${ANDROID_CPU_FEATURES}) | 429 | ${ANDROID_CPU_FEATURES}) |
508 | target_link_modules(auto_monolith_test | 430 | target_link_libraries(auto_monolith_test ${toxcore_LINK_MODULES}) |
509 | ${LIBSODIUM_LIBRARIES} | ||
510 | ${OPUS_LIBRARIES} | ||
511 | ${VPX_LIBRARIES} | ||
512 | ${toxcore_PKGCONFIG_LIBS} | ||
513 | ) | ||
514 | add_test(NAME monolith COMMAND ${CROSSCOMPILING_EMULATOR} auto_monolith_test) | 431 | add_test(NAME monolith COMMAND ${CROSSCOMPILING_EMULATOR} auto_monolith_test) |
515 | 432 | ||
516 | if(ANDROID_CPU_FEATURES) | 433 | if(ANDROID_CPU_FEATURES) |
@@ -560,7 +477,7 @@ if(DHT_BOOTSTRAP) | |||
560 | add_executable(DHT_bootstrap | 477 | add_executable(DHT_bootstrap |
561 | other/DHT_bootstrap.c | 478 | other/DHT_bootstrap.c |
562 | other/bootstrap_node_packets.c) | 479 | other/bootstrap_node_packets.c) |
563 | target_link_modules(DHT_bootstrap toxnetcrypto) | 480 | target_link_modules(DHT_bootstrap toxcore) |
564 | endif() | 481 | endif() |
565 | 482 | ||
566 | option(BOOTSTRAP_DAEMON "Enable building of tox-bootstrapd" ON) | 483 | option(BOOTSTRAP_DAEMON "Enable building of tox-bootstrapd" ON) |
@@ -586,7 +503,7 @@ if(BOOTSTRAP_DAEMON) | |||
586 | other/bootstrap_daemon/src/tox-bootstrapd.c | 503 | other/bootstrap_daemon/src/tox-bootstrapd.c |
587 | other/bootstrap_node_packets.c | 504 | other/bootstrap_node_packets.c |
588 | other/bootstrap_node_packets.h) | 505 | other/bootstrap_node_packets.h) |
589 | target_link_modules(tox-bootstrapd toxfriends ${LIBCONFIG_LIBRARIES}) | 506 | target_link_modules(tox-bootstrapd toxcore ${LIBCONFIG_LIBRARIES}) |
590 | install(TARGETS tox-bootstrapd RUNTIME DESTINATION bin) | 507 | install(TARGETS tox-bootstrapd RUNTIME DESTINATION bin) |
591 | endif() | 508 | endif() |
592 | endif() | 509 | endif() |
@@ -615,7 +532,7 @@ if(NOT WIN32 | |||
615 | endif() | 532 | endif() |
616 | 533 | ||
617 | add_executable(DHT_test testing/DHT_test.c) | 534 | add_executable(DHT_test testing/DHT_test.c) |
618 | target_link_modules(DHT_test toxdht) | 535 | target_link_modules(DHT_test toxcore) |
619 | 536 | ||
620 | add_executable(Messenger_test testing/Messenger_test.c) | 537 | add_executable(Messenger_test testing/Messenger_test.c) |
621 | target_link_modules(Messenger_test toxmessenger) | 538 | target_link_modules(Messenger_test toxcore) |
diff --git a/cmake/CompileGTest.cmake b/cmake/CompileGTest.cmake index 520ca06a..1974901e 100644 --- a/cmake/CompileGTest.cmake +++ b/cmake/CompileGTest.cmake | |||
@@ -47,3 +47,12 @@ if(GTEST_ALL_CC) | |||
47 | endif() | 47 | endif() |
48 | endif() | 48 | endif() |
49 | endif() | 49 | endif() |
50 | |||
51 | function(unit_test subdir target) | ||
52 | if(HAVE_GTEST) | ||
53 | add_executable(unit_${target}_test ${subdir}/${target}_test.cpp) | ||
54 | target_link_modules(unit_${target}_test toxcore gtest) | ||
55 | set_target_properties(unit_${target}_test PROPERTIES COMPILE_FLAGS "${TEST_CXX_FLAGS}") | ||
56 | add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} unit_${target}_test) | ||
57 | endif() | ||
58 | endfunction() | ||
diff --git a/cmake/ModulePackage.cmake b/cmake/ModulePackage.cmake index 8ee8d6d7..f0eef7c9 100644 --- a/cmake/ModulePackage.cmake +++ b/cmake/ModulePackage.cmake | |||
@@ -28,12 +28,6 @@ function(pkg_use_module mod pkg) | |||
28 | endif() | 28 | endif() |
29 | endfunction() | 29 | endfunction() |
30 | 30 | ||
31 | macro(add_submodule super lib) | ||
32 | add_module(${lib} ${ARGN}) | ||
33 | set(${super}_SUBLIBS ${${super}_SUBLIBS} ${lib}) | ||
34 | set(${super}_SOURCES ${${super}_SOURCES} ${${lib}_SOURCES}) | ||
35 | endmacro() | ||
36 | |||
37 | function(add_module lib) | 31 | function(add_module lib) |
38 | set(${lib}_SOURCES ${ARGN} PARENT_SCOPE) | 32 | set(${lib}_SOURCES ${ARGN} PARENT_SCOPE) |
39 | 33 | ||
@@ -132,8 +126,8 @@ function(target_link_modules target) | |||
132 | set(_targets ${_targets} ${target}) | 126 | set(_targets ${_targets} ${target}) |
133 | # Executables preferably link against static libraries, so they are | 127 | # Executables preferably link against static libraries, so they are |
134 | # standalone and can be shipped without any external dependencies. As a | 128 | # standalone and can be shipped without any external dependencies. As a |
135 | # frame of reference: tests become roughly 1-1.5M binaries instead of | 129 | # frame of reference: tests become roughly 600-800K binaries instead of |
136 | # 100-200K on x86_64 Linux. | 130 | # 50-100K on x86_64 Linux. |
137 | set(${target}_primary static) | 131 | set(${target}_primary static) |
138 | set(${target}_secondary shared) | 132 | set(${target}_secondary shared) |
139 | endif() | 133 | endif() |