summaryrefslogtreecommitdiff
path: root/indra/cmake
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2024-09-17 14:57:43 +0800
committerErik Kundiman <erik@megapahit.org>2024-09-17 16:04:00 +0800
commit3a36cdf6ebd9d2795bdcd14162f38df568d51796 (patch)
tree4be99f15c5a949b5b672c46543cefa4b1bba225b /indra/cmake
parent9ddbe775ebc06fe273f7946c6aca14d855f5fb5f (diff)
Revert to LL's OpenJPEG fork
System 2.5.2 caused too much rainbow in DeltaFPS. For now, the OpenJPEG listed in autobuild.xml is 2.5.0. However, LL has recently got 2.5.2 too in their OpenJPEG fork repo, but we switch to that once it's the one listed in autobuild.xml. Reverting to the now maintained LL 3p-openjpeg should fix the texture thrashing problem https://megapahit.com/show_bug.cgi?id=1 starting from DeltaFPS.
Diffstat (limited to 'indra/cmake')
-rw-r--r--indra/cmake/OpenJPEG.cmake82
1 files changed, 49 insertions, 33 deletions
diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake
index 9bb222d8e8..9d0303340f 100644
--- a/indra/cmake/OpenJPEG.cmake
+++ b/indra/cmake/OpenJPEG.cmake
@@ -6,50 +6,66 @@ add_library( ll::openjpeg INTERFACE IMPORTED )
if (NOT USESYSTEMLIBS)
use_system_binary(openjpeg)
-elseif (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
- include(FindPkgConfig)
- pkg_check_modules(Openjpeg REQUIRED libopenjp2)
- target_include_directories(ll::openjpeg SYSTEM INTERFACE ${Openjpeg_INCLUDE_DIRS})
- target_link_directories(ll::openjpeg INTERFACE ${Openjpeg_LIBRARY_DIRS})
- target_link_libraries(ll::openjpeg INTERFACE ${Openjpeg_LIBRARIES})
endif (NOT USESYSTEMLIBS)
-if (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
+if (USESYSTEMLIBS AND NOT LINUX)
if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openjpeg_installed OR NOT ${openjpeg_installed} EQUAL 0)
- if (NOT EXISTS ${CMAKE_BINARY_DIR}/openjpeg-2.5.2.tar.gz)
- file(DOWNLOAD
- https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz
- ${CMAKE_BINARY_DIR}/openjpeg-2.5.2.tar.gz
- )
- endif (NOT EXISTS ${CMAKE_BINARY_DIR}/openjpeg-2.5.2.tar.gz)
- file(ARCHIVE_EXTRACT
- INPUT ${CMAKE_BINARY_DIR}/openjpeg-2.5.2.tar.gz
- DESTINATION ${CMAKE_BINARY_DIR}
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248.tar.gz)
+ file(DOWNLOAD
+ https://github.com/secondlife/3p-openjpeg/archive/refs/tags/v2.5.0.ea12248.tar.gz
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248.tar.gz
)
- execute_process(
- COMMAND cmake
+ endif (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248.tar.gz)
+ file(ARCHIVE_EXTRACT
+ INPUT ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248.tar.gz
+ DESTINATION ${CMAKE_BINARY_DIR}
+ )
+ if (DARWIN)
+ try_compile(OPENJPEG_RESULT
+ PROJECT OPENJPEG
+ SOURCE_DIR ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg
+ BINARY_DIR ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg
+ TARGET openjp2
+ CMAKE_FLAGS
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
- .
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/openjpeg-2.5.2
- RESULT_VARIABLE openjpeg_installed
+ -DBUILD_SHARED_LIBS:BOOL=OFF
+ -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
+ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.15
+ OUTPUT_VARIABLE openjpeg_installed
)
+ else (DARWIN)
+ try_compile(OPENJPEG_RESULT
+ PROJECT OPENJPEG
+ SOURCE_DIR ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg
+ BINARY_DIR ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg
+ TARGET openjp2
+ CMAKE_FLAGS
+ -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
+ -DBUILD_SHARED_LIBS:BOOL=OFF
+ -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
+ OUTPUT_VARIABLE openjpeg_installed
+ )
+ endif (DARWIN)
+ if (${OPENJPEG_RESULT})
file(
COPY
- ${CMAKE_BINARY_DIR}/openjpeg-2.5.2/src/lib/openjp2/cio.h
- ${CMAKE_BINARY_DIR}/openjpeg-2.5.2/src/lib/openjp2/event.h
- ${CMAKE_BINARY_DIR}/openjpeg-2.5.2/src/lib/openjp2/opj_config_private.h
- DESTINATION ${LIBS_PREBUILT_DIR}/include/openjpeg-2.5
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/cio.h
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/event.h
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/openjpeg.h
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/opj_config.h
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/opj_config_private.h
+ ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/src/lib/openjp2/opj_stdint.h
+ DESTINATION ${LIBS_PREBUILT_DIR}/include/openjpeg
+ )
+ file(
+ COPY ${CMAKE_BINARY_DIR}/3p-openjpeg-2.5.0.ea12248/openjpeg/bin/libopenjp2.a
+ DESTINATION ${LIBS_PREBUILT_DIR}/lib/release
)
file(WRITE ${PREBUILD_TRACKING_DIR}/openjpeg_installed "${openjpeg_installed}")
+ endif (${OPENJPEG_RESULT})
endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openjpeg_installed OR NOT ${openjpeg_installed} EQUAL 0)
-else (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
+else (USESYSTEMLIBS AND NOT LINUX)
use_prebuilt_binary(openjpeg)
- if (NOT EXISTS ${LIBS_PREBUILT_DIR}/include/openjpeg-2.5)
- file(RENAME
- ${LIBS_PREBUILT_DIR}/include/openjpeg
- ${LIBS_PREBUILT_DIR}/include/openjpeg-2.5
- )
- endif (NOT EXISTS ${LIBS_PREBUILT_DIR}/include/openjpeg-2.5)
+endif (USESYSTEMLIBS AND NOT LINUX)
target_link_libraries(ll::openjpeg INTERFACE openjp2 )
-endif (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD))
target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include)