diff options
author | Erik Kundiman <erik@megapahit.org> | 2025-06-04 14:10:51 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2025-06-04 18:04:59 +0800 |
commit | 2971fde36e3a04772f317a08e5d1335161637e3c (patch) | |
tree | 62aca475a202d2d1a422c22febf47a9de7247b2e | |
parent | 8e096fdcdcfa4f8db762dfb9a2b8dd4e29c78eea (diff) |
Self-build ColladaDOM on Windows
Plus simplifying the SHARED to STATIC stream editing by not using the
global 'g' key, cause it's only 1 instance to edit.
For now, BOOST_CFLAGS & BOOST_LIBS are set to refer to SLv prebuilt
binary installation, along with its library suffix.
try_compile doesn't seem to "compile" it, but it does configure it, so
we just execute MSBuild.exe afterwards.
Last time I tried, it didn't finish building or didn't build
successfully, though.
So what I did is manually run MSBuild.exe on ColladaDOM's solution file,
and the next CMake configuration picked up the generated library,
renamed to be the same as expected when using SLv prebuilt one, so that
we don't have to adjust more lines for this, it has to be copied/moved
anyway, might as well rename it the same.
About the WIN32 definition stream editing, somehow WIN32 is not defined
in daeUtils.cpp, that it would fail at deciding which commands to
compile. I did try adding /DWIN32 to CXX_FLAGS but it ruined it for the
Minizip header directory search. So the hack is to just forcefully
define WIN32 in that file.
-rw-r--r-- | indra/cmake/LLPrimitive.cmake | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake index 3429a744f5..a8b328b84b 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -22,7 +22,7 @@ if( LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD ) # Build of the collada-dom for Linux and FreeBSD is done in # indra/llprimitive/CMakeLists.txt return() -elseif ( NOT WINDOWS ) +else () include(FindPkgConfig) pkg_check_modules(Minizip REQUIRED minizip) pkg_check_modules(Libxml2 REQUIRED libxml-2.0) @@ -41,13 +41,16 @@ elseif ( NOT WINDOWS ) ) if ( WINDOWS ) execute_process( - COMMAND sed -i "s/SHARED/STATIC/g" CMakeLists.txt + COMMAND sed -i "s/SHARED/STATIC/" CMakeLists.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4 ) - set(BOOST_LIBRARY_SUFFIX -vc143-mt-x64-1_88) + execute_process( + COMMAND sed -i "/#include <cstdarg>/a #define WIN32" daeUtils.cpp + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/dae + ) else () execute_process( - COMMAND sed -i "" -e "s/SHARED/STATIC/g" CMakeLists.txt + COMMAND sed -i "" -e "s/SHARED/STATIC/" CMakeLists.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4 ) endif () @@ -55,6 +58,10 @@ elseif ( NOT WINDOWS ) set(BOOST_CFLAGS -I${Libxml2_LIBRARY_DIRS}exec/boost/1.87/include) set(BOOST_LIBS -L${Minizip_LIBRARY_DIRS}exec/boost/1.87/lib) set(BOOST_LIBRARY_SUFFIX -mt) + elseif( WINDOWS ) + set(BOOST_CFLAGS -I${LIBS_PREBUILT_DIR}/include) + set(BOOST_LIBS -L${ARCH_PREBUILT_DIRS_RELEASE}) + set(BOOST_LIBRARY_SUFFIX -mt-x${ADDRESS_SIZE}) endif() file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/collada/1.4) try_compile(COLLADADOM_RESULT @@ -88,17 +95,34 @@ elseif ( NOT WINDOWS ) ${ARCH_PREBUILT_DIRS}/libcollada14dom.a ${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom.a ) - file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "${colladadom_installed}") + elseif ( WINDOWS ) + execute_process( + COMMAND MSBuild.exe ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/Project.sln -p:Configuration=Release + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8 + OUTPUT_VARIABLE colladadom_installed + ) + file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/include/collada) + file( + COPY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/include + DESTINATION ${LIBS_PREBUILT_DIR}/include + ) + file(RENAME + ${LIBS_PREBUILT_DIR}/include/include + ${LIBS_PREBUILT_DIR}/include/collada + ) + file(RENAME + ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4/Release/collada14dom.lib + ${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom23-s.lib + ) endif() + file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "${colladadom_installed}") endif() endif() -#use_system_binary( colladadom ) +if( FALSE ) +use_system_binary( colladadom ) -if (WINDOWS) use_prebuilt_binary(colladadom) -endif () -if( FALSE ) use_prebuilt_binary(minizip-ng) # needed for colladadom use_prebuilt_binary(libxml2) |