Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 25 additions & 32 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,7 @@ function(ROOT_ADD_GTEST test_suite)
set(test_exports "/EXPORT:_Init_thread_abort /EXPORT:_Init_thread_epoch \
/EXPORT:_Init_thread_footer /EXPORT:_Init_thread_header /EXPORT:_tls_index")
set_property(TARGET ${test_suite} APPEND_STRING PROPERTY LINK_FLAGS ${test_exports})
ROOT_SET_OUTPUT_DIRECTORIES(${test_suite})
endif()

if(ARG_WILLFAIL)
Expand Down Expand Up @@ -2518,6 +2519,7 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname)

set_target_properties(${targetname_libgen} PROPERTIES ${ROOT_LIBRARY_PROPERTIES})
set_target_properties(${targetname_libgen} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
ROOT_SET_OUTPUT_DIRECTORIES(${targetname_libgen})

target_link_libraries(${targetname_libgen} ${ROOT_LIBRARIES})

Expand Down Expand Up @@ -2559,16 +2561,6 @@ macro(ROOTTEST_GENERATE_DICTIONARY dictname)
FIXTURES_REQUIRED ${ARG_FIXTURES_REQUIRED})
endif()

if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
add_custom_command(TARGET ${targetname_libgen} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${dictname}_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${dictname}_rdict.pcm
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${dictname}.dll
${CMAKE_CURRENT_BINARY_DIR}/${dictname}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${dictname}.lib
${CMAKE_CURRENT_BINARY_DIR}/${dictname}.lib)
endif()

endmacro(ROOTTEST_GENERATE_DICTIONARY)

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -2620,6 +2612,7 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary)
set_target_properties(${targetname_libgen} PROPERTIES ${ROOT_LIBRARY_PROPERTIES} )
set_property(TARGET ${targetname_libgen} PROPERTY BUILD_WITH_INSTALL_RPATH OFF) # will never be installed anyway
set_target_properties(${targetname_libgen} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
ROOT_SET_OUTPUT_DIRECTORIES(${targetname_libgen})

if(ARG_LIBNAME)
set_target_properties(${targetname_libgen} PROPERTIES PREFIX "")
Expand Down Expand Up @@ -2676,18 +2669,6 @@ macro(ROOTTEST_GENERATE_REFLEX_DICTIONARY dictionary)
FIXTURES_REQUIRED ${ARG_FIXTURES_REQUIRED})
endif()

if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
if(ARG_LIBNAME)
add_custom_command(TARGET ${targetname_libgen} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${ARG_LIBNAME}.dll
${CMAKE_CURRENT_BINARY_DIR}/${ARG_LIBNAME}.dll)
else()
add_custom_command(TARGET ${targetname_libgen} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/lib${dictionary}_dictrflx.dll
${CMAKE_CURRENT_BINARY_DIR}/lib${dictionary}_dictrflx.dll)
endif()
endif()

endmacro(ROOTTEST_GENERATE_REFLEX_DICTIONARY)

#-------------------------------------------------------------------------------
Expand Down Expand Up @@ -3472,26 +3453,38 @@ function(find_python_module module)
set(PY_${module_upper}_FOUND ${PY_${module_upper}_FOUND} PARENT_SCOPE)
endfunction()

#---------------------------------------------------------------------------------------------------
# function ROOT_SET_OUTPUT_DIRECTORIES( <name> )
#
# this function simply sets the output directories from the standard outupt directory
# (CMAKE_CURRENT_BINARY_DIR/$<CONFIG>) to its parent directory (CMAKE_CURRENT_BINARY_DIR) on Windows
#
#---------------------------------------------------------------------------------------------------
function(ROOT_SET_OUTPUT_DIRECTORIES library)
if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set_target_properties(${library} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${library} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${library} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_CURRENT_BINARY_DIR})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
endif()
endfunction()

#---------------------------------------------------------------------------------------------------
# function ROOTTEST_LINKER_LIBRARY( <name> source1 source2 ...[TYPE STATIC|SHARED] [DLLEXPORT]
# [NOINSTALL] LIBRARIES library1 library2 ...
# DEPENDENCIES dep1 dep2
# BUILTINS dep1 dep2)
#
# this function simply calls the ROOT function ROOT_LINKER_LIBRARY, and add a POST_BUILD custom
# command to copy the .dll and .lib from the standard config directory (Debug/Release) to its
# parent directory (CMAKE_CURRENT_BINARY_DIR) on Windows
# this function simply calls the ROOT function ROOT_LINKER_LIBRARY, and sets the output directories
# from the standard output directory (CMAKE_CURRENT_BINARY_DIR/$<CONFIG>) to its parent directory
# (CMAKE_CURRENT_BINARY_DIR) on Windows
#
#---------------------------------------------------------------------------------------------------
function(ROOTTEST_LINKER_LIBRARY library)
ROOT_LINKER_LIBRARY(${ARGV})
if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
add_custom_command(TARGET ${library} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/lib${library}.dll
${CMAKE_CURRENT_BINARY_DIR}/lib${library}.dll
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/lib${library}.lib
${CMAKE_CURRENT_BINARY_DIR}/lib${library}.lib)
endif()
ROOT_SET_OUTPUT_DIRECTORIES(${library})
endfunction()

#---------------------------------------------------------------------------------------------------
Expand Down
10 changes: 1 addition & 9 deletions roottest/root/tree/cloning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@
# FIXME: it will be nice to move roottest-treeformula-event to CMake and add it as dependency
# To fix runtime_cxxmodules, we need to use already build artefacts.

if(MSVC)
if(CMAKE_GENERATOR MATCHES Ninja)
set(test_bin_dir "${ROOTSYS}/test")
else()
set(test_bin_dir "${ROOTSYS}/test/$<CONFIG>")
endif()
else()
set(test_bin_dir "${CMAKE_BINARY_DIR}/test")
endif()
set(test_bin_dir "${CMAKE_BINARY_DIR}/test")

ROOTTEST_ADD_TEST(hsimple-create
MACRO ${CMAKE_SOURCE_DIR}/tutorials/hsimple.C
Expand Down
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
endif()
endif()
ROOT_EXECUTABLE(eventexe MainEvent.cxx LIBRARIES Event RIO Tree TreePlayer Hist Net)
ROOT_SET_OUTPUT_DIRECTORIES(eventexe)
ROOT_ADD_TEST(test-event COMMAND eventexe)

#---guitest------------------------------------------------------------------------------------
Expand Down
6 changes: 1 addition & 5 deletions tree/tree/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ ROOT_GENERATE_DICTIONARY(ElementStructDict ElementStruct.h LINKDEF ElementStruct
ROOT_ADD_GTEST(testTOffsetGeneration TOffsetGeneration.cxx ElementStruct.cxx ElementStructDict.cxx
LIBRARIES RIO Tree MathCore
)
if(MSVC AND NOT CMAKE_GENERATOR MATCHES Ninja)
add_custom_command(TARGET testTOffsetGeneration POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libElementStructDict_rdict.pcm
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/libElementStructDict_rdict.pcm)
endif()
target_include_directories(testTOffsetGeneration PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
ROOT_STANDARD_LIBRARY_PACKAGE(SillyStruct NO_INSTALL_HEADERS HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/SillyStruct.h SOURCES SillyStruct.cxx LINKDEF SillyStructLinkDef.h DEPENDENCIES RIO)
ROOT_SET_OUTPUT_DIRECTORIES(SillyStruct)
ROOT_ADD_GTEST(testBulkApi BulkApi.cxx LIBRARIES RIO Tree TreePlayer)
#FIXME: tests are having timeout on 32bit CERN VM (in docker container everything is fine),
# to be reverted after investigation.
Expand Down
Loading