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

[simbody] uniform target names and add usage #28863

Merged
merged 1 commit into from
Jan 12, 2023
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
84 changes: 84 additions & 0 deletions ports/simbody/common-name-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1995170..7ddb018 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -174,25 +174,25 @@ FORCE)


set(SimTKCOMMON_SHARED_LIBRARY ${SimTKCOMMON_LIBRARY_NAME})
-set(SimTKCOMMON_STATIC_LIBRARY ${SimTKCOMMON_LIBRARY_NAME}_static)
+set(SimTKCOMMON_STATIC_LIBRARY ${SimTKCOMMON_LIBRARY_NAME})

set(SimTKCOMMON_LIBRARY_NAME_VN ${NS}SimTKcommon${VN})
set(SimTKCOMMON_SHARED_LIBRARY_VN ${SimTKCOMMON_LIBRARY_NAME_VN})
-set(SimTKCOMMON_STATIC_LIBRARY_VN ${SimTKCOMMON_LIBRARY_NAME_VN}_static)
+set(SimTKCOMMON_STATIC_LIBRARY_VN ${SimTKCOMMON_LIBRARY_NAME_VN})

set(SimTKMATH_SHARED_LIBRARY ${SimTKMATH_LIBRARY_NAME})
-set(SimTKMATH_STATIC_LIBRARY ${SimTKMATH_LIBRARY_NAME}_static)
+set(SimTKMATH_STATIC_LIBRARY ${SimTKMATH_LIBRARY_NAME})

set(SimTKMATH_LIBRARY_NAME_VN ${NS}SimTKmath${VN})
set(SimTKMATH_SHARED_LIBRARY_VN ${SimTKMATH_LIBRARY_NAME_VN})
-set(SimTKMATH_STATIC_LIBRARY_VN ${SimTKMATH_LIBRARY_NAME_VN}_static)
+set(SimTKMATH_STATIC_LIBRARY_VN ${SimTKMATH_LIBRARY_NAME_VN})

set(SimTKSIMBODY_SHARED_LIBRARY ${SimTKSIMBODY_LIBRARY_NAME})
-set(SimTKSIMBODY_STATIC_LIBRARY ${SimTKSIMBODY_LIBRARY_NAME}_static)
+set(SimTKSIMBODY_STATIC_LIBRARY ${SimTKSIMBODY_LIBRARY_NAME})

set(SimTKSIMBODY_LIBRARY_NAME_VN ${NS}SimTKsimbody${VN})
set(SimTKSIMBODY_SHARED_LIBRARY_VN ${SimTKSIMBODY_LIBRARY_NAME_VN})
-set(SimTKSIMBODY_STATIC_LIBRARY_VN ${SimTKSIMBODY_LIBRARY_NAME_VN}_static)
+set(SimTKSIMBODY_STATIC_LIBRARY_VN ${SimTKSIMBODY_LIBRARY_NAME_VN})


# Caution: this variable is automatically created by the CMake
diff --git a/SimTKcommon/CMakeLists.txt b/SimTKcommon/CMakeLists.txt
index 47839f5..84ad865 100644
--- a/SimTKcommon/CMakeLists.txt
+++ b/SimTKcommon/CMakeLists.txt
@@ -86,9 +86,9 @@ endif(NEED_QUOTES)
# -DSimTKcommon_EXPORTS defined automatically when Windows DLL build is being done.

set(SHARED_TARGET ${SimTKCOMMON_LIBRARY_NAME})
-set(STATIC_TARGET ${SimTKCOMMON_LIBRARY_NAME}_static)
+set(STATIC_TARGET ${SimTKCOMMON_LIBRARY_NAME})
set(SHARED_TARGET_VN ${SimTKCOMMON_LIBRARY_NAME}${VN})
-set(STATIC_TARGET_VN ${SimTKCOMMON_LIBRARY_NAME}${VN}_static)
+set(STATIC_TARGET_VN ${SimTKCOMMON_LIBRARY_NAME}${VN})

## Test against the unversioned libraries if they are being build;
## otherwise against the versioned libraries.
diff --git a/SimTKmath/CMakeLists.txt b/SimTKmath/CMakeLists.txt
index f5c82ae..d3ee9bf 100644
--- a/SimTKmath/CMakeLists.txt
+++ b/SimTKmath/CMakeLists.txt
@@ -79,9 +79,9 @@ endif(NEED_QUOTES)
# -Dsimmath_EXPORTS defined automatically when Windows DLL build is being done.

set(SHARED_TARGET ${SimTKMATH_LIBRARY_NAME})
-set(STATIC_TARGET ${SimTKMATH_LIBRARY_NAME}_static)
+set(STATIC_TARGET ${SimTKMATH_LIBRARY_NAME})
set(SHARED_TARGET_VN ${SimTKMATH_LIBRARY_NAME}${VN})
-set(STATIC_TARGET_VN ${SimTKMATH_LIBRARY_NAME}${VN}_static)
+set(STATIC_TARGET_VN ${SimTKMATH_LIBRARY_NAME}${VN})

## Test against the unversioned libraries if they are being built;
## otherwise against the versioned libraries.
diff --git a/Simbody/CMakeLists.txt b/Simbody/CMakeLists.txt
index 062c2b9..e320f57 100644
--- a/Simbody/CMakeLists.txt
+++ b/Simbody/CMakeLists.txt
@@ -42,9 +42,9 @@ add_definitions(-DSimTK_SIMBODY_LIBRARY_NAME=${SimTKSIMBODY_LIBRARY_NAME}


set(SHARED_TARGET ${SimTKSIMBODY_LIBRARY_NAME})
-set(STATIC_TARGET ${SimTKSIMBODY_LIBRARY_NAME}_static)
+set(STATIC_TARGET ${SimTKSIMBODY_LIBRARY_NAME})
set(SHARED_TARGET_VN ${SimTKSIMBODY_LIBRARY_NAME}${VN})
-set(STATIC_TARGET_VN ${SimTKSIMBODY_LIBRARY_NAME}${VN}_static)
+set(STATIC_TARGET_VN ${SimTKSIMBODY_LIBRARY_NAME}${VN})
Comment on lines +76 to +81
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and for SimTKcommon, SimTKmath:
The maintainer guidelines allow to rename binaries in order to have the same name for static vs. dynamic.
But IMO this doesn't extend to renaming exported CMake targets. The usage suggestion can use generator expressions, cf. zstd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok fine by me, but then does it even matter to rename the libraries if it is not related? The downstream user would just rely on the usage file no matter the library name. I would completely remove the patch to thin back the port in that case.


## Test against the unversioned libraries if they are being built;
## otherwise against the versioned libraries.
8 changes: 5 additions & 3 deletions ports/simbody/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO simbody/simbody
REF 040562785acd4b6d9d26ea6762d5c80075e0c474
SHA512 b803ed45fbaa60c5af601ac2d0be2a109eae19428d72ab06952403e12116ee08592014d85accad8e6a64aed6bb0afbd6f9dff6588c4b22da65fd1bac067f8662
REF 462b2a6dbb8794db2922d72f52b29b488a178ebc
SHA512 e2b1837e0a04461ebc94e80f5e8aa29f874a1113383db8b24e77b0c9413c4a6bab0299c6a9b2f07147e82ef01a765fed6d6455d5bd059882c646830dd8d1b224
HEAD_REF master
PATCHES
common-name-libs.patch
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC_LIBRARIES)
Expand Down Expand Up @@ -38,5 +40,5 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/doc")

vcpkg_fixup_pkgconfig()

# Handle copyright
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
4 changes: 4 additions & 0 deletions ports/simbody/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Simbody provides CMake targets:

find_package(Simbody CONFIG REQUIRED)
target_link_libraries(main PRIVATE SimTKcommon SimTKmath SimTKsimbody)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would guess that the actual usage only needs SimTKsimbody(-static), if properly exported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The targets are indeed incremental (SimTKcommon ⊂ SimTKmath ⊂ SimTKsimbody). Though each target is seldom usable and I have seen libraries relying on a subset specifically. Unless CMake can strip correctly simbody if someone use math only, then IMO usage file should reflect that.

3 changes: 1 addition & 2 deletions ports/simbody/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "simbody",
"version-date": "2022-01-04",
"port-version": 2,
"version-date": "2023-01-10",
"description": "High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.",
"homepage": "https://simtk.org/home/simbody",
"license": "Apache-2.0",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7041,8 +7041,8 @@
"port-version": 1
},
"simbody": {
"baseline": "2022-01-04",
"port-version": 2
"baseline": "2023-01-10",
"port-version": 0
},
"simd": {
"baseline": "5.1.119",
Expand Down
5 changes: 5 additions & 0 deletions versions/s-/simbody.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c8b6a6d70b06b78e445b3c80cbded18415e22a7c",
"version-date": "2023-01-10",
"port-version": 0
},
{
"git-tree": "077f05087ad6704e1febb44e27273550028c5729",
"version-date": "2022-01-04",
Expand Down