-
Notifications
You must be signed in to change notification settings - Fork 342
[SofaMacros] Handle COMPONENTS (needed by SofaPython3) #1671
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
[SofaMacros] Handle COMPONENTS (needed by SofaPython3) #1671
Conversation
|
Hey @guparan , Thanks a lot for this. I've tested it very quickly. In order to use this for SofaPython3, we would need to be able to specify where to install some targets and files relative to the install prefix. For example, the binding libraries should be installed in Here is the installation tree that we would need for SofaPython3: |
98036e6 to
22a75be
Compare
|
@jnbrunet Thanks for the explicit install tree, just what I needed 👍 |
|
I messed up this branch... Let me fix that. |
with SOFA_BUILD_TESTS=ON
Allow a 3-level organization: Package > Component > Target
Example of SofaPython3:
You want to do: find_package(SofaPython3 COMPONENTS Bindings)
To do that, you must use these macros in your project:
# In SofaPython3/CMakeLists.txt
# Create a Package (without Target) to contain the Components
sofa_create_package(
PACKAGE_NAME SofaPython3
PACKAGE_VERSION ${PROJECT_VERSION}
RELOCATABLE "plugins"
)
# In SofaPython3/Bindings/CMakeLists.txt
# Create a Component (with Targets) into that Package
sofa_create_component_in_package_with_targets(
COMPONENT_NAME Bindings
COMPONENT_VERSION ${SofaPython3_VERSION}
PACKAGE_NAME SofaPython3
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
INCLUDE_SOURCE_DIR "src"
INCLUDE_INSTALL_DIR "."
RELOCATABLE ".."
)
22a75be to
70dbefc
Compare
…for_sofapython3 # Conflicts: # SofaKernel/SofaFramework/SofaMacrosInstall.cmake
* [CMake] Allow SofaPython3 build alongside SofaPython
with SOFA_BUILD_TESTS=ON
* [SofaMacros] ADD macros for COMPONENT handling
Allow a 3-level organization: Package > Component > Target
Example of SofaPython3:
You want to do: find_package(SofaPython3 COMPONENTS Bindings)
To do that, you must use these macros in your project:
# In SofaPython3/CMakeLists.txt
# Create a Package (without Target) to contain the Components
sofa_create_package(
PACKAGE_NAME SofaPython3
PACKAGE_VERSION ${PROJECT_VERSION}
RELOCATABLE "plugins"
)
# In SofaPython3/Bindings/CMakeLists.txt
# Create a Component (with Targets) into that Package
sofa_create_component_in_package_with_targets(
COMPONENT_NAME Bindings
COMPONENT_VERSION ${SofaPython3_VERSION}
PACKAGE_NAME SofaPython3
TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES
INCLUDE_SOURCE_DIR "src"
INCLUDE_INSTALL_DIR "."
RELOCATABLE ".."
)
* [SofaMacros] Add comments and clean new macros
* [plugins] FIX SofaPython3 order
* [SofaMacros] Allow to skip the "optimize build dir" step
* [SofaMacros] FIX missing dot-to-underscore replacement
…k#1671) * [CMake] Allow SofaPython3 build alongside SofaPython with SOFA_BUILD_TESTS=ON * [SofaMacros] ADD macros for COMPONENT handling Allow a 3-level organization: Package > Component > Target Example of SofaPython3: You want to do: find_package(SofaPython3 COMPONENTS Bindings) To do that, you must use these macros in your project: # In SofaPython3/CMakeLists.txt # Create a Package (without Target) to contain the Components sofa_create_package( PACKAGE_NAME SofaPython3 PACKAGE_VERSION ${PROJECT_VERSION} RELOCATABLE "plugins" ) # In SofaPython3/Bindings/CMakeLists.txt # Create a Component (with Targets) into that Package sofa_create_component_in_package_with_targets( COMPONENT_NAME Bindings COMPONENT_VERSION ${SofaPython3_VERSION} PACKAGE_NAME SofaPython3 TARGETS ${PROJECT_NAME} AUTO_SET_TARGET_PROPERTIES INCLUDE_SOURCE_DIR "src" INCLUDE_INSTALL_DIR "." RELOCATABLE ".." ) * [SofaMacros] Add comments and clean new macros * [plugins] FIX SofaPython3 order * [SofaMacros] Allow to skip the "optimize build dir" step * [SofaMacros] FIX missing dot-to-underscore replacement
Allow a 3-level organization: Package > Component > Target
Example with SofaPython3 (PR to come in SofaPython3 repo)
You want to do:
find_package(SofaPython3 COMPONENTS Bindings)To do that, you must use these macros in your project:
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if