diff options
author | Nicky <nicky.dasmijn@gmail.com> | 2022-04-16 15:29:02 +0200 |
---|---|---|
committer | Nicky <nicky.dasmijn@gmail.com> | 2022-04-16 15:29:02 +0200 |
commit | bb85651d987a6cb969de7dd7c2b130411de6203c (patch) | |
tree | d143b3b23331469170515726baa8a76af60135dd /indra | |
parent | c8eb53859fb9b9f59d5ce8ef67f4011e95e34a9a (diff) |
Create a new target ll::oslibrary to link against libs specific to the OS compiled on.
This gets rid of the a few OS specific set and uses variables (which some even seemed mostly
duplicate like WINDOWS_LIBRARIES ans UI_LIBRARIES) and it also solves the problem of
having them to tack on every target, as of no they come as a transitive dependency from llcommon
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/LLAddBuildTest.cmake | 2 | ||||
-rw-r--r-- | indra/cmake/Linking.cmake | 70 | ||||
-rw-r--r-- | indra/integration_tests/llimage_libtest/CMakeLists.txt | 14 | ||||
-rw-r--r-- | indra/integration_tests/llui_libtest/CMakeLists.txt | 16 | ||||
-rw-r--r-- | indra/llcommon/CMakeLists.txt | 13 | ||||
-rw-r--r-- | indra/llcorehttp/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llfilesystem/CMakeLists.txt | 9 | ||||
-rw-r--r-- | indra/llinventory/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llmessage/CMakeLists.txt | 17 | ||||
-rw-r--r-- | indra/llplugin/slplugin/CMakeLists.txt | 8 | ||||
-rw-r--r-- | indra/llui/CMakeLists.txt | 4 | ||||
-rw-r--r-- | indra/llxml/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 16 | ||||
-rw-r--r-- | indra/test/CMakeLists.txt | 2 |
14 files changed, 52 insertions, 124 deletions
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index a3c873b389..9412475640 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -46,8 +46,6 @@ INCLUDE(GoogleMock) SET(alltest_LIBRARIES llcommon ll::googlemock - ${PTHREAD_LIBRARY} - ${WINDOWS_LIBRARIES} ) IF(NOT "${project}" STREQUAL "llmath") # add llmath as a dep unless the tested module *is* llmath! diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake index 4a57a6a3ef..ccbb27ca42 100644 --- a/indra/cmake/Linking.cmake +++ b/indra/cmake/Linking.cmake @@ -55,32 +55,50 @@ endif (NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release") link_directories(${AUTOBUILD_LIBS_INSTALL_DIRS}) +create_target(ll::oslibraries) + if (LINUX) - set(DL_LIBRARY dl) - set(PTHREAD_LIBRARY pthread) -else (LINUX) - set(DL_LIBRARY "") - set(PTHREAD_LIBRARY "") -endif (LINUX) + set_target_libraries( ll::oslibraries + dl + pthread + rt) +elseif (WINDOWS) + set_target_libraries( ll::oslibraries + advapi32 + shell32 + ws2_32 + mswsock + psapi + winmm + netapi32 + wldap32 + gdi32 + user32 + ole32 + dbghelp + legacy_stdio_definitions + ) +else() + include(CMakeFindFrameworks) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + find_library(CARBON_LIBRARY Carbon) + find_library(COCOA_LIBRARY Cocoa) + find_library(IOKIT_LIBRARY IOKit) + + find_library(AGL_LIBRARY AGL) + find_library(APPKIT_LIBRARY AppKit) + find_library(COREAUDIO_LIBRARY CoreAudio) + + set_target_libraries( ll::oslibraries + ${COCOA_LIBRARY} + ${IOKIT_LIBRARY} + ${COREFOUNDATION_LIBRARY} + ${CARBON_LIBRARY} + ${AGL_LIBRARY} + ${APPKITT_LIBRARY} + ${COREAUDIO_LIBRARY} + ) +endif() + -if (WINDOWS) - set(WINDOWS_LIBRARIES - advapi32 - shell32 - ws2_32 - mswsock - psapi - winmm - netapi32 - wldap32 - gdi32 - user32 - ole32 - dbghelp - ) -else (WINDOWS) - set(WINDOWS_LIBRARIES "") -endif (WINDOWS) - -mark_as_advanced(DL_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES) diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt index 9ac3498d09..00da3e7efc 100644 --- a/indra/integration_tests/llimage_libtest/CMakeLists.txt +++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt @@ -48,19 +48,6 @@ set_target_properties(llimage_libtest FALSE ) -# OS-specific libraries -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COREFOUNDATION_LIBRARY CoreFoundation) - set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY}) -elseif (WINDOWS) - set(OS_LIBRARIES) -elseif (LINUX) - set(OS_LIBRARIES) -else (DARWIN) - message(FATAL_ERROR "Unknown platform") -endif (DARWIN) - # Libraries on which this application depends on # Sort by high-level to low-level target_link_libraries(llimage_libtest @@ -71,7 +58,6 @@ target_link_libraries(llimage_libtest llimage llkdu llimagej2coj - ${OS_LIBRARIES} ) if (DARWIN) diff --git a/indra/integration_tests/llui_libtest/CMakeLists.txt b/indra/integration_tests/llui_libtest/CMakeLists.txt index baa814fb8b..ef6107fe66 100644 --- a/indra/integration_tests/llui_libtest/CMakeLists.txt +++ b/indra/integration_tests/llui_libtest/CMakeLists.txt @@ -57,21 +57,6 @@ list(APPEND llui_libtest_SOURCE_FILES ${llui_libtest_HEADER_FILES}) add_executable(llui_libtest ${llui_libtest_SOURCE_FILES}) -# Link with OS-specific libraries for LLWindow dependency -if (DARWIN) - find_library(COCOA_LIBRARY Cocoa) - find_library(IOKIT_LIBRARY IOKit) - set(OS_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY}) -elseif (WINDOWS) - #ll_stack_trace needs this now... - list(APPEND WINDOWS_LIBRARIES dbghelp) - set(OS_LIBRARIES ${WINDOWS_LIBRARIES}) -elseif (LINUX) - set(OS_LIBRARIES) -else (DARWIN) - message(FATAL_ERROR "unknown platform") -endif (DARWIN) - # Libraries on which this library depends, needed for Linux builds # Sort by high-level to low-level target_link_libraries(llui_libtest @@ -83,7 +68,6 @@ target_link_libraries(llui_libtest llimage llkdu llimagej2coj - ${OS_LIBRARIES} ) if (WINDOWS) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index c934d47cc9..4673630a8e 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -278,21 +278,15 @@ target_link_libraries( ll::expat ll::jsoncpp ll::zlib-ng - ${WINDOWS_LIBRARIES} ll::boost ${GOOGLE_PERFTOOLS_LIBRARIES} ll::uriparser + ll::oslibraries ) set_target_include_dirs( llcommon ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories( llcommon PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -if (DARWIN) - include(CMakeFindFrameworks) - find_library(CARBON_LIBRARY Carbon) - target_link_libraries(llcommon ${CARBON_LIBRARY}) -endif (DARWIN) - add_dependencies(llcommon stage_third_party_libs) if (LL_TESTS) @@ -303,10 +297,7 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llcommon "${llcommon_TEST_SOURCE_FILES}") #set(TEST_DEBUG on) - set(test_libs llcommon - ${WINDOWS_LIBRARIES} - ll::googlemock - ) + set(test_libs llcommon) LL_ADD_INTEGRATION_TEST(bitpack "" "${test_libs}") LL_ADD_INTEGRATION_TEST(classic_callback "" "${test_libs}") LL_ADD_INTEGRATION_TEST(commonmisc "" "${test_libs}") diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt index 041c90b174..0d45814d86 100644 --- a/indra/llcorehttp/CMakeLists.txt +++ b/indra/llcorehttp/CMakeLists.txt @@ -122,7 +122,6 @@ if (LL_TESTS AND LLCOREHTTP_TESTS) # set(TEST_DEBUG on) set(test_libs llcorehttp - ${WINDOWS_LIBRARIES} llmessage llcommon ) @@ -188,7 +187,6 @@ endif (DARWIN) set(example_libs ${LEGACY_STDIO_LIBS} llcorehttp - ${WINDOWS_LIBRARIES} llmessage llcommon ) diff --git a/indra/llfilesystem/CMakeLists.txt b/indra/llfilesystem/CMakeLists.txt index dfc290a48b..7274c3b450 100644 --- a/indra/llfilesystem/CMakeLists.txt +++ b/indra/llfilesystem/CMakeLists.txt @@ -65,13 +65,6 @@ target_link_libraries(llfilesystem ) set_target_include_dirs( llfilesystem ${CMAKE_CURRENT_SOURCE_DIR}) -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COCOA_LIBRARY Cocoa) - target_link_libraries(llfilesystem ${COCOA_LIBRARY}) -endif (DARWIN) - - # Add tests if (LL_TESTS) include(LLAddBuildTest) @@ -87,7 +80,7 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llfilesystem "${llfilesystem_TEST_SOURCE_FILES}") # INTEGRATION TESTS - set(test_libs llmath llcommon llfilesystem ${WINDOWS_LIBRARIES}) + set(test_libs llmath llcommon llfilesystem ) # TODO: Some of these need refactoring to be proper Unit tests rather than Integration tests. LL_ADD_INTEGRATION_TEST(lldir "" "${test_libs}") diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index ee14f0a46e..7d193f5512 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -71,7 +71,7 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llinventory "${llinventory_TEST_SOURCE_FILES}") #set(TEST_DEBUG on) - set(test_libs llinventory llmath llcorehttp llfilesystem ${WINDOWS_LIBRARIES}) + set(test_libs llinventory llmath llcorehttp llfilesystem ) LL_ADD_INTEGRATION_TEST(inventorymisc "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llparcel "" "${test_libs}") endif (LL_TESTS) diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 5f48ea60dc..20435d991a 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -220,27 +220,14 @@ if (LL_TESTS) LL_ADD_PROJECT_UNIT_TESTS(llmessage "${llmessage_TEST_SOURCE_FILES}") # set(TEST_DEBUG on) - -if (LINUX) - set(test_libs - ${WINDOWS_LIBRARIES} - llfilesystem - llmath - llcorehttp - llmessage - llcommon - rt - ) -else (LINUX) + set(test_libs - ${WINDOWS_LIBRARIES} llfilesystem llmath llcorehttp llmessage llcommon - ) -endif(LINUX) + ) #LL_ADD_INTEGRATION_TEST(llavatarnamecache "" "${test_libs}") LL_ADD_INTEGRATION_TEST(llhost "" "${test_libs}") diff --git a/indra/llplugin/slplugin/CMakeLists.txt b/indra/llplugin/slplugin/CMakeLists.txt index 7725489c3e..05e311f7e4 100644 --- a/indra/llplugin/slplugin/CMakeLists.txt +++ b/indra/llplugin/slplugin/CMakeLists.txt @@ -5,12 +5,6 @@ include(LLCommon) include(Linking) include(PluginAPI) -if (DARWIN) - include(CMakeFindFrameworks) - find_library(COCOA_LIBRARY Cocoa) -endif (DARWIN) - - ### SLPlugin set(SLPlugin_SOURCE_FILES @@ -60,8 +54,6 @@ target_link_libraries(SLPlugin ) if (DARWIN) - # Mac version needs to link against Carbon - target_link_libraries(SLPlugin ${COCOA_LIBRARY}) # Make sure the app bundle has a Resources directory (it will get populated by viewer-manifest.py later) add_custom_command( TARGET SLPlugin POST_BUILD diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt index 9035095d5f..5e71b673a5 100644 --- a/indra/llui/CMakeLists.txt +++ b/indra/llui/CMakeLists.txt @@ -272,7 +272,7 @@ target_link_libraries(llui # Add tests if(LL_TESTS) include(LLAddBuildTest) - set(test_libs llmessage llcorehttp llxml llrender llcommon ll::hunspell ${WINDOWS_LIBRARIES}) + set(test_libs llmessage llcorehttp llxml llrender llcommon ll::hunspell) SET(llui_TEST_SOURCE_FILES llurlmatch.cpp @@ -282,7 +282,7 @@ if(LL_TESTS) # INTEGRATION TESTS if(NOT LINUX) - set(test_libs llui llmessage llcorehttp llxml llrender llcommon ll::hunspell ${WINDOWS_LIBRARIES}) + set(test_libs llui llmessage llcorehttp llxml llrender llcommon ll::hunspell ) LL_ADD_INTEGRATION_TEST(llurlentry llurlentry.cpp "${test_libs}") endif(NOT LINUX) endif(LL_TESTS) diff --git a/indra/llxml/CMakeLists.txt b/indra/llxml/CMakeLists.txt index 5953cb79e8..fc680e6da5 100644 --- a/indra/llxml/CMakeLists.txt +++ b/indra/llxml/CMakeLists.txt @@ -55,7 +55,6 @@ if (LL_TESTS) llxml llmath llcommon - ${WINDOWS_LIBRARIES} ) LL_ADD_INTEGRATION_TEST(llcontrol "" "${test_libs}") diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2be83c9900..e039828221 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1372,19 +1372,6 @@ if (DARWIN) COMPILE_FLAGS "-fmodules -fcxx-modules -Wno-nullability-completeness" ) - find_library(AGL_LIBRARY AGL) - find_library(APPKIT_LIBRARY AppKit) - find_library(COCOA_LIBRARY Cocoa) - find_library(IOKIT_LIBRARY IOKit) - find_library(COREAUDIO_LIBRARY CoreAudio) - - set(viewer_LIBRARIES - ${COCOA_LIBRARY} - ${AGL_LIBRARY} - ${IOKIT_LIBRARY} - ${COREAUDIO_LIBRARY} - ) - if (USE_BUGSPLAT) list(APPEND viewer_LIBRARIES bugsplat::bugsplat @@ -1558,7 +1545,6 @@ if (WINDOWS) # see EXP-1765 - theory is opengl32.lib needs to be included before gdi32.lib (windows libs) set(viewer_LIBRARIES opengl32 - ${WINDOWS_LIBRARIES} comdlg32 dxguid kernel32 @@ -1972,7 +1958,6 @@ target_link_libraries(${VIEWER_BINARY_NAME} ll::ndof ${SMARTHEAP_LIBRARY} ${UI_LIBRARIES} - ${WINDOWS_LIBRARIES} lllogin llprimitive llappearance @@ -2358,7 +2343,6 @@ if (LL_TESTS) set(test_libs - ${WINDOWS_LIBRARIES} llfilesystem llmath llcommon diff --git a/indra/test/CMakeLists.txt b/indra/test/CMakeLists.txt index 1c2961a18a..822574210f 100644 --- a/indra/test/CMakeLists.txt +++ b/indra/test/CMakeLists.txt @@ -75,8 +75,6 @@ target_link_libraries(lltest llcommon llcorehttp ll::googlemock - ${WINDOWS_LIBRARIES} - ${DL_LIBRARY} ) if (WINDOWS) |