зеркало из https://github.com/microsoft/vcpkg.git
[joltphysics] Properly patching build so that it will install properly (#33944)
* Maybe fixing jolt * Trying to fix exports * mend * Trying to fix patch * Trying to fix patch * Another attempt to fix this * More correct exports * Trying to fix includes * Fixing last error * Attempting to supply a config file * Trying to bring back relwithdebinfo * Nuclear option * Trying to properly export * Reordering export operations * Actually fixing install again * Installing correct file * Trying to fix includes again * Maybe correctly fixing install * Fixing syntax error * Updating usage * Reworking after feedback * Updating usage * Another diff change to avoid CXX_FLAGS from being adjusted * Fixing portfile install dir * Disabling IPO * Fixing port name * Fixing dumb issue * Disabling debug symbols in release and trying to make sure the port only appends CXX_FLAGS * Deciding not to mess with dynamic linking for now * Fixing debug build * Making sure config gets fixed up
This commit is contained in:
Родитель
84296312ba
Коммит
01d51b7207
|
@ -0,0 +1,77 @@
|
|||
diff --git a/Build/CMakeLists.txt b/Build/CMakeLists.txt
|
||||
index e4fddc50..655cdc80 100644
|
||||
--- a/Build/CMakeLists.txt
|
||||
+++ b/Build/CMakeLists.txt
|
||||
@@ -91,8 +91,8 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA
|
||||
endif()
|
||||
|
||||
# Set compiler flags for various configurations
|
||||
- set(CMAKE_CXX_FLAGS_DEBUG "/GS /Od /Ob0 /RTC1")
|
||||
- set(CMAKE_CXX_FLAGS_RELEASE "/GS- /Gy /O2 /Oi /Ot")
|
||||
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /GS /Od /Ob0 /RTC1")
|
||||
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GS- /Gy /O2 /Oi /Ot")
|
||||
set(CMAKE_CXX_FLAGS_DISTRIBUTION "/GS- /Gy /O2 /Oi /Ot")
|
||||
set(CMAKE_CXX_FLAGS_RELEASEASAN "-fsanitize=address /Od")
|
||||
set(CMAKE_CXX_FLAGS_RELEASEUBSAN "-fsanitize=undefined,implicit-conversion,float-divide-by-zero,local-bounds -fno-sanitize-recover=all")
|
||||
@@ -148,8 +148,8 @@ elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQU
|
||||
endif()
|
||||
|
||||
# Set compiler flags for various configurations
|
||||
- set(CMAKE_CXX_FLAGS_DEBUG "")
|
||||
- set(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||||
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||
set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O3")
|
||||
set(CMAKE_CXX_FLAGS_RELEASEASAN "-fsanitize=address")
|
||||
set(CMAKE_CXX_FLAGS_RELEASEUBSAN "-fsanitize=undefined,implicit-conversion,float-divide-by-zero,local-bounds -fno-sanitize-recover=all")
|
||||
@@ -193,7 +193,11 @@ if (IOS)
|
||||
endif()
|
||||
|
||||
# Install Jolt library and includes
|
||||
-install(TARGETS Jolt DESTINATION lib)
|
||||
+install(TARGETS Jolt
|
||||
+ EXPORT unofficial-joltphysics-targets
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ RUNTIME DESTINATION bin)
|
||||
foreach(SRC_FILE ${JOLT_PHYSICS_SRC_FILES})
|
||||
string(REPLACE ${PHYSICS_REPO_ROOT} "" RELATIVE_SRC_FILE ${SRC_FILE})
|
||||
get_filename_component(DESTINATION_PATH ${RELATIVE_SRC_FILE} DIRECTORY)
|
||||
@@ -202,6 +206,17 @@ foreach(SRC_FILE ${JOLT_PHYSICS_SRC_FILES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
+install(EXPORT unofficial-joltphysics-targets
|
||||
+ NAMESPACE unofficial::joltphysics::
|
||||
+ FILE unofficial-joltphysics-targets.cmake
|
||||
+ DESTINATION share/unofficial-joltphysics
|
||||
+)
|
||||
+
|
||||
+install(FILES
|
||||
+ unofficial-joltphysics-config.cmake
|
||||
+ DESTINATION share/unofficial-joltphysics
|
||||
+)
|
||||
+
|
||||
# Check if we're the root CMakeLists.txt, if not we are included by another CMake file and we should disable everything except for the main library
|
||||
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||
# Ability to turn ON/OFF individual applications
|
||||
diff --git a/Jolt/Jolt.cmake b/Jolt/Jolt.cmake
|
||||
index 176a7578..b31b2417 100644
|
||||
--- a/Jolt/Jolt.cmake
|
||||
+++ b/Jolt/Jolt.cmake
|
||||
@@ -431,10 +431,13 @@ source_group(TREE ${JOLT_PHYSICS_ROOT} FILES ${JOLT_PHYSICS_SRC_FILES})
|
||||
|
||||
# Create Jolt lib
|
||||
add_library(Jolt STATIC ${JOLT_PHYSICS_SRC_FILES})
|
||||
-target_include_directories(Jolt PUBLIC ${PHYSICS_REPO_ROOT})
|
||||
+target_include_directories(Jolt PUBLIC
|
||||
+ $<BUILD_INTERFACE:${PHYSICS_REPO_ROOT}>
|
||||
+ $<INSTALL_INTERFACE:include>
|
||||
+)
|
||||
target_precompile_headers(Jolt PRIVATE ${JOLT_PHYSICS_ROOT}/Jolt.h)
|
||||
target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug>:_DEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>")
|
||||
-target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Release>:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>")
|
||||
+target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Release>:NDEBUG>")
|
||||
target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Distribution>:NDEBUG>")
|
||||
target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:ReleaseASAN>:NDEBUG;JPH_PROFILE_ENABLED;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER>")
|
||||
target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:ReleaseUBSAN>:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>")
|
|
@ -6,8 +6,14 @@ vcpkg_from_github(
|
|||
REF "v${VERSION}"
|
||||
SHA512 367e5b945e8f91a0c0c9eb699db6f49351aa39b0af9b8fd0be5f474d65b28a7244880eedad10cbd2db0e031daa28bbabb5f9fb8bf9af653dd1f86904bfde44a2
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
fix-export.diff
|
||||
)
|
||||
|
||||
# Need to provide this library a config
|
||||
# The fix-export.diff should install this
|
||||
file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-joltphysics-config.cmake" DESTINATION "${SOURCE_PATH}/Build")
|
||||
|
||||
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_CRT)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
|
@ -19,29 +25,20 @@ vcpkg_cmake_configure(
|
|||
-DTARGET_SAMPLES=OFF
|
||||
-DTARGET_VIEWER=OFF
|
||||
-DCROSS_PLATFORM_DETERMINISTIC=OFF
|
||||
-DINTERPROCEDURAL_OPTIMIZATION=OFF
|
||||
-DUSE_STATIC_MSVC_RUNTIME_LIBRARY=${USE_STATIC_CRT}
|
||||
-DENABLE_ALL_WARNINGS=OFF
|
||||
OPTIONS_RELEASE
|
||||
-DCMAKE_BUILD_TYPE=Distribution
|
||||
-DGENERATE_DEBUG_SYMBOLS=OFF
|
||||
)
|
||||
|
||||
vcpkg_cmake_build()
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(
|
||||
INSTALL "${SOURCE_PATH}/Jolt"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/include"
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
PATTERN "*.inl"
|
||||
)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Jolt.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Jolt.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
else()
|
||||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libJolt.a" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libJolt.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
endif()
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH share/unofficial-${PORT} PACKAGE_NAME unofficial-${PORT})
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
|
||||
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
include(CMakeFindDependencyMacro)
|
||||
# find_dependency(xx 2.0)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/unofficial-joltphysics-targets.cmake)
|
|
@ -1,4 +1,4 @@
|
|||
The package joltphysics can be used from CMake via:
|
||||
joltphysics provides CMake targets:
|
||||
|
||||
find_path(JOLTPHYSICS_INCLUDE_DIRS "Jolt/Jolt.h")
|
||||
target_include_directories(main PRIVATE ${JOLTPHYSICS_INCLUDE_DIRS})
|
||||
find_package(unofficial-joltphysics CONFIG REQUIRED)
|
||||
target_link_libraries(main PRIVATE unofficial::joltphysics::Jolt)
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"name": "joltphysics",
|
||||
"version": "3.0.1",
|
||||
"port-version": 1,
|
||||
"description": "A multi core friendly rigid body physics and collision detection library suitable for games and VR applications",
|
||||
"homepage": "https://github.com/jrouwe/JoltPhysics",
|
||||
"license": "MIT",
|
||||
|
|
|
@ -3538,7 +3538,7 @@
|
|||
},
|
||||
"joltphysics": {
|
||||
"baseline": "3.0.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"josuttis-jthread": {
|
||||
"baseline": "2020-07-21",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "f8fca568d1ae240c8d3ca23ae3b9a09f6fb518ba",
|
||||
"version": "3.0.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "aa3834efa767ca95d2a0f7b367fe4f154101a35e",
|
||||
"version": "3.0.1",
|
||||
|
|
Загрузка…
Ссылка в новой задаче