From 6800cbed5cbb2fdc2c52f2ff6c03e7771810003e Mon Sep 17 00:00:00 2001 From: Jim Tilander Date: Thu, 28 Dec 2017 15:37:56 -0800 Subject: Add support for Box2D to be build as a static library --- ports/box2d/portfile.cmake | 11 +++++++--- ports/box2d/use-static-linkage.patch | 40 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 ports/box2d/use-static-linkage.patch diff --git a/ports/box2d/portfile.cmake b/ports/box2d/portfile.cmake index 122290251..b07dbc663 100644 --- a/ports/box2d/portfile.cmake +++ b/ports/box2d/portfile.cmake @@ -7,9 +7,6 @@ elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm") message(FATAL_ERROR "ARM not supported") endif(TRIPLET_SYSTEM_ARCH MATCHES "x86") -if(NOT VCPKG_CRT_LINKAGE STREQUAL "dynamic") - message(FATAL_ERROR "Box2d only supports dynamic CRT linkage") -endif() include(vcpkg_common_functions) @@ -25,6 +22,14 @@ vcpkg_from_github( HEAD_REF master ) +if(VCPKG_CRT_LINKAGE STREQUAL "static") + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/use-static-linkage.patch + ) +endif() + # Put the licence and readme files where vcpkg expects it message(STATUS "Packaging license") file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/box2d) diff --git a/ports/box2d/use-static-linkage.patch b/ports/box2d/use-static-linkage.patch new file mode 100644 index 000000000..4c3fccd53 --- /dev/null +++ b/ports/box2d/use-static-linkage.patch @@ -0,0 +1,40 @@ +diff --git a/Box2D/Build/vs2015/Box2D.vcxproj b/Box2D/Build/vs2015/Box2D.vcxproj +index 830803c..5dda519 100644 +--- a/Box2D/Build/vs2015/Box2D.vcxproj ++++ b/Box2D/Build/vs2015/Box2D.vcxproj +@@ -86,7 +86,7 @@ + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks +- MultiThreadedDebugDLL ++ MultiThreadedDebug + true + + +@@ -115,7 +115,7 @@ + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks +- MultiThreadedDebugDLL ++ MultiThreadedDebug + true + + +@@ -145,7 +145,7 @@ + _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + false + true +- MultiThreadedDLL ++ MultiThreaded + true + + +@@ -176,7 +176,7 @@ + _CRT_SECURE_NO_WARNINGS;NDEBUG;%(PreprocessorDefinitions) + false + true +- MultiThreadedDLL ++ MultiThreaded + true + + -- cgit v1.2.3