From 389efb2701e93d0474fab8f8705f2f85a77e4262 Mon Sep 17 00:00:00 2001 From: Dmitry Baryshev Date: Wed, 30 Dec 2020 06:26:27 +0300 Subject: [sail] Enable static builds and more platforms (#15140) --- ports/sail/portfile.cmake | 22 +++++++++++++--------- ports/sail/usage | 3 --- ports/sail/usage.unix | 16 ++++++++++++++++ ports/sail/vcpkg.json | 4 ++-- 4 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 ports/sail/usage.unix diff --git a/ports/sail/portfile.cmake b/ports/sail/portfile.cmake index a5d5633ee..e2ea7f15e 100644 --- a/ports/sail/portfile.cmake +++ b/ports/sail/portfile.cmake @@ -1,18 +1,21 @@ -vcpkg_fail_port_install(ON_TARGET "UWP" "OSX" "Linux") +vcpkg_fail_port_install(ON_TARGET "UWP") vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO smoked-herring/sail - REF v0.9.0-pre10 - SHA512 d38a3c7d33495c84d7ada91a4131d32ce61f3fdf32a7e0631b28e7d8492fa4cb672eea09ef8cf0272dabd57f640b090749e3ecd863be577af2b98763873dc57d + REF a7b8cdb + SHA512 402b0e05ce99b5abeebf695a132121cc59789834d5a296ffada34fa3090c16ffc2266e98393e10136e31480b2378b966a8a48a153240f43b0196d986316aa9df HEAD_REF master ) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SAIL_STATIC) + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DSAIL_VCPKG_PORT=ON + -DSAIL_STATIC=${SAIL_STATIC} + -DSAIL_COMBINE_CODECS=ON -DSAIL_BUILD_EXAMPLES=OFF -DSAIL_BUILD_TESTS=OFF ) @@ -25,10 +28,6 @@ vcpkg_copy_pdbs() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) -# Move codecs -file(RENAME ${CURRENT_PACKAGES_DIR}/lib/sail ${CURRENT_PACKAGES_DIR}/bin/sail) -file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/sail ${CURRENT_PACKAGES_DIR}/debug/bin/sail) - # Move cmake configs vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/sail) @@ -36,7 +35,12 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/sail) vcpkg_fixup_pkgconfig() # Handle usage -file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +if (UNIX AND NOT APPLE) + file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage.unix DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) + file(RENAME ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage.unix ${CURRENT_PACKAGES_DIR}/share/${PORT}/usage) +else() + file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) +endif() # Handle copyright file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) diff --git a/ports/sail/usage b/ports/sail/usage index d117e68bc..672b735e9 100644 --- a/ports/sail/usage +++ b/ports/sail/usage @@ -9,6 +9,3 @@ C++ bindings: find_package(Sail CONFIG REQUIRED) target_link_libraries(main PRIVATE SAIL::sail-c++) - -For dynamic builds, please also copy SAIL codecs (bin/sail) and their dependencies -into the application directory. diff --git a/ports/sail/usage.unix b/ports/sail/usage.unix new file mode 100644 index 000000000..6f06da874 --- /dev/null +++ b/ports/sail/usage.unix @@ -0,0 +1,16 @@ +The package sail provides CMake targets: + +C libraries: + + find_package(Sail CONFIG REQUIRED) + target_link_libraries(main PRIVATE SAIL::sail) + +C++ bindings: + + find_package(Sail CONFIG REQUIRED) + target_link_libraries(main PRIVATE SAIL::sail-c++) + +Note for static builds on Unix-like platforms: the client application +must be built with -rdynamic or an equivalent to enable dlopen and dlsym +on the same binary. If you use CMake, this could be achieved by setting +CMAKE_ENABLE_EXPORTS to ON. diff --git a/ports/sail/vcpkg.json b/ports/sail/vcpkg.json index 01e6c6408..72ad2a0ef 100644 --- a/ports/sail/vcpkg.json +++ b/ports/sail/vcpkg.json @@ -1,9 +1,9 @@ { "name": "sail", - "version-string": "0.9.0-pre10", + "version-string": "0.9.0-pre11", "description": "The missing small and fast image decoding library for humans (not for machines)", "homepage": "https://github.com/smoked-herring/sail", - "supports": "windows & !static & !uwp", + "supports": "!uwp", "dependencies": [ "giflib", "libjpeg-turbo", -- cgit v1.2.3