-
-
Notifications
You must be signed in to change notification settings - Fork 427
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
Adds HPX_LINKER_FLAGS to HPX applications without editing their source codes #3371
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,10 +45,16 @@ add_hpx_library_sources(hpx | |
GLOB_RECURSE GLOBS "${PROJECT_SOURCE_DIR}/src/compat/*.cpp" | ||
APPEND) | ||
|
||
# libhpx_wrap sources | ||
if(HPX_WITH_DYNAMIC_HPX_MAIN AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) | ||
add_hpx_library_sources (hpx_Wrap | ||
GLOB GLOBS "${PROJECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
endif() | ||
|
||
# libhpx_init sources | ||
add_hpx_library_sources(hpx_init | ||
GLOB GLOBS "${PROJECT_SOURCE_DIR}/src/hpx_*.cpp" | ||
EXCLUDE "hpx_init[.]cpp") | ||
EXCLUDE "hpx_init[.]cpp|hpx_wrap.cpp") | ||
add_hpx_library_sources(hpx_init | ||
GLOB GLOBS "${PROJECT_SOURCE_DIR}/src/util/lightweight_test.cpp" | ||
APPEND) | ||
|
@@ -156,6 +162,14 @@ add_hpx_source_group( | |
ROOT "${PROJECT_SOURCE_DIR}/hpx" | ||
TARGETS ${hpx_HEADERS}) | ||
|
||
if(HPX_WITH_DYNAMIC_HPX_MAIN AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) | ||
add_hpx_source_group( | ||
NAME hpx_wrap | ||
CLASS "Source Files" | ||
ROOT "${PROECT_SOURCE_DIR}/src" | ||
TARGETS "${PROECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
endif() | ||
|
||
add_hpx_source_group( | ||
NAME hpx_init | ||
CLASS "Source Files" | ||
|
@@ -316,11 +330,64 @@ foreach(_flag ${HPX_TARGET_COMPILE_DEFINITIONS_VAR}) | |
endif() | ||
endforeach() | ||
|
||
################################################################################ | ||
# libhpx_wrap | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All of this should be disabled for anything but Linux There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh yes! forgot that. |
||
if(HPX_WITH_DYNAMIC_HPX_MAIN AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) | ||
if(NOT HPX_WITH_STATIC_LINKING) | ||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
if(HPX_WITH_DEFAULT_TARGETS) | ||
if(HPX_WITH_CUDA) | ||
cuda_add_library(hpx_wrap STATIC | ||
"${PROJECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
else() | ||
add_library(hpx_wrap STATIC | ||
"${PROJECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
endif() | ||
else() | ||
if(HPX_WITH_CUDA) | ||
cuda_add_library(hpx_wrap STATIC EXCLUDE_FROM_ALL | ||
"${PROJECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
else() | ||
add_library(hpx_wrap STATIC EXCLUDE_FROM_ALL | ||
"${PROJECT_SOURCE_DIR}/src/hpx_wrap.cpp") | ||
endif() | ||
endif() | ||
|
||
set_property(TARGET hpx_wrap APPEND | ||
PROPERTY COMPILE_DEFINITIONS | ||
"HPX_APPLICATION_EXPORTS" | ||
"HPX_ENABLE_ASSERT_HANDLER") | ||
|
||
set_property(TARGET hpx_wrap PROPERTY FOLDER "Core") | ||
set(hpx_targets ${hpx_targets} hpx_wrap) | ||
endif() | ||
|
||
endif() | ||
|
||
get_property(HPX_TARGET_COMPILE_DEFINITIONS_VAR | ||
GLOBAL PROPERTY HPX_TARGET_COMPILE_DEFINITIONS) | ||
foreach(_flag ${HPX_TARGET_COMPILE_DEFINITIONS_VAR}) | ||
target_compile_definitions(hpx INTERFACE ${_flag}) | ||
target_compile_definitions(hpx PUBLIC ${_flag}) | ||
if(HPX_WITH_DYNAMIC_HPX_MAIN AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) | ||
target_compile_definitions(hpx_wrap INTERFACE ${_flag}) | ||
target_compile_definitions(hpx_wrap PUBLIC ${_flag}) | ||
endif() | ||
if(NOT HPX_WITH_STATIC_LINKING) | ||
target_compile_definitions(hpx_init PUBLIC ${_flag}) | ||
endif() | ||
endforeach() | ||
|
||
get_property(HPX_TARGET_COMPILE_OPTIONS_VAR | ||
GLOBAL PROPERTY HPX_TARGET_COMPILE_OPTIONS) | ||
foreach(_flag ${HPX_TARGET_COMPILE_OPTIONS_VAR}) | ||
target_compile_options(hpx INTERFACE ${_flag}) | ||
target_compile_options(hpx PUBLIC ${_flag}) | ||
if(HPX_WITH_DYNAMIC_HPX_MAIN AND ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")) | ||
target_compile_options(hpx_wrap INTERFACE ${_flag}) | ||
target_compile_options(hpx_wrap PUBLIC ${_flag}) | ||
endif() | ||
if(NOT HPX_WITH_STATIC_LINKING) | ||
target_compile_options(hpx_init PUBLIC ${_flag}) | ||
endif() | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Shouldn't this happen for executables only?
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.
@hkaiser if we limit it to Executables only, then some shared objects that link to it in phylanx will throw a linker error for not defined
__real___libc_start_main
. Providing this flag to non-executables will not produce unexpected results.