diff --git a/ports/sx/CONTROL b/ports/sx/CONTROL new file mode 100644 index 0000000000..4d641071d2 --- /dev/null +++ b/ports/sx/CONTROL @@ -0,0 +1,3 @@ +Source: sx +Version: 2019-04-27 +Description: Portable base library for C programmers, designed for performance and simplicity. diff --git a/ports/sx/portfile.cmake b/ports/sx/portfile.cmake new file mode 100644 index 0000000000..cb3eca7605 --- /dev/null +++ b/ports/sx/portfile.cmake @@ -0,0 +1,41 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO septag/sx + REF 161d7d77a3bdcc8a55846e2dd1791773888fce24 + SHA512 198476793c921d8859f5f5b9ffe8915a7bc4b1d9d518e6772b3d90ccd03a7f5debe5bde32d7d5164f64a0beda53c5dcd06849814e7df447bccb93aa13bbca8b0 + HEAD_REF master + PATCHES + win32-sharedlib.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SX_SHARED_LIB) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DSX_BUILD_TESTS=OFF + -DSX_SHARED_LIB=${SX_SHARED_LIB} +) + +vcpkg_install_cmake() + +vcpkg_copy_pdbs() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/sx/config.h + "define SX_CONFIG_SHARED_LIB 0" + "define SX_CONFIG_SHARED_LIB 1" + ) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY) + +# CMake integration test +vcpkg_test_cmake(PACKAGE_NAME ${PORT}) diff --git a/ports/sx/win32-sharedlib.patch b/ports/sx/win32-sharedlib.patch new file mode 100644 index 0000000000..41b39ec3dd --- /dev/null +++ b/ports/sx/win32-sharedlib.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 840692e..8a4eb9e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -226,7 +226,8 @@ install( + TARGETS sx + EXPORT sx-config + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + install( + EXPORT sx-config