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

Debug/ams def libs #60

Draft
wants to merge 23 commits into
base: develop
Choose a base branch
from
Draft

Debug/ams def libs #60

wants to merge 23 commits into from

Conversation

koparasy
Copy link
Member

No description provided.

CMakeLists.txt Outdated
@@ -69,6 +70,7 @@ if (WITH_CUDA)
if (BUILD_SHARED_LIBS)
set(CUDA_RUNTIME_LIBRARY "Shared")
else()
set(HDF5_USE_STATIC_LIBRARIES True)
Copy link
Member Author

Choose a reason for hiding this comment

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

I think you should delete this line in the future. There is no reason we should always demand a static HDF5 if AMS is static. By deleting this you can always explicitly define it in the CLI and have better control. I prefer when possible explicit control to the user instead of implicitly defining things.

@@ -191,7 +193,7 @@ if (WITH_TORCH)
find_package(Torch REQUIRED)
# This is annoying, torch populates all my cuda flags
# and resets them
set(CMAKE_CUDA_FLAGS "")
# set(CMAKE_CUDA_FLAGS "")
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't remember why I did this in the first place. But did you maybe investigate the implications of commenting this out?

Comment on lines +258 to +349
macro(inherit_target_nostatic)
set(options)
set(singleValueArgs TO FROM OBJECT)
set(multiValueArgs)

# Parse the arguments
cmake_parse_arguments(arg "${options}" "${singleValueArgs}"
"${multiValueArgs}" ${ARGN} )

# Check arguments
if ( NOT DEFINED arg_TO )
message( FATAL_ERROR "Must provide a TO argument to the 'blt_inherit_target' macro" )
endif()

if ( NOT DEFINED arg_FROM )
message( FATAL_ERROR "Must provide a FROM argument to the 'blt_inherit_target' macro" )
endif()

set(_scope INTERFACE)

get_target_property(_interface_system_includes
${arg_FROM} INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
if ( _interface_system_includes )
target_include_directories(${arg_TO} SYSTEM ${_scope} ${_interface_system_includes})
endif()

get_target_property(_interface_includes
${arg_FROM} INTERFACE_INCLUDE_DIRECTORIES)
if ( _interface_includes )
target_include_directories(${arg_TO} ${_scope} ${_interface_includes})
endif()

get_target_property(_interface_defines
${arg_FROM} INTERFACE_COMPILE_DEFINITIONS)
if ( _interface_defines )
target_compile_definitions( ${arg_TO} ${_scope} ${_interface_defines})
endif()

if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0" )
get_target_property(_interface_link_options
${arg_FROM} INTERFACE_LINK_OPTIONS)
if ( _interface_link_options )
target_link_options( ${arg_TO} ${_scope} ${_interface_link_options})
endif()
endif()

get_target_property(_interface_compile_options
${arg_FROM} INTERFACE_COMPILE_OPTIONS)
if ( _interface_compile_options )
target_compile_options( ${arg_TO} ${_scope} ${_interface_compile_options})
endif()

if ( NOT arg_OBJECT )
#get_target_property(_interface_link_directories
# ${arg_FROM} INTERFACE_LINK_DIRECTORIES)
#if ( _interface_link_directories )
# target_link_directories( ${arg_TO} ${_scope} ${_interface_link_directories})
#endif()

#get_target_property(_interface_link_libraries
# ${arg_FROM} INTERFACE_LINK_LIBRARIES)
#if ( _interface_link_libraries )
# target_link_libraries( ${arg_TO} ${_scope} ${_interface_link_libraries})
#endif()
endif()

endmacro(inherit_target_nostatic)


if (EXCLUDE_STATIC_LIBS)
set(NONSTATIC_AMS_APP_INTERFACE_LIBRARIES "")
set(NONSTATIC_AMS_APP_PRIVATE_LIBRARIES "")
foreach (THIS_LIB ${AMS_APP_LIBRARIES})
list(APPEND NONSTATIC_AMS_APP_INTERFACE_LIBRARIES ${THIS_LIB})
if (TARGET ${THIS_LIB})
get_target_property(target_type ${THIS_LIB} TYPE)
if (NOT target_type STREQUAL STATIC_LIBRARY)
list(APPEND NONSTATIC_AMS_APP_PRIVATE_LIBRARIES ${THIS_LIB})
else()
add_library("${THIS_LIB}::nostatic" INTERFACE IMPORTED)
inherit_target_nostatic(TO "${THIS_LIB}::nostatic" FROM ${THIS_LIB})
list(APPEND NONSTATIC_AMS_APP_PRIVATE_LIBRARIES "${THIS_LIB}::nostatic")
endif()
else()
get_filename_component(THIS_EXT ${THIS_LIB} EXT)
if (NOT ".a" STREQUAL "${THIS_EXT}")
list(APPEND NONSTATIC_AMS_APP_PRIVATE_LIBRARIES ${THIS_LIB})
endif()
endif()
endforeach()
endif()

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we add a ams_macros.cmake file under cmake directory and have these macros? Not for now. Just asking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants