Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mp-units] add new port #13416

Merged
merged 2 commits into from
Sep 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ports/mp-units/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: mp-units
Version: 0.6.0
Homepage: https://github.com/mpusz/units
Description: mp-units - A Units Library for C++
Build-Depends: fmt, ms-gsl
35 changes: 35 additions & 0 deletions ports/mp-units/cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b18a30a96..d89248aa1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,14 +40,24 @@ conan_init(cmake)
add_subdirectory(src)

# set restrictive compilation warnings
-set_warnings(mp-units)
+# set_warnings(mp-units)

# add unit tests
-enable_testing()
-add_subdirectory(test)
+option(BUILD_TESTING "Build tests" OFF)
+if(BUILD_TESTING)
+ set_warnings(mp-units)
+ enable_testing()
+ add_subdirectory(test)
+endif()

# add usage example
-add_subdirectory(example)
-
+option(BUILD_EXAMPLES "Build usage examples" OFF)
+if(BUILD_EXAMPLES)
+ add_subdirectory(example)
+endif()
# generate project documentation
-add_subdirectory(docs)
+
+option(BUILD_DOCS "Generate docs" OFF)
+if(BUILD_DOCS)
+ add_subdirectory(docs)
+endif()
9 changes: 9 additions & 0 deletions ports/mp-units/config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
diff --git a/cmake/common/simple-config.cmake.in b/cmake/common/simple-config.cmake.in
index f40ebfa88..d521e0ba8 100644
--- a/cmake/common/simple-config.cmake.in
+++ b/cmake/common/simple-config.cmake.in
@@ -1 +1,4 @@
+include(CMakeFindDependencyMacro)
+find_dependency(fmt CONFIG)
+find_dependency(Microsoft.GSL CONFIG)
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
24 changes: 24 additions & 0 deletions ports/mp-units/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mpusz/units
REF 33ad51311b835efb7f7767473f971c02a3140073
SHA512 18c9a4bb1812d7ab59e86d3eef5f62aa760c8f78eac81086bd3b25f7e2d359f2fba71b0298cf91ecb31dbe13846f2e5ce75133b0db534020102b788dd1c1a1da
PATCHES
cmake.patch
config.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT})
# Handle copyright/readme/package files
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
file(INSTALL ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

We do not generally install accessory documentation.


file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug"
"${CURRENT_PACKAGES_DIR}/lib") # Header only