-
Notifications
You must be signed in to change notification settings - Fork 0
chore: static link go-wallet-sdk #6
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -117,15 +117,15 @@ endif() | |||||
| # Find required packages | ||||||
| find_package(Threads REQUIRED) | ||||||
| find_package(absl QUIET) | ||||||
| find_library(LIBWALLET_PATH | ||||||
| NAMES libgowalletsdk.so libgowalletsdk.dylib libgowalletsdk.dll | ||||||
| find_library(LIBGOWALLETSDK | ||||||
| NAMES libgowalletsdk.a libgowalletsdk.lib | ||||||
| PATHS | ||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/lib | ||||||
| NO_DEFAULT_PATH | ||||||
| ) | ||||||
|
|
||||||
| if(NOT LIBWALLET_PATH) | ||||||
| message(WARNING "Wallet C library not found in lib/. Build it via build_wallet_lib.sh before linking.") | ||||||
| if(NOT LIBGOWALLETSDK) | ||||||
| message(WARNING "go-wallet-sdk C library not found in lib/. Build it before linking.") | ||||||
| endif() | ||||||
|
|
||||||
| # Plugin sources | ||||||
|
|
@@ -207,9 +207,24 @@ if(absl_FOUND) | |||||
| ) | ||||||
| endif() | ||||||
|
|
||||||
| # Link the wallet C library if present | ||||||
| if(LIBWALLET_PATH) | ||||||
| target_link_libraries(wallet_module_plugin PRIVATE ${LIBWALLET_PATH}) | ||||||
| # Link against macos frameworks | ||||||
| if(APPLE) | ||||||
| target_link_libraries(wallet_module_plugin PUBLIC "-framework CoreFoundation") | ||||||
| target_link_libraries(wallet_module_plugin PUBLIC "-framework Security") | ||||||
| set_target_properties(wallet_module_plugin PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks") | ||||||
| endif() | ||||||
|
|
||||||
| # Link the go-wallet-sdk C library if present | ||||||
| if(LIBGOWALLETSDK) | ||||||
| target_link_libraries(wallet_module_plugin PRIVATE ${LIBGOWALLETSDK}) | ||||||
|
|
||||||
| if(APPLE) | ||||||
| # macOS specific settings | ||||||
| target_link_options(wallet_module_plugin PRIVATE -Wl,-force_load ${LIBGOWALLETSDK}) | ||||||
| else() | ||||||
| # Linux specific settings | ||||||
| target_link_options(wallet_module_plugin PRIVATE -Wl,--whole-archive ${LIBGOWALLETSDK} -Wl,--no-whole-archive) | ||||||
| endif() | ||||||
|
Comment on lines
+219
to
+227
|
||||||
| endif() | ||||||
|
|
||||||
| # Include directories | ||||||
|
|
@@ -256,42 +271,15 @@ if(APPLE) | |||||
| INSTALL_NAME_DIR "@rpath" | ||||||
| BUILD_WITH_INSTALL_NAME_DIR TRUE) | ||||||
|
|
||||||
| # If libgowalletsdk exists, copy and fix install names | ||||||
| if(LIBWALLET_PATH) | ||||||
| add_custom_command(TARGET wallet_module_plugin PRE_LINK | ||||||
| COMMAND ${CMAKE_COMMAND} -E copy_if_different | ||||||
| ${LIBWALLET_PATH} | ||||||
| ${CMAKE_BINARY_DIR}/modules/libgowalletsdk.dylib | ||||||
| COMMENT "Copying libgowalletsdk to modules directory" | ||||||
| VERBATIM | ||||||
| ) | ||||||
|
|
||||||
| add_custom_command(TARGET wallet_module_plugin POST_BUILD | ||||||
| COMMAND install_name_tool -id "@rpath/wallet_module_plugin.dylib" $<TARGET_FILE:wallet_module_plugin> | ||||||
| COMMAND ${CMAKE_COMMAND} -DWALLET_LIB_PATH=${CMAKE_BINARY_DIR}/modules/libgowalletsdk.dylib -DPLUGIN_PATH=${CMAKE_BINARY_DIR}/modules/wallet_module_plugin.dylib -P ${CMAKE_CURRENT_SOURCE_DIR}/fix_wallet_install_name.cmake | ||||||
| COMMENT "Updating library paths for macOS" | ||||||
| ) | ||||||
| else() | ||||||
| add_custom_command(TARGET wallet_module_plugin POST_BUILD | ||||||
| COMMAND install_name_tool -id "@rpath/wallet_module_plugin.dylib" $<TARGET_FILE:wallet_module_plugin> | ||||||
| COMMENT "Updating library paths for macOS (wallet library not found)" | ||||||
| ) | ||||||
| endif() | ||||||
| add_custom_command(TARGET wallet_module_plugin POST_BUILD | ||||||
| COMMAND install_name_tool -id "@rpath/wallet_module_plugin.dylib" $<TARGET_FILE:wallet_module_plugin> | ||||||
| COMMENT "Updating library paths for macOS (accounts library not found)" | ||||||
|
||||||
| COMMENT "Updating library paths for macOS (accounts library not found)" | |
| COMMENT "Updating library paths for macOS (wallet library not found)" |
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The macOS frameworks CoreFoundation and Security are linked with PUBLIC visibility, which exports these dependencies to consumers of wallet_module_plugin. Since this appears to be a plugin library and these frameworks are implementation details needed for the static go-wallet-sdk library, consider using PRIVATE visibility instead to avoid exposing these dependencies unnecessarily.