diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-09-30 11:48:20 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-09-30 11:48:20 +0800 |
commit | f7873910039b45b4426172cea1f0db3f79f349c5 (patch) | |
tree | 85ef3c36ed31ba135a012014bf26fc004ccca31d /indra/cmake/Meshoptimizer.cmake | |
parent | e6165435ab48673612bf8896d68bcd2543176692 (diff) |
Windows configuration, with MSYS2 in MinGW for now
Also simplify CMake-based dependency projects, the parameters that
have been set for the viewer seem to have been implied all this time
for the subprojects.
Diffstat (limited to 'indra/cmake/Meshoptimizer.cmake')
-rw-r--r-- | indra/cmake/Meshoptimizer.cmake | 99 |
1 files changed, 38 insertions, 61 deletions
diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake index 0dc4069431..e1bfe10e93 100644 --- a/indra/cmake/Meshoptimizer.cmake +++ b/indra/cmake/Meshoptimizer.cmake @@ -8,72 +8,49 @@ add_library( ll::meshoptimizer INTERFACE IMPORTED ) if (NOT USESYSTEMLIBS) use_system_binary(meshoptimizer) -else (NOT USESYSTEMLIBS) - if (NOT (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN)) - find_package(meshoptimizer) - target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer) - endif (NOT (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN)) +elseif (${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_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR NOT USESYSTEMLIBS) - if (USESYSTEMLIBS) - if (${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) - file(DOWNLOAD - 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) - file(ARCHIVE_EXTRACT - INPUT ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz - DESTINATION ${CMAKE_BINARY_DIR} - ) - if (DARWIN) - try_compile(MESHOPTIMIZER_RESULT - PROJECT meshoptimizer - SOURCE_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 - BINARY_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 - TARGET meshoptimizer - CMAKE_FLAGS - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} - -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15 - OUTPUT_VARIABLE meshoptimizer_installed - ) - else (DARWIN) - try_compile(MESHOPTIMIZER_RESULT - PROJECT meshoptimizer - SOURCE_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 - BINARY_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 - TARGET meshoptimizer - CMAKE_FLAGS - -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} - OUTPUT_VARIABLE meshoptimizer_installed - ) - endif (DARWIN) - if (${MESHOPTIMIZER_RESULT}) - file( - COPY ${CMAKE_BINARY_DIR}/meshoptimizer-0.21/src/meshoptimizer.h - DESTINATION ${LIBS_PREBUILT_DIR}/include/meshoptimizer - ) - file( - COPY ${CMAKE_BINARY_DIR}/meshoptimizer-0.21/libmeshoptimizer.a - DESTINATION ${LIBS_PREBUILT_DIR}/lib/release - ) - file(WRITE ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed "0") - endif (${MESHOPTIMIZER_RESULT}) - endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed OR NOT ${meshoptimizer_installed} EQUAL 0) - else (USESYSTEMLIBS) +if (LINUX OR NOT USESYSTEMLIBS) use_prebuilt_binary(meshoptimizer) - endif (USESYSTEMLIBS) +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) + file(DOWNLOAD + 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) + file(ARCHIVE_EXTRACT + INPUT ${CMAKE_BINARY_DIR}/meshoptimizer-0.21.tar.gz + DESTINATION ${CMAKE_BINARY_DIR} + ) + try_compile(MESHOPTIMIZER_RESULT + PROJECT meshoptimizer + SOURCE_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 + BINARY_DIR ${CMAKE_BINARY_DIR}/meshoptimizer-0.21 + TARGET meshoptimizer + OUTPUT_VARIABLE meshoptimizer_installed + ) + if (${MESHOPTIMIZER_RESULT}) + file( + COPY ${CMAKE_BINARY_DIR}/meshoptimizer-0.21/src/meshoptimizer.h + DESTINATION ${LIBS_PREBUILT_DIR}/include/meshoptimizer + ) + file( + COPY ${CMAKE_BINARY_DIR}/meshoptimizer-0.21/libmeshoptimizer.a + DESTINATION ${LIBS_PREBUILT_DIR}/lib/release + ) + file(WRITE ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed "${meshoptimizer_installed}") + endif (${MESHOPTIMIZER_RESULT}) +endif (LINUX OR NOT USESYSTEMLIBS) -if (WINDOWS) +if (NOT USESYSTEMLIBS AND WINDOWS) target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib) -elseif (LINUX) +else (NOT USESYSTEMLIBS AND WINDOWS) target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a) -elseif (DARWIN) - target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a) -endif (WINDOWS) +endif (NOT USESYSTEMLIBS AND WINDOWS) target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/meshoptimizer) -endif (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR NOT USESYSTEMLIBS) |