Skip to content

Commit

Permalink
Merge pull request #100 from acts-project/WindowsComp-main-20210911
Browse files Browse the repository at this point in the history
Windows Compatibility, main branch (2021.09.11.)
  • Loading branch information
krasznaa authored Sep 11, 2021
2 parents 1b093d2 + 34fad18 commit d4b1b50
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 7 deletions.
5 changes: 5 additions & 0 deletions cmake/vecmem-compiler-options-cpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include( vecmem-functions )
# Set up the used C++ standard(s).
set( CMAKE_CXX_STANDARD 17 CACHE STRING "The (host) C++ standard to use" )

# Turn on the correct setting for the __cplusplus macro with MSVC.
if( "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC" )
vecmem_add_flag( CMAKE_CXX_FLAGS "/Zc:__cplusplus" )
endif()

# Turn on a number of warnings for the "known compilers".
if( ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" ) OR
( "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) )
Expand Down
10 changes: 7 additions & 3 deletions cmake/vecmem-functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ include( CMakeParseArguments )

# Helper function for setting up the VecMem libraries.
#
# Usage: vecmem_add_library( vecmem_core core SHARED
# Usage: vecmem_add_library( vecmem_core core
# [TYPE SHARED/STATIC]
# include/source1.hpp source2.cpp )
#
function( vecmem_add_library fullname basename type )
function( vecmem_add_library fullname basename )

# Parse the function's options.
cmake_parse_arguments( ARG "" "TYPE" "" ${ARGN} )

# Create the library.
add_library( ${fullname} ${type} ${ARGN} )
add_library( ${fullname} ${ARG_TYPE} ${ARG_UNPARSED_ARGUMENTS} )

# Set up how clients should find its headers.
target_include_directories( ${fullname} PUBLIC
Expand Down
4 changes: 4 additions & 0 deletions cmake/vecmem-googletest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ FetchContent_Declare( GoogleTest
# Options used in the build of GoogleTest.
set( BUILD_GMOCK FALSE CACHE BOOL "Turn off the build of GMock" )
set( INSTALL_GTEST FALSE CACHE BOOL "Turn off the installation of GoogleTest" )
if( WIN32 )
set( gtest_force_shared_crt TRUE CACHE BOOL
"Use shared (DLL) run-time library, even with static libraries" )
endif()

# Get it into the current directory.
FetchContent_Populate( GoogleTest )
Expand Down
9 changes: 9 additions & 0 deletions cmake/vecmem-options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ vecmem_lib_option( SYCL "Build the vecmem::sycl library" )
# Debug message output level in the code.
set( VECMEM_DEBUG_MSG_LVL 0 CACHE STRING
"Debug message output level" )

# Set the default library type, based on the platform.
set( _sharedLibDefault TRUE )
if( WIN32 )
set( _sharedLibDefault FALSE )
endif()
set( BUILD_SHARED_LIBS ${_sharedLibDefault} CACHE BOOL
"Flag for building shared/static libraries" )
unset( _sharedLibDefault )
2 changes: 1 addition & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
include( vecmem-compiler-options-cpp )

# Set up the build of the VecMem core library.
vecmem_add_library( vecmem_core core SHARED
vecmem_add_library( vecmem_core core
# STL mimicking containers.
"include/vecmem/containers/array.hpp"
"include/vecmem/containers/impl/array.ipp"
Expand Down
2 changes: 1 addition & 1 deletion cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include( vecmem-compiler-options-cuda )
find_package( CUDAToolkit REQUIRED )

# Set up the build of the VecMem CUDA library.
vecmem_add_library( vecmem_cuda cuda SHARED
vecmem_add_library( vecmem_cuda cuda
# Memory resources.
"include/vecmem/memory/cuda/device_memory_resource.hpp"
"src/memory/cuda/device_memory_resource.cpp"
Expand Down
2 changes: 1 addition & 1 deletion hip/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include( vecmem-compiler-options-hip )
find_package( HIPToolkit REQUIRED )

# Set up the build of the VecMem HIP library.
vecmem_add_library( vecmem_hip hip SHARED
vecmem_add_library( vecmem_hip hip
# Memory management.
"include/vecmem/memory/hip/device_memory_resource.hpp"
"src/memory/hip/device_memory_resource.cpp"
Expand Down
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include( vecmem-compiler-options-cpp )
include( vecmem-compiler-options-sycl )

# Set up the build of the VecMem SYCL library.
vecmem_add_library( vecmem_sycl sycl SHARED
vecmem_add_library( vecmem_sycl sycl
# Memory management.
"include/vecmem/memory/sycl/details/memory_resource_base.hpp"
"src/memory/sycl/details/memory_resource_base.sycl"
Expand Down

0 comments on commit d4b1b50

Please sign in to comment.