diff options
| author | Erik Kundiman <erik@megapahit.org> | 2025-05-13 10:22:54 +0800 |
|---|---|---|
| committer | Erik Kundiman <erik@megapahit.org> | 2025-05-13 10:22:54 +0800 |
| commit | f5ab6e11f13699c03a696611f67f8384434130a1 (patch) | |
| tree | d82a47eec16982302ae74db3a84d0c5aaa0dc481 /indra/cmake/Prebuilt.cmake | |
| parent | abb32860d2a6e49e10d3ab243a62154d67f802b2 (diff) | |
Not rely on (LL_)USESYSTEMLIBS macro & CMake setting
but the fact that we keep on using as many system libraries as we
can (and only resort to other sources in certain cases), hasn't
changed, of course.
Also stop having to set USE_AUTOBUILD_3P to OFF.
Lines are reindented, and when a system library can be found for
a dependency, then that should be the way. If later we find out
that using some other way is better, than stick to that. So, one
option at a time, whichever is best for the situation.
GLEXT hasn't been used, and in order to be not having to hack its
.cmake file, we bypass it and refer to GLH (which is still used)
right away in LLWindow.
CMake commands that need to be bypassed, if it's a one-liner then
it's just commented out, but if it's multiple lines, then scope
them with if (FALSE) to minimise difference.
Diffstat (limited to 'indra/cmake/Prebuilt.cmake')
| -rw-r--r-- | indra/cmake/Prebuilt.cmake | 85 |
1 files changed, 42 insertions, 43 deletions
diff --git a/indra/cmake/Prebuilt.cmake b/indra/cmake/Prebuilt.cmake index 751e83051f..2d5eb5d805 100644 --- a/indra/cmake/Prebuilt.cmake +++ b/indra/cmake/Prebuilt.cmake @@ -40,38 +40,37 @@ macro (use_prebuilt_binary _binary) --install-dir=${AUTOBUILD_INSTALL_DIR} ${_binary} ") endif(DEBUG_PREBUILT) - if(USESYSTEMLIBS) + execute_process(COMMAND xmllint + --xpath + "//map/map/map/map/map/map/string[contains(text(),'${_binary}')][contains(text(),'common')]/text()" autobuild.xml + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/.. + OUTPUT_VARIABLE package_url + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if ("${package_url}" STREQUAL "") + string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) + if (${system_name} MATCHES freebsd) + set(system_name "linux") + endif (${system_name} MATCHES freebsd) execute_process(COMMAND xmllint --xpath - "//map/map/map/map/map/map/string[contains(text(),'${_binary}')][contains(text(),'common')]/text()" autobuild.xml + "//map/map/map/map/map/map/string[contains(text(),'${_binary}')][contains(text(),'${system_name}')]/text()" autobuild.xml WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/.. OUTPUT_VARIABLE package_url OUTPUT_STRIP_TRAILING_WHITESPACE ) - if ("${package_url}" STREQUAL "") - string(TOLOWER ${CMAKE_SYSTEM_NAME} system_name) - if (${system_name} MATCHES freebsd) - set(system_name "linux") - endif (${system_name} MATCHES freebsd) - execute_process(COMMAND xmllint - --xpath - "//map/map/map/map/map/map/string[contains(text(),'${_binary}')][contains(text(),'${system_name}')]/text()" autobuild.xml - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/.. - OUTPUT_VARIABLE package_url - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif ("${package_url}" STREQUAL "") - string(REGEX REPLACE "^https?://(megapahit.net/downloads|github.com/secondlife|automated-builds-secondlife-com.s3.amazonaws.com/ct2).*/" "" package_name ${package_url}) - file(DOWNLOAD - ${package_url} - ${CMAKE_BINARY_DIR}/${package_name} - ) - file(ARCHIVE_EXTRACT - INPUT ${CMAKE_BINARY_DIR}/${package_name} - DESTINATION ${AUTOBUILD_INSTALL_DIR} - ) - set(${_binary}_installed 0) - else(USESYSTEMLIBS) + endif ("${package_url}" STREQUAL "") + string(REGEX REPLACE "^https?://(megapahit.net/downloads|github.com/secondlife|automated-builds-secondlife-com.s3.amazonaws.com/ct2).*/" "" package_name ${package_url}) + file(DOWNLOAD + ${package_url} + ${CMAKE_BINARY_DIR}/${package_name} + ) + file(ARCHIVE_EXTRACT + INPUT ${CMAKE_BINARY_DIR}/${package_name} + DESTINATION ${AUTOBUILD_INSTALL_DIR} + ) + set(${_binary}_installed 0) + if(FALSE) execute_process(COMMAND "${AUTOBUILD_EXECUTABLE}" install --install-dir=${AUTOBUILD_INSTALL_DIR} @@ -79,7 +78,7 @@ macro (use_prebuilt_binary _binary) WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE ${_binary}_installed ) - endif(USESYSTEMLIBS) + endif() file(WRITE ${PREBUILD_TRACKING_DIR}/${_binary}_installed "${${_binary}_installed}") endif(${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/${_binary}_installed OR NOT ${${_binary}_installed} EQUAL 0) @@ -92,6 +91,22 @@ endmacro (use_prebuilt_binary _binary) #Sadly we need a macro here, otherwise the return() will not properly work macro ( use_system_binary package ) + include(FindPkgConfig) + pkg_check_modules(${package} ${package}) + if( ${package}_FOUND ) + target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) + else() + pkg_check_modules(${package} lib${package}) + if( ${package}_FOUND ) + target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) + else() + find_package( ${package} REQUIRED ) + endif() + endif() + target_include_directories( ll::${package} SYSTEM INTERFACE ${${package}_INCLUDE_DIRS} ) + target_link_libraries( ll::${package} INTERFACE ${${package}_LIBRARIES} ) + return() + if( USE_CONAN ) target_link_libraries( ll::${package} INTERFACE CONAN_PKG::${package} ) foreach( extra_pkg "${ARGN}" ) @@ -100,22 +115,6 @@ macro ( use_system_binary package ) endif() endforeach() return() - elseif( NOT USE_AUTOBUILD_3P ) - include(FindPkgConfig) - pkg_check_modules(${package} ${package}) - if( ${package}_FOUND ) - target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) - else() - pkg_check_modules(${package} lib${package}) - if( ${package}_FOUND ) - target_link_directories( ll::${package} INTERFACE ${${package}_LIBRARY_DIRS} ) - else() - find_package( ${package} REQUIRED ) - endif() - endif() - target_include_directories( ll::${package} SYSTEM INTERFACE ${${package}_INCLUDE_DIRS} ) - target_link_libraries( ll::${package} INTERFACE ${${package}_LIBRARIES} ) - return() endif() endmacro() |
