aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Karatarakis <alex@karatarakis.com>2017-05-10 14:45:08 -0700
committerGitHub <noreply@github.com>2017-05-10 14:45:08 -0700
commitcf54838139aa03e6b7f7d13c6963bd2cb7ba2fa4 (patch)
tree7f9a0217c15998601a523502a41ed76815180e3f
parent4e9e62f6ef6a45680a8453c31b39e7504a7a0605 (diff)
parent6601d0adc5c3b26557af666c2123ac433cdc5e1e (diff)
downloadvcpkg-cf54838139aa03e6b7f7d13c6963bd2cb7ba2fa4.tar.gz
vcpkg-cf54838139aa03e6b7f7d13c6963bd2cb7ba2fa4.zip
Merge pull request #1047 from traversaro/add-ode
Add ode port
-rw-r--r--ports/ode/0001-add-static-runtime-option.patch31
-rw-r--r--ports/ode/CONTROL3
-rw-r--r--ports/ode/portfile.cmake107
3 files changed, 141 insertions, 0 deletions
diff --git a/ports/ode/0001-add-static-runtime-option.patch b/ports/ode/0001-add-static-runtime-option.patch
new file mode 100644
index 000000000..1f0d15b56
--- /dev/null
+++ b/ports/ode/0001-add-static-runtime-option.patch
@@ -0,0 +1,31 @@
+diff --git a/build/premake4.lua b/build/premake4.lua
+index c39b9b7..d1559f7 100644
+--- a/build/premake4.lua
++++ b/build/premake4.lua
+@@ -150,7 +150,12 @@
+ trigger = "only-double",
+ description = "Only use double-precision math"
+ }
+-
++
++ newoption {
++ trigger = "static-runtime",
++ description = "Perform a static link against the standard runtime libraries"
++ }
++
+ -- always clean all of the optional components and toolsets
+ if _ACTION == "clean" then
+ _OPTIONS["with-demos"] = ""
+@@ -253,7 +258,11 @@
+ configuration { "vs2002 or vs2003", "*Lib" }
+ flags { "StaticRuntime" }
+
+-
++ -- optionally enable StaticRuntime
++ if _OPTIONS["static-runtime"] then
++ configuration { "*" }
++ flags { "StaticRuntime" }
++ end
+
+ ----------------------------------------------------------------------
+ -- The demo projects, automated from list above. These go first so
diff --git a/ports/ode/CONTROL b/ports/ode/CONTROL
new file mode 100644
index 000000000..952e85629
--- /dev/null
+++ b/ports/ode/CONTROL
@@ -0,0 +1,3 @@
+Source: ode
+Version: 0.15.1
+Description: Open Dynamics Engine
diff --git a/ports/ode/portfile.cmake b/ports/ode/portfile.cmake
new file mode 100644
index 000000000..2bd55e060
--- /dev/null
+++ b/ports/ode/portfile.cmake
@@ -0,0 +1,107 @@
+# Common Ambient Variables:
+# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
+# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
+# CURRENT_PORT DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
+# PORT = current port name (zlib, etc)
+# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
+# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
+# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
+# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
+# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
+#
+
+include(vcpkg_common_functions)
+set(SOURCE_VERSION 0.15.1)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ode-${SOURCE_VERSION})
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://bitbucket.org/odedevs/ode/downloads/ode-${SOURCE_VERSION}.tar.gz"
+ FILENAME "ode-${SOURCE_VERSION}.tar.gz"
+ SHA512 e30623374c8f7c45359d6d837313698ca28da7b5a2d26c7171da16ccd6f95c4a49aad731c432db6ca2911886948a2e7ea93a96ade5a1639b945a825d8ac87249
+)
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-add-static-runtime-option.patch"
+)
+
+
+if (TRIPLET_SYSTEM_ARCH MATCHES "arm")
+ message(FATAL_ERROR "ARM is currently not supported.")
+elseif (TRIPLET_SYSTEM_ARCH MATCHES "x86")
+ set(premake_PLATFORM "x32")
+ set(MSBUILD_PLATFORM "Win32")
+else ()
+ set(premake_PLATFORM ${TRIPLET_SYSTEM_ARCH})
+ set(MSBUILD_PLATFORM ${TRIPLET_SYSTEM_ARCH})
+endif()
+
+# The build system of ode outputs its artifacts in this subdirectory
+# of the source directory
+set(DEBUG_ARTIFACTS_PATH ${SOURCE_PATH}/lib/Debug)
+set(RELEASE_ARTIFACTS_PATH ${SOURCE_PATH}/lib/Release)
+
+# To avoid contamination from previous build, we clean the directory
+file(REMOVE_RECURSE ${DEBUG_ARTIFACTS_PATH} ${RELEASE_ARTIFACTS_PATH})
+
+# Configure the project using the embedded premake4
+message(STATUS "Configuring ${TARGET_TRIPLET}")
+# Consistently with the debian package we only ship ODE built with double precision
+set(premake_OPTIONS "--only-double")
+# TODO: use vcpkg's libccd
+list(APPEND premake_OPTIONS --with-libccd)
+if(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ list(APPEND premake_OPTIONS --only-shared)
+elseif(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ list(APPEND premake_OPTIONS --only-static)
+endif()
+if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static)
+ list(APPEND premake_OPTIONS --static-runtime)
+endif()
+file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET})
+vcpkg_execute_required_process(
+ COMMAND ${SOURCE_PATH}/build/premake4.exe
+ --to=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}
+ --platform=${premake_PLATFORM}
+ ${premake_OPTIONS}
+ vs2010
+ WORKING_DIRECTORY ${SOURCE_PATH}/build/
+ LOGNAME config-${TARGET_TRIPLET}
+)
+message(STATUS "Configuring ${TARGET_TRIPLET} done")
+
+# Build the project using the generated msbuild solutions
+vcpkg_build_msbuild(PROJECT_PATH ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/ode.sln
+ PLATFORM ${MSBUILD_PLATFORM}
+ WORKING_DIRECTORY ${SOURCE_PATH}/build)
+
+# Install headers
+file(GLOB HEADER_FILES ${SOURCE_PATH}/include/ode/*.h)
+file(INSTALL ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/ode)
+
+# Install libraries
+file(GLOB LIB_DEBUG_FILES ${DEBUG_ARTIFACTS_PATH}/*.lib ${DEBUG_ARTIFACTS_PATH}/*.exp)
+file(INSTALL ${LIB_DEBUG_FILES}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+if (DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(GLOB BIN_DEBUG_FILES ${DEBUG_ARTIFACTS_PATH}/*.dll ${DEBUG_ARTIFACTS_PATH}/*.pdb)
+ file(INSTALL ${BIN_DEBUG_FILES}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+endif ()
+
+file(GLOB LIB_RELEASE_FILES ${RELEASE_ARTIFACTS_PATH}/*.lib ${RELEASE_ARTIFACTS_PATH}/*.exp)
+file(INSTALL ${LIB_RELEASE_FILES}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+if (DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ file(GLOB BIN_RELEASE_FILES ${RELEASE_ARTIFACTS_PATH}/*.dll ${RELEASE_ARTIFACTS_PATH}/*.pdb)
+ file(INSTALL ${BIN_RELEASE_FILES}
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+endif ()
+
+
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE-BSD.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/ode)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/ode/LICENSE-BSD.TXT ${CURRENT_PACKAGES_DIR}/share/ode/copyright)