aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/openjpeg
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/openjpeg')
-rw-r--r--vcpkg/ports/openjpeg/pkgconfig.diff23
-rw-r--r--vcpkg/ports/openjpeg/portfile.cmake77
-rw-r--r--vcpkg/ports/openjpeg/third-party.diff22
-rw-r--r--vcpkg/ports/openjpeg/usage9
-rw-r--r--vcpkg/ports/openjpeg/vcpkg.json43
5 files changed, 174 insertions, 0 deletions
diff --git a/vcpkg/ports/openjpeg/pkgconfig.diff b/vcpkg/ports/openjpeg/pkgconfig.diff
new file mode 100644
index 0000000..6fb3b0c
--- /dev/null
+++ b/vcpkg/ports/openjpeg/pkgconfig.diff
@@ -0,0 +1,23 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 29a89939..5c5f4e5c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -332,10 +332,14 @@ set_variable_from_rel_or_absolute_path("includedir" "\\\${prefix}" "${CMAKE_INST
+ function(get_pkgconfig_deps NAME OUT)
+ get_target_property(link_libs ${NAME} LINK_LIBRARIES)
+ if(NOT link_libs STREQUAL "link_libs-NOTFOUND")
+- foreach(lib ${link_libs})
+- # omit -lopenjp2 from Libs.private because libopenjp2 is in Requires
+- if(NOT ${lib} STREQUAL ${OPENJPEG_LIBRARY_NAME})
+- string(APPEND deps "-l${lib} ")
++ # omit openjp2 from Libs.private because libopenjp2 is in Requires
++ list(REMOVE_ITEM link_libs "${OPENJPEG_LIBRARY_NAME}")
++ set(deps "")
++ foreach(item IN LISTS link_libs)
++ if(item STREQUAL "-pthread" OR item STREQUAL "-lpthread")
++ string(APPEND deps " ${item}")
++ else()
++ string(APPEND deps " -l${item}")
+ endif()
+ endforeach()
+ endif()
diff --git a/vcpkg/ports/openjpeg/portfile.cmake b/vcpkg/ports/openjpeg/portfile.cmake
new file mode 100644
index 0000000..c09bf7e
--- /dev/null
+++ b/vcpkg/ports/openjpeg/portfile.cmake
@@ -0,0 +1,77 @@
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO uclouvain/openjpeg
+ REF "v${VERSION}"
+ SHA512 702a10e20caaf8209684ded7c9fcf32f5ba6a972cf2d9fcf2611cdc6a446d2c3bb60324205758e6b6f92278c8cf4ef0fbae511e6ffb45ed6e8df514db0c6ab25
+ HEAD_REF master
+ PATCHES
+ pkgconfig.diff
+ third-party.diff
+)
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBS)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ "jpip" BUILD_JPIP
+ "tools" BUILD_CODEC
+ "tools" BUILD_LUTS_GENERATOR
+)
+
+if(NOT VCPKG_TARGET_IS_WINDOWS AND "tools" IN_LIST FEATURES)
+ list(APPEND FEATURE_OPTIONS
+ -DBUILD_JPIP_SERVER=ON
+ "-DFCGI_INCLUDE_DIR=${CURRENT_INSTALLED_DIR}/include/fastcgi"
+ )
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBUILD_DOC:BOOL=OFF
+ -DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
+ -DCMAKE_DISABLE_FIND_PACKAGE_Java=ON
+ -DOPENJPEG_INSTALL_SUBDIR=.
+ -DOPENJPEG_INSTALL_PACKAGE_DIR=share/openjpeg
+ ${FEATURE_OPTIONS}
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_DISABLE_FIND_PACKAGE_Java
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_cmake_config_fixup()
+vcpkg_fixup_pkgconfig()
+
+set(TOOL_NAMES "")
+if("tools" IN_LIST FEATURES)
+ list(APPEND TOOL_NAMES opj_compress opj_decompress opj_dump opj_dec_server opj_jpip_addxml opj_jpip_test opj_jpip_transcode)
+endif()
+if(TOOL_NAMES)
+ vcpkg_copy_tools(TOOL_NAMES ${TOOL_NAMES} AUTO_CLEAN)
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ file(WRITE "${CURRENT_PACKAGES_DIR}/include/openjpeg\.h" [[
+/* vcpkg VS legacy compatibility */
+#include "openjpeg-2.5/openjpeg.h"
+]])
+ file(WRITE "${CURRENT_PACKAGES_DIR}/include/opj_config\.h" [[
+/* vcpkg VS legacy compatibility */
+#include "openjpeg-2.5/opj_config.h"
+]])
+endif()
+
+file(READ "${CURRENT_PACKAGES_DIR}/include/openjpeg-2.5/openjpeg\.h" OPENJPEG_H)
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ string(REPLACE "defined(OPJ_STATIC)" "1" OPENJPEG_H "${OPENJPEG_H}")
+else()
+ string(REPLACE "defined(OPJ_STATIC)" "0" OPENJPEG_H "${OPENJPEG_H}")
+endif()
+string(REPLACE "defined(DLL_EXPORT)" "0" OPENJPEG_H "${OPENJPEG_H}")
+file(WRITE "${CURRENT_PACKAGES_DIR}/include/openjpeg-2.5/openjpeg\.h" "${OPENJPEG_H}")
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/openjpeg/third-party.diff b/vcpkg/ports/openjpeg/third-party.diff
new file mode 100644
index 0000000..4cc471b
--- /dev/null
+++ b/vcpkg/ports/openjpeg/third-party.diff
@@ -0,0 +1,22 @@
+diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt
+index b136fff..05ca64a 100644
+--- a/thirdparty/CMakeLists.txt
++++ b/thirdparty/CMakeLists.txt
+@@ -89,7 +89,7 @@ else(BUILD_THIRDPARTY)
+ message(STATUS "Your system seems to have a TIFF lib available, we will use it")
+ set(OPJ_HAVE_TIFF_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBTIFF 1 PARENT_SCOPE)
+- if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
++ if("${not_using_vcpkg}")
+ # Probably incorrect as PC_TIFF_STATIC_LIBRARIES will lack the path to the libraries
+ # and will only work if they are in system directories
+ set(TIFF_LIBNAME ${PC_TIFF_STATIC_LIBRARIES} PARENT_SCOPE)
+@@ -131,7 +131,7 @@ else(BUILD_THIRDPARTY)
+ message(STATUS "Your system seems to have a LCMS2 lib available, we will use it")
+ set(OPJ_HAVE_LCMS2_H 1 PARENT_SCOPE)
+ set(OPJ_HAVE_LIBLCMS2 1 PARENT_SCOPE)
+- if(BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
++ if("${not_using_vcpkg}")
+ # Probably incorrect as PC_LCMS2_STATIC_LIBRARIES will lack the path to the libraries
+ # and will only work if they are in system directories
+ set(LCMS_LIBNAME ${PC_LCMS2_STATIC_LIBRARIES} PARENT_SCOPE)
diff --git a/vcpkg/ports/openjpeg/usage b/vcpkg/ports/openjpeg/usage
new file mode 100644
index 0000000..52fbf29
--- /dev/null
+++ b/vcpkg/ports/openjpeg/usage
@@ -0,0 +1,9 @@
+openjpeg provides CMake targets:
+
+ find_package(OpenJPEG CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE openjp2)
+
+openjpeg provides pkg-config modules:
+
+ # JPEG2000 library
+ libopenjp2
diff --git a/vcpkg/ports/openjpeg/vcpkg.json b/vcpkg/ports/openjpeg/vcpkg.json
new file mode 100644
index 0000000..09dac13
--- /dev/null
+++ b/vcpkg/ports/openjpeg/vcpkg.json
@@ -0,0 +1,43 @@
+{
+ "name": "openjpeg",
+ "version": "2.5.4",
+ "description": "OpenJPEG is an open-source JPEG 2000 codec written in C language. It has been developed in order to promote the use of JPEG 2000, a still-image compression standard from the Joint Photographic Experts Group (JPEG). Since April 2015, it is officially recognized by ISO/IEC and ITU-T as a JPEG 2000 Reference Software.",
+ "homepage": "https://github.com/uclouvain/openjpeg",
+ "license": "BSD-2-Clause",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "jpip": {
+ "description": "Build optional component jpip",
+ "supports": "!uwp"
+ },
+ "tools": {
+ "description": "(deprecated)",
+ "dependencies": [
+ {
+ "name": "curl",
+ "platform": "!windows"
+ },
+ {
+ "name": "fastcgi",
+ "platform": "!windows"
+ },
+ "lcms",
+ "libpng",
+ {
+ "name": "tiff",
+ "default-features": false
+ },
+ "zlib"
+ ]
+ }
+ }
+}