diff options
author | Erik Kundiman <erik@megapahit.org> | 2024-08-12 13:08:38 +0800 |
---|---|---|
committer | Erik Kundiman <erik@megapahit.org> | 2024-08-12 13:08:38 +0800 |
commit | 2caff153c35274de15276b3cae10c7df54dacfc2 (patch) | |
tree | 056fefa7f8aa8204a17e171c58eddeab4810dfc6 /indra | |
parent | 30a8368fd6134c239ad61f4ce2a713ba33fa6924 (diff) |
Automatic OpenJPEG download, configure & install
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/OpenJPEG.cmake | 41 | ||||
-rw-r--r-- | indra/llimagej2coj/llimagej2coj.cpp | 6 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 |
3 files changed, 39 insertions, 10 deletions
diff --git a/indra/cmake/OpenJPEG.cmake b/indra/cmake/OpenJPEG.cmake index 6de03113ed..778cf62e29 100644 --- a/indra/cmake/OpenJPEG.cmake +++ b/indra/cmake/OpenJPEG.cmake @@ -6,15 +6,50 @@ add_library( ll::openjpeg INTERFACE IMPORTED ) if (NOT USESYSTEMLIBS) use_system_binary(openjpeg) -use_prebuilt_binary(openjpeg) -elseif (NOT LINUX) +elseif (${LINUX_DISTRO} MATCHES fedora 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}) - return () endif (NOT USESYSTEMLIBS) +if (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) + if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/openjpeg_installed OR NOT ${openjpeg_installed} EQUAL 0) + execute_process( + COMMAND mkdir -p ${AUTOBUILD_INSTALL_DIR}/include/openjpeg-2.5 + COMMAND curl + -L https://github.com/uclouvain/openjpeg/archive/refs/tags/v2.5.2.tar.gz + -o openjpeg-2.5.2.tar.gz + WORKING_DIRECTORY $ENV{HOME}/Downloads + ) + execute_process( + COMMAND tar xf $ENV{HOME}/Downloads/openjpeg-2.5.2.tar.gz + WORKING_DIRECTORY /tmp + ) + execute_process( + COMMAND cmake + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + . + WORKING_DIRECTORY /tmp/openjpeg-2.5.2 + ) + execute_process( + COMMAND cp + /tmp/openjpeg-2.5.2/src/lib/openjp2/cio.h + /tmp/openjpeg-2.5.2/src/lib/openjp2/event.h + /tmp/openjpeg-2.5.2/src/lib/openjp2/opj_config_private.h + ${AUTOBUILD_INSTALL_DIR}/include/openjpeg-2.5/ + WORKING_DIRECTORY ${AUTOBUILD_INSTALL_DIR} + RESULT_VARIABLE openjpeg_installed + ) + 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 DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) +use_prebuilt_binary(openjpeg) + execute_process(COMMAND mv + openjpeg + openjpeg-2.5 + WORKING_DIRECTORY ${AUTOBUILD_INSTALL_DIR}/include + ) target_link_libraries(ll::openjpeg INTERFACE openjp2 ) +endif (USESYSTEMLIBS AND (${LINUX_DISTRO} MATCHES fedora OR DARWIN OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)) target_include_directories( ll::openjpeg SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp index b5f1df5507..5b03f76d32 100644 --- a/indra/llimagej2coj/llimagej2coj.cpp +++ b/indra/llimagej2coj/llimagej2coj.cpp @@ -28,15 +28,9 @@ #include "llimagej2coj.h" // this is defined so that we get static linking. -#if LL_LINUX || !LL_USESYSTEMLIBS -#include "openjpeg/openjpeg.h" -#include "openjpeg/event.h" -#include "openjpeg/cio.h" -#else #include <openjpeg-2.5/openjpeg.h> #include <openjpeg-2.5/event.h> #include <openjpeg-2.5/cio.h> -#endif #define MAX_ENCODED_DISCARD_LEVELS 5 diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 2409fb1e18..bc597fb69e 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -2118,7 +2118,7 @@ if (LINUX) set(CPACK_RPM_PACKAGE_DESCRIPTION ${VIEWER_PACKAGE_DESCRIPTION} CACHE STRING "RPM package description.") set(CPACK_RPM_PACKAGE_REQUIRES - "apr-util, boost-fiber, boost-program-options, boost-regex, boost-thread, collada-dom, expat, fltk, mesa-libGLU, hunspell, jsoncpp, libnghttp2, SDL2, uriparser, vlc-libs, vlc-plugins-base, libvorbis, xmlrpc-epi" + "apr-util, boost-fiber, boost-program-options, boost-regex, boost-thread, collada-dom, expat, fltk, mesa-libGLU, hunspell, jsoncpp, libnghttp2, openjpeg2, SDL2, uriparser, vlc-libs, vlc-plugins-base, libvorbis, xmlrpc-epi" CACHE STRING "RPM package requirements.") endif (${LINUX_DISTRO} MATCHES debian OR ${LINUX_DISTRO} MATCHES ubuntu) endif (PACKAGE) |