summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-08-31 07:45:27 +0800
committerErik Kundiman <erik@megapahit.org>2024-08-31 07:50:30 +0800
commit6bc9ec41ddd0191748ef938909a3ed192c9e59cd (patch)
treeef4fad8f8f00ece8f25c919313d9e0fd42063448
parentd604302d942d26ccfd8e0e5de548fa437d1425d5 (diff)
Revert Linux/BSD to use system Collada DOM for now
Turns out getting 2.3 compiled on those platforms need a lot more attention. Apart from that, the compilation result variable name got fixed, the prebuilt include directory got fixed, and pkg-config-ing minizip, libpcrecpp and libxml-2.0 so we can make have generic variable arguments to pass to Collada DOM's CMake settings.
-rw-r--r--README.md10
-rw-r--r--indra/cmake/LLPrimitive.cmake40
-rw-r--r--indra/llprimitive/lldaeloader.cpp8
3 files changed, 42 insertions, 16 deletions
diff --git a/README.md b/README.md
index 22d144b46f..7c2e865dfd 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ $ open newview/Megapahit.app
### Debian
```
-$ sudo apt install cmake pkg-config libxml2-utils libalut-dev libaprutil1-dev libboost-fiber1.81-dev libboost-json1.81-dev libboost-program-options1.81-dev libboost-regex1.81-dev libexpat1-dev libfltk1.3-dev libfontconfig-dev libfreetype-dev libglu1-mesa-dev libhunspell-dev libjpeg-dev libmeshoptimizer-dev libnghttp2-dev libpipewire-0.3-dev libpng-dev libsdl2-dev liburiparser-dev libvlc-dev libvlccore-dev libvorbis-dev libxft-dev libxmlrpc-epi-dev libxxhash-dev
+$ sudo apt install cmake pkg-config libxml2-utils libalut-dev libaprutil1-dev libboost-fiber1.81-dev libboost-json1.81-dev libboost-program-options1.81-dev libboost-regex1.81-dev libcollada-dom-dev libexpat1-dev libfltk1.3-dev libfontconfig-dev libfreetype-dev libglu1-mesa-dev libhunspell-dev libjpeg-dev libmeshoptimizer-dev libnghttp2-dev libpipewire-0.3-dev libpng-dev libsdl2-dev liburiparser-dev libvlc-dev libvlccore-dev libvorbis-dev libxft-dev libxmlrpc-epi-dev libxxhash-dev
$ export LL_BUILD="-O3 -std=c++17 -fPIC -DLL_LINUX=1"
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=ON -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../indra
$ make -j`nproc`
@@ -61,7 +61,7 @@ $ megapahit
### Ubuntu
```
-$ sudo apt install cmake pkg-config libxml2-utils libaprutil1-dev libboost-fiber-dev libboost-json-dev libboost-program-options-dev libboost-regex-dev libexpat1-dev libfltk1.3-dev libfontconfig-dev libfreetype-dev libglu1-mesa-dev libhunspell-dev libjpeg-dev libmeshoptimizer-dev libnanosvg-dev libnghttp2-dev libpipewire-0.3-dev libpng-dev libsdl2-dev liburiparser-dev libvlc-dev libvlccore-dev libvorbis-dev libxft-dev libxmlrpc-epi-dev libxxhash-dev
+$ sudo apt install cmake pkg-config libxml2-utils libaprutil1-dev libboost-fiber-dev libboost-json-dev libboost-program-options-dev libboost-regex-dev libcollada-dom-dev libexpat1-dev libfltk1.3-dev libfontconfig-dev libfreetype-dev libglu1-mesa-dev libhunspell-dev libjpeg-dev libmeshoptimizer-dev libnanosvg-dev libnghttp2-dev libpipewire-0.3-dev libpng-dev libsdl2-dev liburiparser-dev libvlc-dev libvlccore-dev libvorbis-dev libxft-dev libxmlrpc-epi-dev libxxhash-dev
$ export LL_BUILD="-O3 -std=c++17 -fPIC -DLL_LINUX=1"
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=OFF -DUSE_FMODSTUDIO:BOOL=ON -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=ON -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../indra
$ make -j`nproc`
@@ -73,7 +73,7 @@ $ megapahit
### Fedora
```
-$ sudo dnf install cmake gcc-c++ patchelf apr-util-devel boost-devel expat-devel fltk-devel mesa-libGLU-devel hunspell-devel libnghttp2-devel nanosvg-devel openjpeg-devel pipewire-devel pulseaudio-libs-devel SDL2-devel uriparser-devel vlc-devel libvorbis-devel xmlrpc-epi-devel xxhash-devel
+$ sudo dnf install cmake gcc-c++ patchelf apr-util-devel boost-devel collada-dom-devel expat-devel fltk-devel mesa-libGLU-devel hunspell-devel libnghttp2-devel nanosvg-devel openjpeg-devel pipewire-devel pulseaudio-libs-devel SDL2-devel uriparser-devel vlc-devel libvorbis-devel xmlrpc-epi-devel xxhash-devel
$ export LL_BUILD="-O3 -std=c++17 -fPIC -DLL_LINUX=1"
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=OFF -DUSE_FMODSTUDIO:BOOL=ON -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=ON -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../indra
$ make -j`nproc`
@@ -87,13 +87,13 @@ $ megapahit
```
$ setenv LL_BUILD "-O3 -std=c++17 -fPIC"
$ sudo su -
-# portmaster devel/cmake devel/pkgconf audio/freealut devel/apr1 x11-toolkits/fltk math/glm textproc/hunspell misc/meshoptimizer graphics/nanosvg graphics/openjpeg devel/sdl20 net/uriparser multimedia/vlc audio/libvorbis net/xmlrpc-epi devel/xxhash
+# portmaster devel/cmake devel/pkgconf audio/freealut devel/apr1 devel/collada-dom x11-toolkits/fltk math/glm textproc/hunspell misc/meshoptimizer graphics/nanosvg graphics/openjpeg devel/sdl20 net/uriparser multimedia/vlc audio/libvorbis net/xmlrpc-epi devel/xxhash
# exit
$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:INTERNAL=64 -DUSESYSTEMLIBS:BOOL=ON -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=OFF -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=ON -DPACKAGE:BOOL=ON ../indra
$ make -j`nproc`
$ sudo cpack -G FREEBSD
$ sudo pkg add megapahit-`cat newview/viewer_version.txt`-FreeBSD.pkg
-$ sudo pkg set -yA 1 freealut apr1 fltk hunspell meshoptimizer nanosvg openjpeg sdl20 uriparser vlc libvorbis xmlrpc-epi
+$ sudo pkg set -yA 1 freealut apr1 collada-dom fltk hunspell meshoptimizer nanosvg openjpeg sdl20 uriparser vlc libvorbis xmlrpc-epi
$ megapahit
```
diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake
index 8174e8a851..ed57d6ed89 100644
--- a/indra/cmake/LLPrimitive.cmake
+++ b/indra/cmake/LLPrimitive.cmake
@@ -18,6 +18,16 @@ if( USE_CONAN )
"${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" )
endif()
+if(LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD )
+ include(FindPkgConfig)
+ pkg_check_modules(Colladadom REQUIRED collada-dom)
+ target_compile_definitions( ll::colladadom INTERFACE COLLADA_DOM_SUPPORT141 )
+ target_include_directories( ll::colladadom SYSTEM INTERFACE ${Colladadom_INCLUDE_DIRS} ${Colladadom_INCLUDE_DIRS}/1.4 )
+ target_link_directories( ll::colladadom INTERFACE ${Colladadom_LIBRARY_DIRS} )
+ target_link_libraries( ll::colladadom INTERFACE ${Colladadom_LIBRARIES} )
+ return ()
+endif(LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD )
+
if( (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/colladadom_installed OR NOT ${colladadom_installed} EQUAL 0) AND USESYSTEMLIBS )
if (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r4.tar.gz)
file(DOWNLOAD
@@ -29,6 +39,12 @@ if( (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKI
INPUT ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r4.tar.gz
DESTINATION ${CMAKE_BINARY_DIR}
)
+
+ file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/collada/1.4)
+ include(FindPkgConfig)
+ pkg_check_modules(Minizip REQUIRED minizip)
+ pkg_check_modules(Libxml2 REQUIRED libxml-2.0)
+ pkg_check_modules(Libpcrecpp libpcrecpp)
if (DARWIN)
try_compile(COLLADADOM_RESULT
PROJECT colladadom
@@ -38,16 +54,14 @@ if( (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKI
CMAKE_FLAGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DOPT_COLLADA14:BOOL=ON
- -DCOLLADA_DOM_INCLUDE_INSTALL_DIR:FILEPATH=${LIBS_PREBUILT_DIR}/include/colladadom
+ -DCOLLADA_DOM_INCLUDE_INSTALL_DIR:FILEPATH=${LIBS_PREBUILT_DIR}/include/collada
-DCOLLADA_DOM_SOVERSION:STRING=0
-DCOLLADA_DOM_VERSION:STRING=2.3-r4
- -Dlibpcrecpp_LIBRARIES:STRING=pcrecpp
- -DZLIB_LIBRARIES:STRING=xml2
+ -DEXTRA_COMPILE_FLAGS:STRING="-I${Minizip_INCLUDE_DIRS} -I${Libxml2_INCLUDE_DIRS}"
+ -DCMAKE_SHARED_LINKER_FLAGS:STRING="-L${Libxml2_LIBRARY_DIRS} -l${Libxml2_LIBRARIES}"
+ -Dlibpcrecpp_LIBRARIES:STRING="${Libpcrecpp_LIBRARIES}"
-DBoost_FILESYSTEM_LIBRARY:STRING=boost_filesystem-mt
-DBoost_SYSTEM_LIBRARY:STRING=boost_system-mt
- -DEXTRA_COMPILE_FLAGS:STRING=-I/opt/local/include/minizip
- -DBoost_CFLAGS:STRING=-I/opt/local/include
- -DCMAKE_SHARED_LINKER_FLAGS:STRING=-L/opt/local/lib
-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15
OUTPUT_VARIABLE colladadom_installed
@@ -61,25 +75,29 @@ if( (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKI
CMAKE_FLAGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DOPT_COLLADA14:BOOL=ON
- -DCOLLADA_DOM_INCLUDE_INSTALL_DIR:FILEPATH=${LIBS_PREBUILT_DIR}/include/colladadom
+ -DCOLLADA_DOM_INCLUDE_INSTALL_DIR:FILEPATH=${LIBS_PREBUILT_DIR}/include/collada
-DCOLLADA_DOM_SOVERSION:STRING=0
-DCOLLADA_DOM_VERSION:STRING=2.3-r4
+ -DEXTRA_COMPILE_FLAGS:STRING="-I${Minizip_INCLUDE_DIRS} -I${Libxml2_INCLUDE_DIRS} -I${Libpcrecpp_INCLUDE_DIRS}"
+ -DCMAKE_SHARED_LINKER_FLAGS:STRING="-L${Libxml2_LIBRARY_DIRS} -l${Libxml2_LIBRARIES}"
-Dlibpcrecpp_LIBRARIES:STRING=pcrecpp
- -DZLIB_LIBRARIES:STRING=xml2
+ -DBoost_FILESYSTEM_LIBRARY:STRING=boost_filesystem
+ -DBoost_SYSTEM_LIBRARY:STRING=boost_system
OUTPUT_VARIABLE colladadom_installed
)
endif (DARWIN)
- if (${MESHOPTIMIZER_RESULT})
+ if (${COLLADADOM_RESULT})
+ file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/include/collada)
file(
COPY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r4/dom/include
- DESTINATION ${LIBS_PREBUILT_DIR}/include/colladadom
+ DESTINATION ${LIBS_PREBUILT_DIR}/include/collada
)
file(
COPY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r4/dom/libcollada14dom.a
DESTINATION ${LIBS_PREBUILT_DIR}/lib/release
)
file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "0")
- endif (${MESHOPTIMIZER_RESULT})
+ endif (${COLLADADOM_RESULT})
else( (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/colladadom_installed OR NOT ${colladadom_installed} EQUAL 0) AND USESYSTEMLIBS )
use_system_binary( colladadom )
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index 43fb043363..56bf91bc22 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -941,12 +941,20 @@ bool LLDAELoader::OpenFile(const std::string& filename)
domCOLLADA* dom;
if (mPreprocessDAE)
{
+#if __FreeBSD__ || (LL_USESYSTEMLIBS && LL_LINUX)
+ dom = static_cast<domCOLLADA *>(dae.openFromMemory(uri_filename, preprocessDAE(filename).c_str()));
+#else
dom = dae.openFromMemory(uri_filename, preprocessDAE(filename).c_str());
+#endif
}
else
{
LL_INFOS() << "Skipping dae preprocessing" << LL_ENDL;
+#if __FreeBSD__ || (LL_USESYSTEMLIBS && LL_LINUX)
+ dom = static_cast<domCOLLADA *>(dae.open(uri_filename));
+#else
dom = dae.open(uri_filename);
+#endif
}
if (!dom)