summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md23
-rw-r--r--indra/cmake/Meshoptimizer.cmake60
2 files changed, 56 insertions, 27 deletions
diff --git a/README.md b/README.md
index 404c8f7794..9ae3e6d52e 100644
--- a/README.md
+++ b/README.md
@@ -37,22 +37,15 @@ $ cd viewer
$ sudo port install cmake pkgconfig autoconf automake apr-util +universal boost +universal collada-dom +universal hunspell +universal freetype +universal jsoncpp +universal openjpeg +universal openssl11 +universal uriparser +universal libvorbis +universal xxhashlib
$ mkdir -p build/universal-apple-darwin`uname -r`/packages
$ cd ~/Downloads
-$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst -L https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.21.tar.gz -o meshoptimizer-0.21.tar.gz -OL https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/115452/994130/nanosvg-2022.09.27-darwin64-580364.tar.bz2 -OL https://github.com/secondlife/3p-libndofdev/releases/download/v0.1.8e9edc7/libndofdev-0.1.8e9edc7-darwin64-8e9edc7.tar.zst -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz -o openjpeg-2.5.2.tar.gz -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst -OL https://get.videolan.org/vlc/3.0.21/macosx/vlc-3.0.21-universal.dmg -OL https://sourceforge.net/projects/xmlrpc-epi/files/xmlrpc-epi-base/0.54.2/xmlrpc-epi-0.54.2.tar.bz2
+$ curl -OL https://github.com/secondlife/3p-curl/releases/download/v7.54.1-513145c/curl-7.54.1-513145c-darwin64-513145c.tar.zst -OL https://automated-builds-secondlife-com.s3.amazonaws.com/ct2/115452/994130/nanosvg-2022.09.27-darwin64-580364.tar.bz2 -OL https://github.com/secondlife/3p-libndofdev/releases/download/v0.1.8e9edc7/libndofdev-0.1.8e9edc7-darwin64-8e9edc7.tar.zst -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz -o openjpeg-2.5.2.tar.gz -OL https://github.com/secondlife/3p-openssl/releases/download/v1.1.1q.de53f55/openssl-1.1.1q.de53f55-darwin64-de53f55.tar.zst -OL https://get.videolan.org/vlc/3.0.21/macosx/vlc-3.0.21-universal.dmg -OL https://sourceforge.net/projects/xmlrpc-epi/files/xmlrpc-epi-base/0.54.2/xmlrpc-epi-0.54.2.tar.bz2
$ cd -
$ cd ..
-$ tar xf ~/Downloads/meshoptimizer-0.21.tar.gz
$ tar xf ~/Downloads/openjpeg-2.5.2.tar.gz
$ tar xf ~/Downloads/xmlrpc-epi-0.54.2.tar.bz2
$ git clone https://github.com/secondlife/3p-openssl
$ git clone https://github.com/secondlife/3p-curl
$ git clone https://github.com/secondlife/3p-libndofdev
-$ cd meshoptimizer-0.21
-$ mkdir -p build/universal-apple-darwin`uname -r`
-$ cd build/universal-apple-darwin`uname -r`
-$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_ARCHITECTURES:STRING="arm64;x86_64" -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 -DMESHOPT_BUILD_SHARED_LIBS:BOOL=ON ../..
-$ make -j`sysctl -n hw.ncpu`
-$ sudo make install
-$ cd ../../../openjpeg-2.5.2
+$ cd openjpeg-2.5.2
$ sudo cp src/lib/openjp2/cio.h src/lib/openjp2/event.h /opt/local/include/openjpeg-2.5/
$ mkdir -p build/`uname -m`-apple-darwin`uname -r`
$ cd build/`uname -m`-apple-darwin`uname -r`
@@ -174,18 +167,6 @@ $ megapahit
#### Fedora
```
-$ cd ~/Downloads
-$ curl -L https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.21.tar.gz -o meshoptimizer-0.21.tar.gz
-$ cd -
-$ cd ../../..
-$ tar xf ~/Downloads/meshoptimizer-0.21.tar.gz
-$ cd meshoptimizer-0.21
-$ mkdir -p build/`uname -m`-linux-gnu
-$ cd build/`uname -m`-linux-gnu
-$ cmake -DCMAKE_BUILD_TYPE:STRING=Release ../..
-$ make -j`nproc`
-$ sudo make install
-$ cd ../../../viewer/build/`uname -m`-linux-gnu
$ sudo dnf install gcc-c++ patchelf apr-util-devel boost-devel collada-dom-devel expat-devel fltk-devel mesa-libGLU-devel hunspell-devel jsoncpp-devel libnghttp2-devel nanosvg-devel pipewire-devel pulseaudio-libs-devel SDL2-devel uriparser-devel vlc-devel libvorbis-devel xmlrpc-epi-devel xxhash-devel
$ patchelf --remove-rpath packages/bin/release/dullahan_host
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=OFF -DUSE_FMODSTUDIO:BOOL=ON -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=ON -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../../indra
diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake
index a1cf81be80..07ea3120a7 100644
--- a/indra/cmake/Meshoptimizer.cmake
+++ b/indra/cmake/Meshoptimizer.cmake
@@ -6,14 +6,61 @@ include(Prebuilt)
include_guard()
add_library( ll::meshoptimizer INTERFACE IMPORTED )
-if (NOT (USE_AUTOBUILD_3P OR USE_CONAN))
- target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${CMAKE_SYSROOT}/usr/local/include )
- target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer)
- return ()
-endif ()
-
+if (NOT USESYSTEMLIBS)
use_system_binary(meshoptimizer)
+else (NOT USESYSTEMLIBS)
+ cmake_host_system_information(RESULT MAKE_JOBS QUERY NUMBER_OF_LOGICAL_CORES)
+ if (LINUX)
+ cmake_host_system_information(RESULT LINUX_DISTRO QUERY DISTRIB_ID)
+ endif (LINUX)
+ if (NOT (${LINUX_DISTRO} MATCHES fedora OR DARWIN))
+ find_package(meshoptimizer)
+ endif (NOT (${LINUX_DISTRO} MATCHES fedora OR DARWIN))
+endif (NOT USESYSTEMLIBS)
+
+if (${LINUX_DISTRO} MATCHES fedora 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)
+ execute_process(
+ COMMAND mkdir -p ${AUTOBUILD_INSTALL_DIR}/include/meshoptimizer
+ COMMAND curl
+ -L https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.21.tar.gz
+ -o meshoptimizer-0.21.tar.gz
+ WORKING_DIRECTORY $ENV{HOME}/Downloads
+ )
+ execute_process(
+ COMMAND tar xf $ENV{HOME}/Downloads/meshoptimizer-0.21.tar.gz
+ WORKING_DIRECTORY /tmp
+ )
+ execute_process(
+ COMMAND cmake
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ .
+ WORKING_DIRECTORY /tmp/meshoptimizer-0.21
+ )
+ if (DARWIN)
+ execute_process(
+ COMMAND cmake
+ -DCMAKE_OSX_ARCHITECTURES:STRING=arm64
+ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15
+ .
+ WORKING_DIRECTORY /tmp/meshoptimizer-0.21
+ )
+ endif (DARWIN)
+ execute_process(
+ COMMAND make -j${MAKE_JOBS}
+ WORKING_DIRECTORY /tmp/meshoptimizer-0.21
+ )
+ execute_process(
+ COMMAND cp /tmp/meshoptimizer-0.21/src/meshoptimizer.h ${AUTOBUILD_INSTALL_DIR}/include/meshoptimizer/
+ COMMAND cp /tmp/meshoptimizer-0.21/libmeshoptimizer.a ${AUTOBUILD_INSTALL_DIR}/lib/release/
+ WORKING_DIRECTORY ${AUTOBUILD_INSTALL_DIR}
+ RESULT_VARIABLE meshoptimizer_installed
+ )
+ endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/meshoptimizer_installed OR NOT ${meshoptimizer_installed} EQUAL 0)
+ else (USESYSTEMLIBS)
use_prebuilt_binary(meshoptimizer)
+ endif (USESYSTEMLIBS)
if (WINDOWS)
target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib)
@@ -24,3 +71,4 @@ elseif (DARWIN)
endif (WINDOWS)
target_include_directories( ll::meshoptimizer SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/meshoptimizer)
+endif (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR NOT USESYSTEMLIBS)