aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-07-03 06:23:53 +0800
committerGriffin Downs <35574547+grdowns@users.noreply.github.com>2019-07-02 15:23:53 -0700
commitfb4cc372629d0cf08a80d31e7e0f579a437c5cd9 (patch)
tree88a5046e9ee9ad74676586a9eb35810dc26be3c3
parent24b1618b292541086cc97820df8619d6ede046f5 (diff)
downloadvcpkg-fb4cc372629d0cf08a80d31e7e0f579a437c5cd9.tar.gz
vcpkg-fb4cc372629d0cf08a80d31e7e0f579a437c5cd9.zip
[czmq] Add new port (#4979)
* [czmq] Add new port * [czmq] Modernize * [czmq] Update to 2019-05-17 * [czmq] Update to 2019-05-29 * [czmq] Fix OpenSSL not found issue on x64-windows * [czmq] Update portfile.cmake * [czmq] Update to 2019-06-10 * [czmq] Clean * [czmq] Add Homepage * [czmq] Use vcpkg_check_features * [czmq] Disable parallel configuration * Fix typo when using feature options
-rw-r--r--ports/czmq/CONTROL27
-rw-r--r--ports/czmq/Findlibcurl.cmake51
-rw-r--r--ports/czmq/Findlibmicrohttpd.cmake28
-rw-r--r--ports/czmq/Findlibzmq.cmake10
-rw-r--r--ports/czmq/Findlz4.cmake13
-rw-r--r--ports/czmq/Finduuid.cmake31
-rw-r--r--ports/czmq/fix-dependencies.patch19
-rw-r--r--ports/czmq/portfile.cmake101
-rw-r--r--ports/czmq/vcpkg-cmake-wrapper.cmake9
9 files changed, 289 insertions, 0 deletions
diff --git a/ports/czmq/CONTROL b/ports/czmq/CONTROL
new file mode 100644
index 000000000..a45a1a34c
--- /dev/null
+++ b/ports/czmq/CONTROL
@@ -0,0 +1,27 @@
+Source: czmq
+Version: 2019-06-10
+Build-Depends: zeromq
+Description: High-level C binding for ZeroMQ
+Homepage: https://github.com/zeromq/czmq
+
+Feature: tool
+Description: Build and install czmq tools (zmakecert)
+
+Feature: draft
+Description: Build and install draft APIs
+
+Feature: curl
+Description: Build with libcurl
+Build-Depends: curl
+
+Feature: lz4
+Description: Build with lz4
+Build-Depends: lz4
+
+Feature: httpd
+Description: Build with HTTP server support (libmicrohttpd)
+Build-Depends: libmicrohttpd
+
+Feature: uuid
+Description: Build with libuuid
+Build-Depends: libuuid (!windows&!uwp&!osx)
diff --git a/ports/czmq/Findlibcurl.cmake b/ports/czmq/Findlibcurl.cmake
new file mode 100644
index 000000000..6c943e2d7
--- /dev/null
+++ b/ports/czmq/Findlibcurl.cmake
@@ -0,0 +1,51 @@
+find_path(
+ LIBCURL_INCLUDE_DIRS
+ NAMES curl/curl.h
+)
+
+find_library(
+ LIBCURL_LIBRARY_DEBUG
+ NAMES libcurl-d_imp libcurl-d curl-d curl
+)
+
+find_library(
+ LIBCURL_LIBRARY_RELEASE
+ NAMES libcurl_imp libcurl curl
+)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LIBCURL)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ LIBCURL
+ REQUIRED_VARS LIBCURL_LIBRARIES LIBCURL_INCLUDE_DIRS
+)
+
+# CURL dependencies
+# https://github.com/Microsoft/vcpkg/issues/4312
+# https://github.com/microsoft/vcpkg/commit/ee325d14276e7bd7961e94e58293b02d6e9e92da
+# https://github.com/microsoft/vcpkg/pull/6698
+if (LIBCURL_FOUND)
+ find_package(OpenSSL QUIET)
+ find_package(ZLIB QUIET)
+
+ if (OPENSSL_FOUND)
+ list(APPEND LIBCURL_LIBRARIES
+ OpenSSL::SSL
+ OpenSSL::Crypto
+ )
+ endif ()
+
+ if (ZLIB_FOUND)
+ list(APPEND LIBCURL_LIBRARIES
+ ZLIB::ZLIB
+ )
+ endif ()
+
+ if (WIN32)
+ list(APPEND LIBCURL_LIBRARIES
+ Crypt32
+ )
+ endif ()
+endif ()
diff --git a/ports/czmq/Findlibmicrohttpd.cmake b/ports/czmq/Findlibmicrohttpd.cmake
new file mode 100644
index 000000000..476cb2add
--- /dev/null
+++ b/ports/czmq/Findlibmicrohttpd.cmake
@@ -0,0 +1,28 @@
+find_path(LIBMICROHTTPD_INCLUDE_DIRS NAMES microhttpd.h)
+
+get_filename_component(_prefix_path ${LIBMICROHTTPD_INCLUDE_DIRS} PATH)
+
+find_library(
+ LIBMICROHTTPD_LIBRARY_DEBUG
+ NAMES libmicrohttpd microhttpd
+ PATHS ${_prefix_path}/debug/lib
+ NO_DEFAULT_PATH
+)
+
+find_library(
+ LIBMICROHTTPD_LIBRARY_RELEASE
+ NAMES libmicrohttpd microhttpd
+ PATHS ${_prefix_path}/lib
+ NO_DEFAULT_PATH
+)
+
+unset(_prefix_path)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LIBMICROHTTPD)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ LIBMICROHTTPD
+ REQUIRED_VARS LIBMICROHTTPD_LIBRARIES LIBMICROHTTPD_INCLUDE_DIRS
+)
diff --git a/ports/czmq/Findlibzmq.cmake b/ports/czmq/Findlibzmq.cmake
new file mode 100644
index 000000000..706f063c3
--- /dev/null
+++ b/ports/czmq/Findlibzmq.cmake
@@ -0,0 +1,10 @@
+find_package(ZeroMQ CONFIG REQUIRED)
+
+set(LIBZMQ_INCLUDE_DIRS ${ZeroMQ_INCLUDE_DIR})
+set(LIBZMQ_LIBRARIES libzmq libzmq-static)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ LIBZMQ
+ REQUIRED_VARS LIBZMQ_LIBRARIES LIBZMQ_INCLUDE_DIRS
+)
diff --git a/ports/czmq/Findlz4.cmake b/ports/czmq/Findlz4.cmake
new file mode 100644
index 000000000..8ce17c5bd
--- /dev/null
+++ b/ports/czmq/Findlz4.cmake
@@ -0,0 +1,13 @@
+find_path(LZ4_INCLUDE_DIRS NAMES lz4.h)
+
+find_library(LZ4_LIBRARY_DEBUG NAMES lz4d)
+find_library(LZ4_LIBRARY_RELEASE NAMES lz4)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(LZ4)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ LZ4
+ REQUIRED_VARS LZ4_LIBRARIES LZ4_INCLUDE_DIRS
+)
diff --git a/ports/czmq/Finduuid.cmake b/ports/czmq/Finduuid.cmake
new file mode 100644
index 000000000..ba89aab56
--- /dev/null
+++ b/ports/czmq/Finduuid.cmake
@@ -0,0 +1,31 @@
+find_path(
+ UUID_INCLUDE_DIRS
+ NAMES uuid/uuid.h
+)
+
+get_filename_component(_prefix_path ${UUID_INCLUDE_DIRS} PATH)
+
+find_library(
+ UUID_LIBRARY_DEBUG
+ NAMES uuid
+ PATHS ${_prefix_path}/debug/lib
+ NO_DEFAULT_PATH
+)
+
+find_library(
+ UUID_LIBRARY_RELEASE
+ NAMES uuid
+ PATHS ${_prefix_path}/lib
+ NO_DEFAULT_PATH
+)
+
+unset(_prefix_path)
+
+include(SelectLibraryConfigurations)
+select_library_configurations(UUID)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ UUID
+ REQUIRED_VARS UUID_LIBRARIES UUID_INCLUDE_DIRS
+)
diff --git a/ports/czmq/fix-dependencies.patch b/ports/czmq/fix-dependencies.patch
new file mode 100644
index 000000000..9756b6008
--- /dev/null
+++ b/ports/czmq/fix-dependencies.patch
@@ -0,0 +1,19 @@
+diff --git a/builds/cmake/Config.cmake.in b/builds/cmake/Config.cmake.in
+index 9c15f36a..e1475cd6 100644
+--- a/builds/cmake/Config.cmake.in
++++ b/builds/cmake/Config.cmake.in
+@@ -1,4 +1,14 @@
+ @PACKAGE_INIT@
+
++include(CMakeFindDependencyMacro)
++
++find_dependency(ZeroMQ)
++
++if (@CZMQ_WITH_LIBCURL@ AND @LIBCURL_FOUND@)
++ find_dependency(OpenSSL)
++ find_dependency(ZLIB)
++endif ()
++
++
+ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
+ check_required_components("@PROJECT_NAME@")
diff --git a/ports/czmq/portfile.cmake b/ports/czmq/portfile.cmake
new file mode 100644
index 000000000..bba5e6e22
--- /dev/null
+++ b/ports/czmq/portfile.cmake
@@ -0,0 +1,101 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO zeromq/czmq
+ REF 7e29cf95305551daad197e32423d9cff5f9b6893
+ SHA512 7d79494c904f5276c9d1e4a193a63882dc622a6db8998b9719de4aec8b223b3a8b3c92ea02be81f39afc12c1a883b310fd3662ea27ed736b0b9c7092b4843a18
+ HEAD_REF master
+ PATCHES
+ fix-dependencies.patch
+)
+
+foreach(_cmake_module
+ Findlibcurl.cmake
+ Findlibmicrohttpd.cmake
+ Findlibzmq.cmake
+ Findlz4.cmake
+ Finduuid.cmake
+)
+ configure_file(
+ ${CMAKE_CURRENT_LIST_DIR}/${_cmake_module}
+ ${SOURCE_PATH}/${_cmake_module}
+ COPYONLY
+ )
+endforeach()
+
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
+
+vcpkg_check_features(
+ draft ENABLE_DRAFTS
+ tool BUILD_TOOLS
+ curl CZMQ_WITH_LIBCURL
+ httpd CZMQ_WITH_LIBMICROHTTPD
+ lz4 CZMQ_WITH_LZ4
+ uuid CZMQ_WITH_UUID
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ DISABLE_PARALLEL_CONFIGURE
+ OPTIONS
+ -DCZMQ_BUILD_SHARED=${BUILD_SHARED}
+ -DCZMQ_BUILD_STATIC=${BUILD_STATIC}
+ -DBUILD_TESTING=OFF
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_install_cmake()
+
+vcpkg_copy_pdbs()
+
+if(EXISTS ${CURRENT_PACKAGES_DIR}/CMake)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH CMake)
+endif()
+if(EXISTS ${CURRENT_PACKAGES_DIR}/share/cmake/${PORT})
+ vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/${PORT})
+endif()
+
+file(COPY
+ ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
+ DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
+)
+
+if(CMAKE_HOST_WIN32)
+ set(EXECUTABLE_SUFFIX ".exe")
+else()
+ set(EXECUTABLE_SUFFIX "")
+endif()
+
+if (BUILD_TOOLS)
+ file(COPY ${CURRENT_PACKAGES_DIR}/bin/zmakecert${EXECUTABLE_SUFFIX}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT})
+ vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT})
+endif()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/czmq_library.h
+ "if defined CZMQ_STATIC"
+ "if 1 //if defined CZMQ_STATIC"
+ )
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/bin
+ ${CURRENT_PACKAGES_DIR}/debug/bin)
+else()
+ file(REMOVE
+ ${CURRENT_PACKAGES_DIR}/debug/bin/zmakecert${EXECUTABLE_SUFFIX}
+ ${CURRENT_PACKAGES_DIR}/bin/zmakecert${EXECUTABLE_SUFFIX})
+endif()
+
+# 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/czmq/vcpkg-cmake-wrapper.cmake b/ports/czmq/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 000000000..4535e889b
--- /dev/null
+++ b/ports/czmq/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,9 @@
+_find_package(${ARGS})
+
+if(TARGET czmq AND NOT TARGET czmq-static)
+ add_library(czmq-static INTERFACE IMPORTED)
+ set_target_properties(czmq-static PROPERTIES INTERFACE_LINK_LIBRARIES czmq)
+elseif(TARGET czmq-static AND NOT TARGET czmq)
+ add_library(czmq INTERFACE IMPORTED)
+ set_target_properties(czmq PROPERTIES INTERFACE_LINK_LIBRARIES czmq-static)
+endif()