aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ccd
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/ccd')
-rw-r--r--vcpkg/ports/ccd/fix-static.patch13
-rw-r--r--vcpkg/ports/ccd/portfile.cmake40
-rw-r--r--vcpkg/ports/ccd/support-emscripten.patch25
-rw-r--r--vcpkg/ports/ccd/vcpkg.json23
4 files changed, 101 insertions, 0 deletions
diff --git a/vcpkg/ports/ccd/fix-static.patch b/vcpkg/ports/ccd/fix-static.patch
new file mode 100644
index 0000000..cfb4d38
--- /dev/null
+++ b/vcpkg/ports/ccd/fix-static.patch
@@ -0,0 +1,13 @@
+diff --git a/src/ccd/ccd_export.h b/src/ccd/ccd_export.h
+index e898d41..c6aa5fb 100644
+--- a/src/ccd/ccd_export.h
++++ b/src/ccd/ccd_export.h
+@@ -1,7 +1,7 @@
+ #ifndef CCD_EXPORT_H
+ #define CCD_EXPORT_H
+
+-#ifdef CCD_STATIC_DEFINE
++#if 1
+ # define CCD_EXPORT
+ #else
+ # ifdef _MSC_VER
diff --git a/vcpkg/ports/ccd/portfile.cmake b/vcpkg/ports/ccd/portfile.cmake
new file mode 100644
index 0000000..d5055a0
--- /dev/null
+++ b/vcpkg/ports/ccd/portfile.cmake
@@ -0,0 +1,40 @@
+if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(STATIC_PATCH fix-static.patch)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO danfis/libccd
+ REF v2.1
+ SHA512 ff037d9c4df50f09600cf9b3514b259b2850ff43f74817853f5665d22812891168f70bd3cc3969b2c9e3c706f6254991a65421476349607fbd04d894b217456d
+ HEAD_REF master
+ # Backport https://github.com/danfis/libccd/pull/70 to support Emscripten
+ PATCHES
+ "support-emscripten.patch"
+ ${STATIC_PATCH}
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ double-precision ENABLE_DOUBLE_PRECISION
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DBUILD_TESTING=OFF
+ ${FEATURE_OPTIONS}
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/ccd)
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/doc")
+
+file(INSTALL "${SOURCE_PATH}/BSD-LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+
+vcpkg_fixup_pkgconfig()
diff --git a/vcpkg/ports/ccd/support-emscripten.patch b/vcpkg/ports/ccd/support-emscripten.patch
new file mode 100644
index 0000000..2fe689a
--- /dev/null
+++ b/vcpkg/ports/ccd/support-emscripten.patch
@@ -0,0 +1,25 @@
+From c3616f28d33019047e8e71df8abeb0493159539e Mon Sep 17 00:00:00 2001
+From: Silvio Traversaro <silvio@traversaro.it>
+Date: Sun, 17 May 2020 11:42:24 +0200
+Subject: [PATCH] Fix configuration with Emscripten
+
+In Emscripten there is no separate libm library, so there is no need to explicitly link it,
+and in particular the find_library call would fail as there is not libm to find.
+See https://stackoverflow.com/questions/24663915/how-can-i-link-libm-to-my-emscripten-port
+---
+ src/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 1407080..357ed76 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -48,7 +48,7 @@ target_include_directories(ccd PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+
+-if(NOT WIN32)
++if(NOT WIN32 AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Emscripten"))
+ find_library(LIBM_LIBRARY NAMES m)
+ if(NOT LIBM_LIBRARY)
+ message(FATAL_ERROR "Could NOT find required library LibM")
diff --git a/vcpkg/ports/ccd/vcpkg.json b/vcpkg/ports/ccd/vcpkg.json
new file mode 100644
index 0000000..5716257
--- /dev/null
+++ b/vcpkg/ports/ccd/vcpkg.json
@@ -0,0 +1,23 @@
+{
+ "name": "ccd",
+ "version": "2.1",
+ "port-version": 4,
+ "description": "Library for collision detection between two convex shapes",
+ "homepage": "https://github.com/danfis/libccd",
+ "license": "BSD-3-Clause",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ],
+ "features": {
+ "double-precision": {
+ "description": "Use float64 doubles for ccd"
+ }
+ }
+}