aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormyd7349 <myd7349@gmail.com>2019-02-22 08:49:17 +0800
committerVictor Romero <romerosanchezv@gmail.com>2019-02-21 16:49:17 -0800
commit9aad2e8f3342a09bb1c70f552431a129895bd063 (patch)
tree4b1abea980d06ffd56a385ffd0d44c3237f60cfc
parent969299ddbfc9d844a0795a3321e873dc22c221c1 (diff)
downloadvcpkg-9aad2e8f3342a09bb1c70f552431a129895bd063.tar.gz
vcpkg-9aad2e8f3342a09bb1c70f552431a129895bd063.zip
[xeus] Add new port (#5351)
* [xeus] Add new port * [xeus] Update to 2019-02-04 * [xeus] Update cryptopp dependency * [xeus] Update to 2019-02-13 * [xeus] Static building support
-rw-r--r--ports/xeus/CONTROL4
-rw-r--r--ports/xeus/portfile.cmake47
-rw-r--r--ports/xeus/static-lib.patch63
-rw-r--r--ports/xeus/usage4
4 files changed, 118 insertions, 0 deletions
diff --git a/ports/xeus/CONTROL b/ports/xeus/CONTROL
new file mode 100644
index 000000000..f0581395c
--- /dev/null
+++ b/ports/xeus/CONTROL
@@ -0,0 +1,4 @@
+Source: xeus
+Version: 2019-02-13-1
+Description: C++ implementation of the Jupyter kernel protocol
+Build-Depends: cppzmq, cryptopp, libuuid (linux), nlohmann-json, xtl, zeromq
diff --git a/ports/xeus/portfile.cmake b/ports/xeus/portfile.cmake
new file mode 100644
index 000000000..1ba0df8f7
--- /dev/null
+++ b/ports/xeus/portfile.cmake
@@ -0,0 +1,47 @@
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO QuantStack/xeus
+ REF f78c60c7ce28baecb2479f2b82e4e8d1a6c35188
+ SHA512 9d83f32f641bcad4ac96e263c465d46bdfa7d18d41f1e201309244c95587ce08ff2426f7cdd3a4399563d46064ed9bedd4d0babf4840f65e95c6a2c6f23ac9bb
+ HEAD_REF master
+ PATCHES
+ static-lib.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ -DBUILD_EXAMPLES=OFF
+ -DBUILD_TESTS=OFF
+ -DDOWNLOAD_GTEST=OFF
+ -DXEUS_USE_SHARED_CRYPTOPP=OFF # `cryptopp` port currently only supports static linkage.
+ -DDISABLE_ARCH_NATIVE=OFF
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
+
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/xeus/xeus.hpp
+ "#ifdef XEUS_STATIC_LIB"
+ "#if 1 // #ifdef XEUS_STATIC_LIB"
+ )
+endif()
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# Install usage
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+
+# CMake integration test
+#vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/xeus/static-lib.patch b/ports/xeus/static-lib.patch
new file mode 100644
index 000000000..e9ab41f01
--- /dev/null
+++ b/ports/xeus/static-lib.patch
@@ -0,0 +1,63 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 26118eb..ccda00b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -141,7 +141,12 @@ set(XEUS_SOURCES
+ # Output
+ # ======
+
+-add_library(xeus SHARED ${XEUS_SOURCES} ${XEUS_HEADERS})
++option(BUILD_SHARED_LIBS "Build shared instead of static libraries." ON)
++if (BUILD_SHARED_LIBS)
++ add_library(xeus SHARED ${XEUS_SOURCES} ${XEUS_HEADERS})
++else ()
++ add_library(xeus STATIC ${XEUS_SOURCES} ${XEUS_HEADERS})
++endif ()
+
+ if (APPLE)
+ set_target_properties(xeus PROPERTIES
+@@ -166,9 +171,9 @@ target_link_libraries(xeus
+
+ OPTION(XEUS_USE_SHARED_CRYPTOPP "Used shared library for cryptopp" OFF)
+ if (XEUS_USE_SHARED_CRYPTOPP)
+- target_link_libraries(xeus PRIVATE cryptopp-shared)
++ target_link_libraries(xeus PUBLIC cryptopp-shared)
+ else ()
+- target_link_libraries(xeus PRIVATE cryptopp-static)
++ target_link_libraries(xeus PUBLIC cryptopp-static)
+ endif ()
+
+ if(NOT MSVC)
+@@ -226,6 +231,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU"
+ message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
+ endif()
+
++if (NOT BUILD_SHARED_LIBS)
++ target_compile_definitions(xeus PUBLIC XEUS_STATIC_LIB)
++endif ()
++
+ if(MSVC)
+ target_compile_definitions(xeus PUBLIC -DNOMINMAX)
+ target_compile_options(xeus PUBLIC /DGUID_WINDOWS /MP /bigobj)
+diff --git a/include/xeus/xeus.hpp b/include/xeus/xeus.hpp
+index 99e1d79..522bb78 100644
+--- a/include/xeus/xeus.hpp
++++ b/include/xeus/xeus.hpp
+@@ -10,10 +10,14 @@
+ #define XEUS_EXPORT_HPP
+
+ #ifdef _WIN32
+- #ifdef XEUS_EXPORTS
+- #define XEUS_API __declspec(dllexport)
++ #ifdef XEUS_STATIC_LIB
++ #define XEUS_API
+ #else
+- #define XEUS_API __declspec(dllimport)
++ #ifdef XEUS_EXPORTS
++ #define XEUS_API __declspec(dllexport)
++ #else
++ #define XEUS_API __declspec(dllimport)
++ #endif
+ #endif
+ #else
+ #define XEUS_API
diff --git a/ports/xeus/usage b/ports/xeus/usage
new file mode 100644
index 000000000..bac932eb9
--- /dev/null
+++ b/ports/xeus/usage
@@ -0,0 +1,4 @@
+The package xeus provides CMake targets:
+
+ find_package(xeus CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE xeus)