[CI] standardize else() and enfunction() calls in CMake scripts (#9653)
This commit is contained in:
parent
084d89216c
commit
2e42f33fc1
@ -269,7 +269,7 @@ endif()
|
||||
#-- library
|
||||
if (BUILD_STATIC_LIB)
|
||||
add_library(xgboost STATIC)
|
||||
else (BUILD_STATIC_LIB)
|
||||
else()
|
||||
add_library(xgboost SHARED)
|
||||
endif()
|
||||
target_link_libraries(xgboost PRIVATE objxgboost)
|
||||
@ -365,10 +365,10 @@ if (BUILD_STATIC_LIB)
|
||||
else()
|
||||
set(INSTALL_TARGETS xgboost objxgboost dmlc)
|
||||
endif()
|
||||
else (BUILD_STATIC_LIB)
|
||||
else()
|
||||
if (BUILD_DEPRECATED_CLI)
|
||||
set(INSTALL_TARGETS xgboost runxgboost)
|
||||
else(BUILD_DEPRECATED_CLI)
|
||||
else()
|
||||
set(INSTALL_TARGETS xgboost)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -13,4 +13,4 @@ function (run_doxygen)
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generate C APIs documentation."
|
||||
VERBATIM)
|
||||
endfunction (run_doxygen)
|
||||
endfunction()
|
||||
|
||||
@ -19,4 +19,4 @@ function (find_prefetch_intrinsics)
|
||||
" XGBOOST_BUILTIN_PREFETCH_PRESENT)
|
||||
set(XGBOOST_MM_PREFETCH_PRESENT ${XGBOOST_MM_PREFETCH_PRESENT} PARENT_SCOPE)
|
||||
set(XGBOOST_BUILTIN_PREFETCH_PRESENT ${XGBOOST_BUILTIN_PREFETCH_PRESENT} PARENT_SCOPE)
|
||||
endfunction (find_prefetch_intrinsics)
|
||||
endfunction()
|
||||
|
||||
@ -11,7 +11,7 @@ function(auto_source_group SOURCES)
|
||||
|
||||
source_group("${GROUP}" FILES "${FILE}")
|
||||
endforeach()
|
||||
endfunction(auto_source_group)
|
||||
endfunction()
|
||||
|
||||
# Force static runtime for MSVC
|
||||
function(msvc_use_static_runtime)
|
||||
@ -50,7 +50,7 @@ function(msvc_use_static_runtime)
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction(msvc_use_static_runtime)
|
||||
endfunction()
|
||||
|
||||
# Set output directory of target, ignoring debug or release
|
||||
function(set_output_directory target dir)
|
||||
@ -70,7 +70,7 @@ function(set_output_directory target dir)
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${dir}
|
||||
ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${dir}
|
||||
ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${dir})
|
||||
endfunction(set_output_directory)
|
||||
endfunction()
|
||||
|
||||
# Set a default build type to release if none was specified
|
||||
function(set_default_configuration_release)
|
||||
@ -80,7 +80,7 @@ function(set_default_configuration_release)
|
||||
message(STATUS "Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE )
|
||||
endif()
|
||||
endfunction(set_default_configuration_release)
|
||||
endfunction()
|
||||
|
||||
# Generate nvcc compiler flags given a list of architectures
|
||||
# Also generates PTX for the most recent architecture for forwards compatibility
|
||||
@ -122,7 +122,7 @@ function(format_gencode_flags flags out)
|
||||
set(${out} "${${out}}" PARENT_SCOPE)
|
||||
message(STATUS "CUDA GEN_CODE: ${GEN_CODE}")
|
||||
endif()
|
||||
endfunction(format_gencode_flags flags)
|
||||
endfunction()
|
||||
|
||||
# Set CUDA related flags to target. Must be used after code `format_gencode_flags`.
|
||||
function(xgboost_set_cuda_flags target)
|
||||
@ -154,7 +154,7 @@ function(xgboost_set_cuda_flags target)
|
||||
if (USE_DEVICE_DEBUG)
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<AND:$<CONFIG:DEBUG>,$<COMPILE_LANGUAGE:CUDA>>:-G;-src-in-ptx>)
|
||||
else (USE_DEVICE_DEBUG)
|
||||
else()
|
||||
target_compile_options(${target} PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:CUDA>:-lineinfo>)
|
||||
endif()
|
||||
@ -179,7 +179,7 @@ function(xgboost_set_cuda_flags target)
|
||||
CUDA_STANDARD_REQUIRED ON
|
||||
CUDA_SEPARABLE_COMPILATION OFF
|
||||
CUDA_RUNTIME_LIBRARY Static)
|
||||
endfunction(xgboost_set_cuda_flags)
|
||||
endfunction()
|
||||
|
||||
macro(xgboost_link_nccl target)
|
||||
if (BUILD_STATIC_LIB)
|
||||
@ -191,7 +191,7 @@ macro(xgboost_link_nccl target)
|
||||
target_compile_definitions(${target} PRIVATE -DXGBOOST_USE_NCCL=1)
|
||||
target_link_libraries(${target} PRIVATE ${NCCL_LIBRARY})
|
||||
endif()
|
||||
endmacro(xgboost_link_nccl)
|
||||
endmacro()
|
||||
|
||||
# compile options
|
||||
macro(xgboost_target_properties target)
|
||||
@ -233,7 +233,7 @@ macro(xgboost_target_properties target)
|
||||
if (WIN32 AND MINGW)
|
||||
target_compile_options(${target} PUBLIC -static-libstdc++)
|
||||
endif()
|
||||
endmacro(xgboost_target_properties)
|
||||
endmacro()
|
||||
|
||||
# Custom definitions used in xgboost.
|
||||
macro(xgboost_target_defs target)
|
||||
@ -260,7 +260,7 @@ macro(xgboost_target_defs target)
|
||||
if (PLUGIN_RMM)
|
||||
target_compile_definitions(objxgboost PUBLIC -DXGBOOST_USE_RMM=1)
|
||||
endif()
|
||||
endmacro(xgboost_target_defs)
|
||||
endmacro()
|
||||
|
||||
# handles dependencies
|
||||
macro(xgboost_target_link_libraries target)
|
||||
@ -298,4 +298,4 @@ macro(xgboost_target_link_libraries target)
|
||||
if (MINGW)
|
||||
target_link_libraries(${target} PRIVATE wsock32 ws2_32)
|
||||
endif()
|
||||
endmacro(xgboost_target_link_libraries)
|
||||
endmacro()
|
||||
|
||||
@ -3,4 +3,4 @@ function (write_version)
|
||||
configure_file(
|
||||
${xgboost_SOURCE_DIR}/cmake/version_config.h.in
|
||||
${xgboost_SOURCE_DIR}/include/xgboost/version_config.h @ONLY)
|
||||
endfunction (write_version)
|
||||
endfunction()
|
||||
|
||||
@ -66,7 +66,7 @@ function(create_rlib_for_msvc)
|
||||
execute_process(COMMAND ${DLLTOOL_EXE}
|
||||
"--input-def" "${CMAKE_CURRENT_BINARY_DIR}/R.def"
|
||||
"--output-lib" "${CMAKE_CURRENT_BINARY_DIR}/R.lib")
|
||||
endfunction(create_rlib_for_msvc)
|
||||
endfunction()
|
||||
|
||||
|
||||
# detection for OSX
|
||||
|
||||
@ -3,7 +3,7 @@ if (USE_DMLC_GTEST)
|
||||
message(FATAL_ERROR "USE_DMLC_GTEST=ON but dmlc-core didn't bundle gtest")
|
||||
endif()
|
||||
set(GTEST_LIBRARIES gtest)
|
||||
else (USE_DMLC_GTEST)
|
||||
else()
|
||||
find_package(GTest REQUIRED)
|
||||
endif()
|
||||
file(GLOB_RECURSE TEST_SOURCES "*.cc")
|
||||
@ -21,7 +21,7 @@ endif()
|
||||
if (PLUGIN_FEDERATED)
|
||||
target_include_directories(testxgboost PRIVATE ${xgboost_SOURCE_DIR}/plugin/federated)
|
||||
target_link_libraries(testxgboost PRIVATE federated_client)
|
||||
else (PLUGIN_FEDERATED)
|
||||
else()
|
||||
file(GLOB_RECURSE FEDERATED_TEST_SOURCES "plugin/*_federated_*.*")
|
||||
list(REMOVE_ITEM TEST_SOURCES ${FEDERATED_TEST_SOURCES})
|
||||
endif()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user