[libaec] Add new port (#38107)

This commit is contained in:
LE GARREC Vincent 2024-11-16 00:42:12 +01:00 committed by GitHub
parent 81482edd5b
commit e36fe7110d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 397 additions and 235 deletions

View File

@ -2,7 +2,7 @@ diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.
index 1a3fb7bbf2..79081ce040 100644 index 1a3fb7bbf2..79081ce040 100644
--- a/config/cmake/hdf5-config.cmake.in --- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in
@@ -120,12 +114,17 @@ set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@) @@ -120,12 +114,22 @@ set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@)
# Don't include targets if this file is being picked up by another # Don't include targets if this file is being picked up by another
# project which has already built hdf5 as a subproject # project which has already built hdf5 as a subproject
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
@ -16,7 +16,12 @@ index 1a3fb7bbf2..79081ce040 100644
if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS) if (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT AND ${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS)
include (@PACKAGE_SHARE_INSTALL_DIR@/@LIBAEC_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake) include (@PACKAGE_SHARE_INSTALL_DIR@/@LIBAEC_PACKAGE_NAME@@HDF_PACKAGE_EXT@-targets.cmake)
+ elseif (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT) + elseif (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT)
+ find_dependency(szip) + if (${HDF5_PACKAGE_NAME}_BUILD_STATIC_LIBS)
+ set(libaec_USE_STATIC_LIBS ON)
+ else()
+ set(libaec_USE_STATIC_LIBS OFF)
+ endif()
+ find_dependency(libaec)
endif () endif ()
include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake) include (@PACKAGE_SHARE_INSTALL_DIR@/@HDF5_PACKAGE@@HDF_PACKAGE_EXT@-targets.cmake)
endif () endif ()

View File

@ -2,22 +2,14 @@ diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 141ab44..66b7efa 100644 index 141ab44..66b7efa 100644
--- a/CMakeFilters.cmake --- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake +++ b/CMakeFilters.cmake
@@ -95,6 +95,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT) @@ -79,6 +79,7 @@ if (HDF5_ENABLE_Z_LIB_SUPPORT)
set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) set (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR})
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES})
+ set (zlib_PC_LIBS_PRIVATE "${ZLIB_LIBRARIES}") + set (zlib_PC_LIBS_PRIVATE "${ZLIB_LIBRARIES}")
endif () endif ()
else () else ()
if (BUILD_ZLIB_WITH_FETCHCONTENT) if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
@@ -148,6 +148,7 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
if (TARGET szip-shared)
set(SZIP_LIBRARIES szip-shared)
endif()
+ set(szip_PC_LIBS_PRIVATE "${SZIP_LIBRARIES}")
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
index b75fdd2..a2e88fd 100644 index b75fdd2..a2e88fd 100644
--- a/CMakeLists.txt --- a/CMakeLists.txt
@ -54,7 +46,7 @@ index b3c2226..ea80d60 100644
set (_PKG_CONFIG_REQUIRES) set (_PKG_CONFIG_REQUIRES)
+set (_PKG_CONFIG_REQUIRES_PRIVATE) +set (_PKG_CONFIG_REQUIRES_PRIVATE)
+set (_PKG_CONFIG_LIBS_PRIVATE " ${_PKG_CONFIG_LIBS_PRIVATE} ") +set (_PKG_CONFIG_LIBS_PRIVATE " ${_PKG_CONFIG_LIBS_PRIVATE} ")
+foreach(_module IN ITEMS ompi-c szip zlib) +foreach(_module IN ITEMS ompi-c zlib)
+ if(${_module}_PC_LIBS_PRIVATE) + if(${_module}_PC_LIBS_PRIVATE)
+ foreach(_lib IN LISTS ${_module}_PC_LIBS_PRIVATE) + foreach(_lib IN LISTS ${_module}_PC_LIBS_PRIVATE)
+ string(REPLACE " -l${_lib} " " " _PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE}") + string(REPLACE " -l${_lib} " " " _PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE}")

View File

@ -9,8 +9,8 @@ vcpkg_from_github(
HEAD_REF develop HEAD_REF develop
PATCHES PATCHES
hdf5_config.patch hdf5_config.patch
szip.patch add-_Float16-type-on-aarch64.patch
add-_Float16-type-on-aarch64.patch pkgconfig-requires.patch
) )
set(ALLOW_UNSUPPORTED OFF) set(ALLOW_UNSUPPORTED OFF)
@ -51,7 +51,10 @@ if("tools" IN_LIST FEATURES AND VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND FEATURE_OPTIONS -DBUILD_STATIC_EXECS=ON) list(APPEND FEATURE_OPTIONS -DBUILD_STATIC_EXECS=ON)
endif() endif()
if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static") if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
list(APPEND FEATURE_OPTIONS
-DUSE_LIBAEC_STATIC=ON)
else()
list(APPEND FEATURE_OPTIONS list(APPEND FEATURE_OPTIONS
-DBUILD_STATIC_LIBS=OFF -DBUILD_STATIC_LIBS=OFF
-DONLY_SHARED_LIBS=ON) -DONLY_SHARED_LIBS=ON)
@ -69,7 +72,6 @@ vcpkg_cmake_configure(
-DHDF_PACKAGE_NAMESPACE:STRING=hdf5:: -DHDF_PACKAGE_NAMESPACE:STRING=hdf5::
-DHDF5_MSVC_NAMING_CONVENTION=OFF -DHDF5_MSVC_NAMING_CONVENTION=OFF
-DALLOW_UNSUPPORTED=${ALLOW_UNSUPPORTED} -DALLOW_UNSUPPORTED=${ALLOW_UNSUPPORTED}
-DCMAKE_DISABLE_FIND_PACKAGE_libaec=ON
OPTIONS_RELEASE OPTIONS_RELEASE
-DCMAKE_DEBUG_POSTFIX= # For lib name in pkgconfig files -DCMAKE_DEBUG_POSTFIX= # For lib name in pkgconfig files
) )

View File

@ -1,18 +0,0 @@
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index d5f801e..141ab44 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -142,7 +142,12 @@ if (HDF5_ENABLE_SZIP_SUPPORT)
set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES})
endif ()
if (NOT SZIP_FOUND)
- find_package (SZIP NAMES ${LIBAEC_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared)
+ find_package(SZIP NAMES szip REQUIRED)
+ set(SZIP_INCLUDE_DIR "")
+ set(SZIP_LIBRARIES szip-static)
+ if (TARGET szip-shared)
+ set(SZIP_LIBRARIES szip-shared)
+ endif()
if (NOT SZIP_FOUND)
find_package (SZIP) # Legacy find
endif ()

View File

@ -1,7 +1,7 @@
{ {
"name": "hdf5", "name": "hdf5",
"version": "1.14.4.3", "version": "1.14.4.3",
"port-version": 2, "port-version": 3,
"description": "HDF5 is a data model, library, and file format for storing and managing data", "description": "HDF5 is a data model, library, and file format for storing and managing data",
"homepage": "https://www.hdfgroup.org/downloads/hdf5/", "homepage": "https://www.hdfgroup.org/downloads/hdf5/",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
@ -39,7 +39,7 @@
"szip": { "szip": {
"description": "Build with szip", "description": "Build with szip",
"dependencies": [ "dependencies": [
"szip" "libaec"
] ]
}, },
"threadsafe": { "threadsafe": {

View File

@ -0,0 +1,206 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26ccf18..a885024 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CTest)
+include(CMakePackageConfigHelpers)
+
include(TestBigEndian)
test_big_endian(WORDS_BIGENDIAN)
@@ -67,12 +69,12 @@ endif()
set(libaec_CONFIG_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libaec-config.cmake.in)
set(libaec_CONFIG_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/libaec-config.cmake)
configure_file(${libaec_CONFIG_IN} ${libaec_CONFIG_OUT} @ONLY)
-set(libaec_CONFIG_VERSION_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/libaec-config-version.cmake.in)
-set(libaec_CONFIG_VERSION_OUT ${CMAKE_CURRENT_BINARY_DIR}/cmake/libaec-config-version.cmake)
-configure_file(${libaec_CONFIG_VERSION_IN} ${libaec_CONFIG_VERSION_OUT} @ONLY)
install(FILES ${libaec_CONFIG_OUT}
DESTINATION cmake)
-install(FILES ${libaec_CONFIG_VERSION_OUT}
+write_basic_package_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
+ COMPATIBILITY SameMajorVersion)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
DESTINATION cmake)
# Cpack configuration mainly for Windows installer
diff --git a/cmake/libaec-config-version.cmake.in b/cmake/libaec-config-version.cmake.in
deleted file mode 100644
index d32ef96..0000000
--- a/cmake/libaec-config-version.cmake.in
+++ /dev/null
@@ -1,15 +0,0 @@
-set(PACKAGE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@)
-set(PACKAGE_VERSION_MINOR @PROJECT_VERSION_MINOR@)
-set(PACKAGE_VERSION_PATCH @PROJECT_VERSION_PATCH@)
-set(PACKAGE_VERSION @PROJECT_VERSION@)
-
-# Check whether the requested PACKAGE_FIND_VERSION is compatible
-if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
- PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
- set(PACKAGE_VERSION_COMPATIBLE FALSE)
-else()
- set(PACKAGE_VERSION_COMPATIBLE TRUE)
- if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
- set(PACKAGE_VERSION_EXACT TRUE)
- endif()
-endif()
diff --git a/cmake/libaec-config.cmake.in b/cmake/libaec-config.cmake.in
index ce5d4cc..2fffad9 100644
--- a/cmake/libaec-config.cmake.in
+++ b/cmake/libaec-config.cmake.in
@@ -38,64 +38,3 @@ else ()
find_library(libaec_LIBRARY NAMES aec DOC "AEC library")
find_library(SZIP_LIBRARY NAMES sz szip DOC "SZIP compatible version of the AEC library")
endif ()
-
-# Check version here
-if (libaec_INCLUDE_DIR AND libaec_LIBRARY)
- set(libaec_VERSION "@PROJECT_VERSION@")
- set(SZIP_VERSION "2.0.1")
-endif ()
-
-include(FindPackageHandleStandardArgs)
-set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
-find_package_handle_standard_args(libaec
- FOUND_VAR libaec_FOUND
- REQUIRED_VARS libaec_LIBRARY libaec_INCLUDE_DIR SZIP_LIBRARY SZIP_INCLUDE_DIR
- VERSION_VAR libaec_VERSION
- CONFIG_MODE
-)
-
-if (libaec_FOUND)
- if (libaec_USE_STATIC_LIBS)
- add_library(libaec::aec STATIC IMPORTED)
- else ()
- add_library(libaec::aec SHARED IMPORTED)
- target_compile_definitions(libaec::aec INTERFACE LIBAEC_SHARED)
- if (MSVC)
- set_target_properties(libaec::aec PROPERTIES
- IMPORTED_IMPLIB "${libaec_LIBRARY}"
- )
- endif ()
- endif ()
- set_target_properties(libaec::aec PROPERTIES
- IMPORTED_LOCATION "${libaec_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${libaec_INCLUDE_DIR}"
- )
-
- # SZIP
- if (libaec_USE_STATIC_LIBS)
- add_library(libaec::sz STATIC IMPORTED)
- else ()
- add_library(libaec::sz SHARED IMPORTED)
- target_compile_definitions(libaec::sz INTERFACE LIBAEC_SHARED)
- if (MSVC)
- set_target_properties(libaec::sz PROPERTIES
- IMPORTED_IMPLIB "${SZIP_LIBRARY}"
- )
- endif ()
- endif ()
- set_target_properties(libaec::sz PROPERTIES
- IMPORTED_LOCATION "${SZIP_LIBRARY}"
- INTERFACE_INCLUDE_DIRECTORIES "${SZIP_INCLUDE_DIR}"
- )
-
- # Set SZIP variables.
- set(SZIP_FOUND TRUE)
- set(SZIP_LIBRARIES "${SZIP_LIBRARY}")
-endif ()
-
-mark_as_advanced(
- libaec_LIBRARY
- libaec_INCLUDE_DIR
- SZIP_LIBRARY
- SZIP_INCLUDE_DIR
-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f9c3031..dea7574 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -11,12 +11,17 @@ target_include_directories(aec
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>"
"$<INSTALL_INTERFACE:include>")
+# Handle visibility of symbols. Compatible with gnulib's gl_VISIBILITY
+include(CheckCCompilerFlag)
+check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+
# Create both static and shared aec library.
add_library(aec_static STATIC "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_static PUBLIC aec)
set_target_properties(aec_static
PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,aec-static,aec>)
+target_compile_definitions(aec_static PRIVATE LIBAEC_BUILD)
add_library(aec_shared SHARED "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_shared PUBLIC aec)
@@ -26,19 +31,19 @@ set_target_properties(aec_shared
SOVERSION 0
OUTPUT_NAME aec
PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/../include/libaec.h)
+target_compile_definitions(aec_shared PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
# Wrapper for compatibility with szip
add_library(sz OBJECT sz_compat.c)
target_link_libraries(sz PUBLIC aec)
-set(libaec_COMPILE_DEFINITIONS "LIBAEC_BUILD;LIBAEC_SHARED")
-
# Create both static and shared szip library.
add_library(sz_static STATIC "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
set_target_properties(sz_static
PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip-static,sz>)
target_link_libraries(sz_static PUBLIC sz)
+target_compile_definitions(sz_static PRIVATE LIBAEC_BUILD)
add_library(sz_shared SHARED "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
target_link_libraries(sz_shared PUBLIC sz)
@@ -48,17 +53,19 @@ set_target_properties(sz_shared
SOVERSION 2
OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>
PUBLIC_HEADER ../include/szlib.h)
+target_compile_definitions(sz_shared PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
+
+if(COMPILER_HAS_HIDDEN_VISIBILITY)
+ target_compile_definitions(aec_static PUBLIC HAVE_VISIBILITY)
+ target_compile_definitions(aec_shared PUBLIC HAVE_VISIBILITY)
+ target_compile_definitions(sz_static PUBLIC HAVE_VISIBILITY)
+ target_compile_definitions(sz_shared PUBLIC HAVE_VISIBILITY)
+endif()
# Simple executable for testing and benchmarking.
add_executable(graec graec.c)
target_link_libraries(graec aec)
-# Handle visibility of symbols. Compatible with gnulib's gl_VISIBILITY
-include(CheckCCompilerFlag)
-check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
-set(libaec_COMPILE_DEFINITIONS
- "${libaec_COMPILE_DEFINITIONS};HAVE_VISIBILITY=$<BOOL:${COMPILER_HAS_HIDDEN_VISIBILITY}>")
-
include(GNUInstallDirs)
if(UNIX)
# The shell scripts for benchmarking are supported on unix only
@@ -71,8 +78,11 @@ if(UNIX)
DEPENDS graec utime)
endif()
-set_target_properties(aec sz
- PROPERTIES
- COMPILE_DEFINITIONS "${libaec_COMPILE_DEFINITIONS}")
+install(TARGETS aec aec_static aec_shared sz sz_static sz_shared
+ EXPORT ${PROJECT_NAME}Targets)
-install(TARGETS aec_static aec_shared sz_static sz_shared)
+install(
+ EXPORT ${PROJECT_NAME}Targets
+ FILE ${PROJECT_NAME}-targets.cmake
+ NAMESPACE ${PROJECT_NAME}::
+ DESTINATION cmake)

View File

@ -0,0 +1,28 @@
vcpkg_from_gitlab(
OUT_SOURCE_PATH SOURCE_PATH
GITLAB_URL https://gitlab.dkrz.de
REPO k202009/libaec
REF v1.1.3
SHA512 6f317d08ad7d003bc6664da147321eb87c924978f32bd28780a8ebf015e251019046b0cb16b78e776cd1957a7701215667f64686efb8e5c6bae7c08528cede56
PATCHES
cmake-config.patch
static-shared.patch)
string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "dynamic" AEC_BUILD_SHARED)
string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "static" AEC_BUILD_STATIC)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DAEC_BUILD_SHARED=${AEC_BUILD_SHARED}
-DAEC_BUILD_STATIC=${AEC_BUILD_STATIC}
-DBUILD_TESTING=OFF)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(CONFIG_PATH "cmake")

View File

@ -0,0 +1,109 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dea7574..2df037e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,3 +1,6 @@
+option(AEC_BUILD_SHARED "Enable build of shared library" ON)
+option(AEC_BUILD_STATIC "Enable build of static library" ON)
+
# Main library aec
add_library(aec OBJECT
encode.c
@@ -15,14 +18,20 @@ target_include_directories(aec
include(CheckCCompilerFlag)
check_c_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
+target_compile_definitions(aec PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
+if(COMPILER_HAS_HIDDEN_VISIBILITY)
+ target_compile_definitions(aec PUBLIC HAVE_VISIBILITY)
+endif()
-# Create both static and shared aec library.
+if (AEC_BUILD_STATIC)
add_library(aec_static STATIC "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_static PUBLIC aec)
set_target_properties(aec_static
PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,aec-static,aec>)
target_compile_definitions(aec_static PRIVATE LIBAEC_BUILD)
+endif()
+if (AEC_BUILD_SHARED)
add_library(aec_shared SHARED "$<TARGET_OBJECTS:aec>")
target_link_libraries(aec_shared PUBLIC aec)
set_target_properties(aec_shared
@@ -29,22 +37,31 @@ set_target_properties(aec_shared
PROPERTIES
VERSION 0.1.3
SOVERSION 0
- OUTPUT_NAME aec
- PUBLIC_HEADER ${CMAKE_CURRENT_BINARY_DIR}/../include/libaec.h)
-target_compile_definitions(aec_shared PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
+ OUTPUT_NAME aec)
+target_compile_definitions(aec_shared PRIVATE LIBAEC_BUILD PUBLIC LIBAEC_SHARED)
+endif()
+
+set_target_properties(aec PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_BINARY_DIR}/../include/libaec.h")
# Wrapper for compatibility with szip
add_library(sz OBJECT sz_compat.c)
target_link_libraries(sz PUBLIC aec)
+target_compile_definitions(sz PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
+if(COMPILER_HAS_HIDDEN_VISIBILITY)
+ target_compile_definitions(sz PUBLIC HAVE_VISIBILITY)
+endif()
# Create both static and shared szip library.
+if (AEC_BUILD_STATIC)
add_library(sz_static STATIC "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
set_target_properties(sz_static
PROPERTIES
OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip-static,sz>)
target_link_libraries(sz_static PUBLIC sz)
target_compile_definitions(sz_static PRIVATE LIBAEC_BUILD)
+endif()
+if (AEC_BUILD_SHARED)
add_library(sz_shared SHARED "$<TARGET_OBJECTS:sz>" "$<TARGET_OBJECTS:aec>")
target_link_libraries(sz_shared PUBLIC sz)
set_target_properties(sz_shared
@@ -51,16 +69,11 @@ set_target_properties(sz_shared
PROPERTIES
VERSION 2.0.1
SOVERSION 2
- OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>
- PUBLIC_HEADER ../include/szlib.h)
-target_compile_definitions(sz_shared PRIVATE LIBAEC_BUILD LIBAEC_SHARED)
+ OUTPUT_NAME $<IF:$<BOOL:${MSVC}>,szip,sz>)
+target_compile_definitions(sz_shared PUBLIC LIBAEC_SHARED)
-
-if(COMPILER_HAS_HIDDEN_VISIBILITY)
- target_compile_definitions(aec_static PUBLIC HAVE_VISIBILITY)
- target_compile_definitions(aec_shared PUBLIC HAVE_VISIBILITY)
- target_compile_definitions(sz_static PUBLIC HAVE_VISIBILITY)
- target_compile_definitions(sz_shared PUBLIC HAVE_VISIBILITY)
-endif()
+endif()
+
+set_target_properties(sz PROPERTIES PUBLIC_HEADER "../include/szlib.h")
# Simple executable for testing and benchmarking.
add_executable(graec graec.c)
@@ -78,7 +93,16 @@ if(UNIX)
DEPENDS graec utime)
endif()
-install(TARGETS aec aec_static aec_shared sz sz_static sz_shared
+set(TARGETS_EXPORT)
+if (AEC_BUILD_STATIC)
+ set(TARGETS_EXPORT aec_static sz_static)
+endif()
+if (AEC_BUILD_SHARED)
+ set(TARGETS_EXPORT ${TARGETS_EXPORT} aec_shared sz_shared)
+endif()
+
+install(TARGETS aec sz ${TARGETS_EXPORT}
- EXPORT ${PROJECT_NAME}Targets)
+ EXPORT ${PROJECT_NAME}Targets
+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(

17
ports/libaec/vcpkg.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "libaec",
"version": "1.1.3",
"description": "Adaptive Entropy Coding library",
"homepage": "https://gitlab.dkrz.de/k202009/libaec",
"license": "BSD-2-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -1,47 +0,0 @@
diff -urN a/config/cmake/szip-config.cmake.in b/config/cmake/szip-config.cmake.in
--- a/config/cmake/szip-config.cmake.in 2017-01-09 16:14:35.000000000 +0100
+++ b/config/cmake/szip-config.cmake.in 2021-05-14 21:26:09.490134839 +0200
@@ -39,8 +39,13 @@
# Handle default component(static) :
if (NOT ${SZIP_PACKAGE_NAME}_FIND_COMPONENTS)
+ if(@BUILD_SHARED_LIBS@)
+ set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS shared)
+ set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_shared true)
+ else()
set (${SZIP_PACKAGE_NAME}_FIND_COMPONENTS static)
set (${SZIP_PACKAGE_NAME}_FIND_REQUIRED_static true)
+ endif()
endif ()
# Handle requested components:
diff -urN a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt 2017-02-03 20:42:43.000000000 +0100
+++ b/src/CMakeLists.txt 2021-05-14 22:20:28.237632925 +0200
@@ -22,6 +22,7 @@
${SZIP_SRC_SOURCE_DIR}/szlib.h
)
+if(NOT BUILD_SHARED_LIBS)
add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS})
#set_target_properties (${SZIP_LIB_TARGET}
# PROPERTIES
@@ -36,6 +37,7 @@
set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET})
SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC)
set (install_targets ${SZIP_LIB_TARGET})
+endif(NOT BUILD_SHARED_LIBS)
if (BUILD_SHARED_LIBS)
add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS})
@@ -62,8 +64,9 @@
if (SZIP_EXPORTED_TARGETS)
if (BUILD_SHARED_LIBS)
INSTALL_TARGET_PDB (${SZIP_LIBSH_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries)
- endif (BUILD_SHARED_LIBS)
+ else()
INSTALL_TARGET_PDB (${SZIP_LIB_TARGET} ${SZIP_INSTALL_BIN_DIR} libraries)
+ endif()
install (
TARGETS

View File

@ -1,30 +0,0 @@
diff -urN a/config/cmake/SZIPMacros.cmake b/config/cmake/SZIPMacros.cmake
--- a/config/cmake/SZIPMacros.cmake 2021-05-15 09:06:50.546455249 +0200
+++ b/config/cmake/SZIPMacros.cmake 2021-05-15 09:01:24.933765423 +0200
@@ -126,7 +126,7 @@
macro (SZIP_SET_BASE_OPTIONS libtarget libname libtype)
# message (STATUS "${libname} libtype: ${libtype}")
if (${libtype} MATCHES "SHARED")
- if (WIN32)
+ if (WIN32 AND NOT MINGW)
set (LIB_RELEASE_NAME "${libname}")
set (LIB_DEBUG_NAME "${libname}_D")
else ()
@@ -134,7 +134,7 @@
set (LIB_DEBUG_NAME "${libname}_debug")
endif ()
else ()
- if (WIN32)
+ if (WIN32 AND NOT MINGW)
set (LIB_RELEASE_NAME "lib${libname}")
set (LIB_DEBUG_NAME "lib${libname}_D")
else ()
@@ -164,7 +164,7 @@
endif ()
#----- Use MSVC Naming conventions for Shared Libraries
- if (MINGW AND ${libtype} MATCHES "SHARED")
+ if (FALSE AND MINGW AND ${libtype} MATCHES "SHARED")
set_target_properties (${libtarget}
PROPERTIES
IMPORT_SUFFIX ".lib"

View File

@ -1,82 +0,0 @@
set(SZIP_VERSION "2.1.1")
vcpkg_download_distfile(ARCHIVE
URLS "https://support.hdfgroup.org/ftp/lib-external/szip/${SZIP_VERSION}/src/szip-${SZIP_VERSION}.tar.gz"
FILENAME "szip-${SZIP_VERSION}.tar.gz"
SHA512 ada6406efb096cd8a2daf8f9217fe9111a96dcae87e29d1c31f58ddd2ad2aa7bac03f23c7205dc9360f3b62d259461759330c7189ef0c2fe559704b1ea9d40dd
)
vcpkg_extract_source_archive(
SOURCE_PATH
ARCHIVE "${ARCHIVE}"
SOURCE_BASE "szip-${SZIP_VERSION}"
PATCHES
fix-linkage-config.patch
mingw-lib-names.patch
)
if (VCPKG_TARGET_IS_ANDROID OR VCPKG_TARGET_IS_IOS OR VCPKG_TARGET_IS_OSX)
# when cross-compiling, try_run will not work.
# LFS "large file support" is keyed on
# 1) 64-bit off_t (https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/64bitPorting/transition/transition.html table 2-1)
# 2) stat works properly, which is true
set(extra_opts
-DTEST_LFS_WORKS_RUN=TRUE
-DTEST_LFS_WORKS_RUN__TRYRUN_OUTPUT=""
-DHAVE_DEFAULT_SOURCE_RUN=0
-DHAVE_DEFAULT_SOURCE_RUN__TRYRUN_OUTPUT=""
)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DSZIP_INSTALL_DATA_DIR=share/szip/data
-DSZIP_INSTALL_CMAKE_DIR=share/szip
${extra_opts}
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/szip_adpt.h"
"\n#ifdef SZ_BUILT_AS_DYNAMIC_LIB"
"\n#if 1 // SZ_BUILT_AS_DYNAMIC_LIB")
endif()
if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW)
set(SZIP_LIB_RELEASE "-lszip")
set(SZIP_LIB_DEBUG "-lszip_debug")
set(SZIP_LIBS_PRIVATE "-lm")
elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(SZIP_LIB_RELEASE "-llibszip")
set(SZIP_LIB_DEBUG "-llibszip_D")
set(SZIP_LIBS_PRIVATE "")
else()
set(SZIP_LIB_RELEASE "-lszip")
set(SZIP_LIB_DEBUG "-lszip_D")
set(SZIP_LIBS_PRIVATE "")
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(SZIP_LINKAGE_FLAGS "-DSZ_BUILT_AS_DYNAMIC_LIB=1")
else()
set(SZIP_LINKAGE_FLAGS "")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib")
set(SZIP_LIB "${SZIP_LIB_RELEASE}")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig")
configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/szip.pc" @ONLY)
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib")
set(SZIP_LIB "${SZIP_LIB_DEBUG}")
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig")
configure_file("${CMAKE_CURRENT_LIST_DIR}/szip.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/szip.pc" @ONLY)
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/szip/data")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -1,16 +0,0 @@
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${prefix}/lib
sharedlibdir=${prefix}/lib
includedir=${prefix}/include
Name: szip
Description: Szip compression software
Version: @SZIP_VERSION@
Requires:
Cflags: -I"${includedir}" @SZIP_LINKAGE_FLAGS@
Libs: -L"${libdir}" @SZIP_LIB@
Libs.private: @SZIP_LIBS_PRIVATE@

View File

@ -1,18 +0,0 @@
{
"name": "szip",
"version": "2.1.1",
"port-version": 12,
"description": "Szip compression software, providing lossless compression of scientific data",
"homepage": "https://support.hdfgroup.org/ftp/lib-external/szip",
"license": null,
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -3458,7 +3458,7 @@
}, },
"hdf5": { "hdf5": {
"baseline": "1.14.4.3", "baseline": "1.14.4.3",
"port-version": 2 "port-version": 3
}, },
"hdr-histogram": { "hdr-histogram": {
"baseline": "0.11.8", "baseline": "0.11.8",
@ -4280,6 +4280,10 @@
"baseline": "1.3.2", "baseline": "1.3.2",
"port-version": 2 "port-version": 2
}, },
"libaec": {
"baseline": "1.1.3",
"port-version": 0
},
"libaes-siv": { "libaes-siv": {
"baseline": "2020-10-15", "baseline": "2020-10-15",
"port-version": 0 "port-version": 0
@ -8784,10 +8788,6 @@
"baseline": "2.3.3", "baseline": "2.3.3",
"port-version": 8 "port-version": 8
}, },
"szip": {
"baseline": "2.1.1",
"port-version": 12
},
"tabulate": { "tabulate": {
"baseline": "1.5", "baseline": "1.5",
"port-version": 0 "port-version": 0

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "865f6593cb402e937d842ad41cda9e5aa06b0230",
"version": "1.14.4.3",
"port-version": 3
},
{ {
"git-tree": "f13d0c544b6c489babc70c6aa60414761566feda", "git-tree": "f13d0c544b6c489babc70c6aa60414761566feda",
"version": "1.14.4.3", "version": "1.14.4.3",

9
versions/l-/libaec.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "cd65575e04e977bc93d95a711349279d554d5920",
"version": "1.1.3",
"port-version": 0
}
]
}