mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 01:49:02 +00:00
Properly version dynamic libraries and build them in the correct location
This commit is contained in:
parent
06da1528c4
commit
0ea06bfdb7
@ -134,6 +134,14 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
|
||||
target_sources(TestBuild_${name} PRIVATE ${srcs})
|
||||
else()
|
||||
add_library(TestBuild_${name} STATIC ${srcs} ${valid_hfiles})
|
||||
# Send the libraries created for test builds to their own directory so as to
|
||||
# not pollute the directory with useful libraries.
|
||||
set_target_properties(TestBuild_${name} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
RUNTIME_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
)
|
||||
|
||||
target_link_libraries(TestBuild_${name} PRIVATE vtkm_compiler_flags)
|
||||
|
||||
if(TARGET vtkm::tbb)
|
||||
@ -145,13 +153,7 @@ function(vtkm_add_header_build_test name dir_prefix use_cuda)
|
||||
target_link_libraries(TestBuild_${name} PRIVATE vtkm_diy)
|
||||
endif()
|
||||
|
||||
# Send the libraries created for test builds to their own directory so as to
|
||||
# not polute the directory with useful libraries.
|
||||
set_target_properties(TestBuild_${name} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
RUNTIME_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}/testbuilds
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
endfunction()
|
||||
@ -286,6 +288,12 @@ function(vtkm_library)
|
||||
${VTKm_LIB_TEMPLATE_SOURCES}
|
||||
${VTKm_LIB_WRAP_FOR_CUDA}
|
||||
)
|
||||
#specify where to place the built library
|
||||
set_target_properties(${test_prog} PROPERTIES
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${VTKm_LIBRARY_OUTPUT_PATH}
|
||||
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
|
||||
)
|
||||
|
||||
if(VTKm_USE_DEFAULT_SYMBOL_VISIBILITY)
|
||||
set_target_properties(${lib_name}
|
||||
@ -294,8 +302,29 @@ function(vtkm_library)
|
||||
CXX_VISIBILITY_PRESET "hidden")
|
||||
endif()
|
||||
|
||||
# Setup the SOVERSION and VERSION information for this vtkm library
|
||||
set_property(TARGET ${lib_name} PROPERTY VERSION ${VTKm_VERSION})
|
||||
set_property(TARGET ${lib_name} PROPERTY SOVERSION 1)
|
||||
|
||||
# Support custom library suffix names, for other projects wanting to inject
|
||||
# their own version numbers etc.
|
||||
if(DEFINED VTKm_CUSTOM_LIBRARY_SUFFIX)
|
||||
set(_lib_suffix "${VTKm_CUSTOM_LIBRARY_SUFFIX}")
|
||||
else()
|
||||
set(_lib_suffix "-${VTKm_VERSION_MAJOR}.${VTKm_VERSION_MINOR}")
|
||||
endif()
|
||||
set_property(TARGET ${lib_name} PROPERTY OUTPUT_NAME ${lib_name}${_lib_suffix})
|
||||
|
||||
#generate the export header and install it
|
||||
vtkm_generate_export_header(${lib_name})
|
||||
|
||||
#test and install the headers
|
||||
vtkm_declare_headers(${VTKm_LIB_HEADERS})
|
||||
|
||||
#install the template sources
|
||||
vtkm_install_template_sources(${VTKm_LIB_TEMPLATE_SOURCES})
|
||||
|
||||
#install the library itself
|
||||
install(TARGETS ${lib_name}
|
||||
EXPORT ${VTKm_EXPORT_NAME}
|
||||
ARCHIVE DESTINATION ${VTKm_INSTALL_LIB_DIR}
|
||||
@ -303,11 +332,6 @@ function(vtkm_library)
|
||||
RUNTIME DESTINATION ${VTKm_INSTALL_BIN_DIR}
|
||||
)
|
||||
|
||||
#test and install the headers
|
||||
vtkm_declare_headers(${VTKm_LIB_HEADERS})
|
||||
#install the template sources
|
||||
vtkm_install_template_sources(${VTKm_LIB_TEMPLATE_SOURCES})
|
||||
|
||||
endfunction(vtkm_library)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -132,33 +132,24 @@ include(VTKmWrappers)
|
||||
# When building VTK-m it self we want to explicitly disable compiler extensions
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
## Set the directory where the binaries will be stored
|
||||
if(NOT VTKm_EXECUTABLE_OUTPUT_PATH)
|
||||
set(VTKm_EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
endif()
|
||||
|
||||
## Set the directory where the libraries will be stored
|
||||
if(NOT VTKm_LIBRARY_OUTPUT_PATH)
|
||||
set(VTKm_LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
if (VTKm_ENABLE_TESTING)
|
||||
enable_testing()
|
||||
include(CTest)
|
||||
configure_file(${VTKm_SOURCE_DIR}/CTestCustom.cmake.in
|
||||
${VTKm_BINARY_DIR}/CTestCustom.cmake @ONLY)
|
||||
endif()
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
## Set the directory where the binaries will be stored
|
||||
set( VTKm_EXECUTABLE_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/bin
|
||||
CACHE PATH
|
||||
"Directory where all executable will be stored"
|
||||
)
|
||||
|
||||
## Set the directory where the libraries will be stored
|
||||
set( VTKm_LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/lib
|
||||
CACHE PATH
|
||||
"Directory where all the libraries will be stored"
|
||||
)
|
||||
mark_as_advanced(
|
||||
VTKm_EXECUTABLE_OUTPUT_PATH
|
||||
VTKm_LIBRARY_OUTPUT_PATH)
|
||||
|
||||
if (VTKm_ENABLE_TESTING)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Add "meta" tests that check the state of the repository
|
||||
|
@ -18,12 +18,14 @@
|
||||
## this software.
|
||||
##============================================================================
|
||||
function(add_benchmark name files)
|
||||
set(benchmarks )
|
||||
|
||||
add_executable(${name}_SERIAL ${files})
|
||||
target_link_libraries(${name}_SERIAL PRIVATE vtkm_cont)
|
||||
list(APPEND benchmarks ${name}_SERIAL)
|
||||
|
||||
if (TARGET vtkm::tbb)
|
||||
add_executable(${name}_TBB ${files})
|
||||
target_link_libraries(${name}_TBB PRIVATE vtkm_cont)
|
||||
list(APPEND benchmarks ${name}_TBB)
|
||||
endif()
|
||||
|
||||
if (TARGET vtkm::cuda)
|
||||
@ -34,8 +36,17 @@ function(add_benchmark name files)
|
||||
CONTENT "#include \"${fullpath}\"")
|
||||
|
||||
add_executable(${name}_CUDA ${CMAKE_CURRENT_BINARY_DIR}/${fname}.cu)
|
||||
target_link_libraries(${name}_CUDA PRIVATE vtkm_cont)
|
||||
list(APPEND benchmarks ${name}_CUDA)
|
||||
endif()
|
||||
|
||||
foreach(benchmark ${benchmarks})
|
||||
target_link_libraries(${benchmark} PRIVATE vtkm_cont)
|
||||
set_target_properties(${benchmark} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY ${VTKm_EXECUTABLE_OUTPUT_PATH}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
|
||||
endfunction()
|
||||
|
||||
set(benchmarks
|
||||
|
Loading…
Reference in New Issue
Block a user