Skip to content
This repository has been archived by the owner on Feb 17, 2025. It is now read-only.

Add export config file for assigner package #13

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Conversation

makxenov
Copy link
Collaborator

@makxenov makxenov commented May 14, 2024

No description provided.

@makxenov makxenov requested review from akokoshn, aleasims and x-mass May 14, 2024 13:58
@makxenov makxenov marked this pull request as draft May 22, 2024 09:58
@makxenov makxenov force-pushed the export-config branch 5 times, most recently from b8203be to 24e8b0c Compare May 24, 2024 07:26
@makxenov makxenov force-pushed the export-config branch 2 times, most recently from f56d6f9 to 760ca8c Compare June 6, 2024 12:47
@makxenov makxenov marked this pull request as ready for review June 6, 2024 13:30
@makxenov makxenov requested review from akokoshn and aleasims June 6, 2024 13:30
@makxenov makxenov force-pushed the export-config branch 5 times, most recently from ae4bd55 to 1a1d22f Compare June 6, 2024 17:01
@makxenov makxenov marked this pull request as draft June 6, 2024 17:03
@makxenov makxenov force-pushed the export-config branch 3 times, most recently from b0bbc98 to 3199b5e Compare June 6, 2024 17:51
@makxenov makxenov requested a review from AndreyMlashkin June 6, 2024 18:14
@makxenov makxenov marked this pull request as ready for review June 6, 2024 18:14
CMakeLists.txt Outdated
@@ -142,4 +142,21 @@ install(TARGETS ${install_targets} EXPORT evmoneTargets
install(DIRECTORY ${include_dir}/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

set(CONFIG_PATH ${CMAKE_INSTALL_LIBDIR}/cmake/evmone-assigner)
install(EXPORT evmoneTargets DESTINATION ${CONFIG_PATH})
install(EXPORT assignerTargets DESTINATION ${CONFIG_PATH})
Copy link
Contributor

Choose a reason for hiding this comment

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

I think, we should use NAMESPACE here (it will be added to IMPORTED library target). As a result, you will use something like evm_assigner::evm_assigner instead of just evm_assigner.

The reason for this is that CMake won't treat namespaced target as a "system library" and will immediately fail if the target is not found.
https://stackoverflow.com/a/62490462

The root of the problem is actually a questionable syntax of target_link_libraries(), which allows you to pass even linker flags to it.

I believe right now, that using namespaces when exporting targets is the best practice, since in that case you will be sure later, that you are linking exactly this one target rather than some rubbish.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, will add evm_assigner:: namespace for both evm_assigner and evmone targets.
FYI I've found LINK_LIBRARIES_ONLY_TARGETS property related to this problem. But I was unable to make it work when I tried it.

CXX=$(nix develop -c bash -c 'which g++' | tail -1)
echo $CXX
$CMAKE_BINARY -GNinja -DCMAKE_MAKE_PROGRAM=$NINJA_BINARY -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=$CXX -DBUILD_ASSIGNER_TESTS=TRUE
$NINJA_BINARY -C build
Copy link
Contributor

Choose a reason for hiding this comment

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

How about we move this into some shell script like scripts/non-nix-build.sh so one can run this locally?

Copy link
Collaborator Author

@makxenov makxenov Jun 7, 2024

Choose a reason for hiding this comment

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

Moved to script as is. I was thinking about a customizable script, but there are too many parameters, so it's hard to make the script useful.

@makxenov makxenov requested a review from aleasims June 7, 2024 10:07
@makxenov makxenov merged commit d5cd7c0 into master Jun 10, 2024
1 check passed
@akokoshn akokoshn deleted the export-config branch June 19, 2024 06:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants