From f5ab6e11f13699c03a696611f67f8384434130a1 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 13 May 2025 10:22:54 +0800 Subject: 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. --- indra/cmake/Meshoptimizer.cmake | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'indra/cmake/Meshoptimizer.cmake') diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake index d5c6598d94..24be3a256d 100644 --- a/indra/cmake/Meshoptimizer.cmake +++ b/indra/cmake/Meshoptimizer.cmake @@ -6,15 +6,12 @@ include(Prebuilt) include_guard() add_library( ll::meshoptimizer INTERFACE IMPORTED ) -if (NOT USESYSTEMLIBS) -use_system_binary(meshoptimizer) -elseif (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD) +#use_system_binary(meshoptimizer) +if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD) find_package(meshoptimizer) target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer) return () -endif (NOT USESYSTEMLIBS) - -if (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND NOT (${LINUX_DISTRO} MATCHES gentoo) OR NOT USESYSTEMLIBS) +elseif (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND NOT (${LINUX_DISTRO} MATCHES gentoo)) use_prebuilt_binary(meshoptimizer) elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed OR NOT ${meshoptimizer_installed} EQUAL 0) if (NOT EXISTS ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz) @@ -48,12 +45,12 @@ elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRA ) file(WRITE ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed "${meshoptimizer_installed}") endif (${MESHOPTIMIZER_RESULT}) -endif (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND NOT (${LINUX_DISTRO} MATCHES gentoo) OR NOT USESYSTEMLIBS) +endif () -if (NOT USESYSTEMLIBS AND WINDOWS) +if (WINDOWS) target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib) -else (NOT USESYSTEMLIBS AND WINDOWS) +else () target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a) -endif (NOT USESYSTEMLIBS AND WINDOWS) +endif (WINDOWS) target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/meshoptimizer) -- cgit v1.2.3 From 793bdbf972eca4c032813d6e2c4ef4e79d1628eb Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 13 May 2025 10:48:20 +0800 Subject: Empty CMake elses & endifs parentheses to make it more flexible the next time a value in the if's parentheses gets changed again, and also to reduce duplicate pattern matches when grepping those CMake files with certain keywords. --- indra/cmake/Meshoptimizer.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/cmake/Meshoptimizer.cmake') diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake index 24be3a256d..4b428e4b83 100644 --- a/indra/cmake/Meshoptimizer.cmake +++ b/indra/cmake/Meshoptimizer.cmake @@ -19,7 +19,7 @@ elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRA https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.21.tar.gz ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz ) - endif (NOT EXISTS ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz) + endif () file(ARCHIVE_EXTRACT INPUT ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz DESTINATION ${CMAKE_BINARY_DIR} @@ -44,7 +44,7 @@ elseif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRA OUTPUT_VARIABLE meshoptimizer_installed ) file(WRITE ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed "${meshoptimizer_installed}") - endif (${MESHOPTIMIZER_RESULT}) + endif () endif () if (WINDOWS) -- cgit v1.2.3 From 7ecde89008f9ed39c357b606d3bc231ba4360ee2 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 27 May 2025 10:01:21 +0800 Subject: Pass configuration phase with vcpkg replacing MSYS2 I happen to be using just Git Bash for convenience for running the commands on the Windows build instructions, hence the build folder pattern to be ignored from the result of running `uname -s` there. The instructions omit the part where you install vcpkg and set the VCPKG_ROOT environment variable, cause it depends on where you install vcpkg to your liking, but the next commands will rely on that variable being set correctly. The CMake used here is MS VS 2022 Community Edition's one, since it will know where the C++ compiler is. $VCPKG_ROOT/downloads/tools/msys2/21caed2f81ec917b/mingw64/bin is where pkg-config.exe can be found. $VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/libxml2 is where xmllint.exe can be found (from libxml2[tools]). PKG_CONFIG_LIBDIR and PYTHON environment settings are pretty self-explanatory. The flags set on LL_BUILD are now for Visual C++ and not MinGW(64)'s GCC or Clang any more, and copied from most of the flags in the variables file from LL's build-variables repo. vcpkg's apr & apr-util packages don't seem to install their .pc files, hence the manual target_include/link_directories/libraries settings, relying on some automatically generated INTERNAL CMake variable called prefix_result. vcpkg's Boost needs the same treatment, plus some suffix. We still use LL's prebuilt libs for OpenSSL, libcurl and WebRTC. Actually too for ColladaDOM for now, but we prepare Windows ColladaDOM self-building for later. For GLM and Meshoptimizer too, it's just the checking that's skipped otherwise it would fail (but the vcpkg packages can be used). Visual C++ doesn't recognise the no-deprecated-declarations compile option. On Visual C++, the macro to denote x86-64 seems to be _M_X64 (if not added there, it would try to find sse2neon :)) We still aren't using Autobuild here for Windows either, hence the FALSE-d viewer_manifest.py based file bundling. --- indra/cmake/Meshoptimizer.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/cmake/Meshoptimizer.cmake') diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake index 4b428e4b83..5058614580 100644 --- a/indra/cmake/Meshoptimizer.cmake +++ b/indra/cmake/Meshoptimizer.cmake @@ -7,8 +7,10 @@ include_guard() add_library( ll::meshoptimizer INTERFACE IMPORTED ) #use_system_binary(meshoptimizer) -if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD) - find_package(meshoptimizer) +if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR CMAKE_SYSTEM_NAME MATCHES FreeBSD OR WINDOWS) + if (NOT WINDOWS) + find_package(meshoptimizer) + endif () target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer) return () elseif (LINUX AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND NOT (${LINUX_DISTRO} MATCHES gentoo)) -- cgit v1.2.3