diff --git a/ports/nng/CONTROL b/ports/nng/CONTROL new file mode 100644 index 000000000..9db656338 --- /dev/null +++ b/ports/nng/CONTROL @@ -0,0 +1,3 @@ +Source: nng +Version: 1.0.1 +Description: NNG, like its predecessors nanomsg (and to some extent ZeroMQ), is a lightweight, broker-less library, offering a simple API to solve common recurring messaging problems, such as publish/subscribe, RPC-style request/reply, or service discovery. diff --git a/ports/nng/fix-include-path.patch b/ports/nng/fix-include-path.patch new file mode 100644 index 000000000..9c18b9933 --- /dev/null +++ b/ports/nng/fix-include-path.patch @@ -0,0 +1,14 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index e59ee5b..b5f6a0d 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -238,6 +238,9 @@ set_target_properties (${PROJECT_NAME} ${PROJECT_NAME} + target_link_libraries (${PROJECT_NAME} PRIVATE ${NNG_REQUIRED_LIBRARIES}) + target_link_libraries (${PROJECT_NAME} PRIVATE Threads::Threads) + ++# See: https://github.com/nanomsg/nanomsg/pull/949/ ++target_include_directories(${PROJECT_NAME} PUBLIC $) ++ + install (TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}-target + FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library diff --git a/ports/nng/portfile.cmake b/ports/nng/portfile.cmake new file mode 100644 index 000000000..f0da2d5d2 --- /dev/null +++ b/ports/nng/portfile.cmake @@ -0,0 +1,44 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO nanomsg/nng + REF ce9f0cb155ad0e97cfc7703d9d7c8e5bec3201bc + SHA512 e1fca685e3397398bd259d126560902e813d1e2fb5cdb04de9d3f2fd74961f53af53dbaf9a555113a5588f07a3859d16bdc64f0a0ff65a7b5cf89965e764e68d + HEAD_REF master + PATCHES fix-include-path.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" NNG_STATIC_LIB) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE + -DNNG_STATIC_LIB=${NNG_STATIC_LIB} + -DNNG_TESTS=OFF + -DNNG_ENABLE_NNGCAT=OFF +) + +vcpkg_install_cmake() + +# Move CMake config files to the right place +if(EXISTS ${CURRENT_PACKAGES_DIR}/cmake) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) +endif() +if(EXISTS ${CURRENT_PACKAGES_DIR}/lib/cmake/nng) + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/nng) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# Put the licence file where vcpkg expects it +file(COPY + ${SOURCE_PATH}/LICENSE.txt + DESTINATION ${CURRENT_PACKAGES_DIR}/share/nng) +file(RENAME + ${CURRENT_PACKAGES_DIR}/share/nng/LICENSE.txt + ${CURRENT_PACKAGES_DIR}/share/nng/copyright) + +vcpkg_copy_pdbs()