From 00dacc9bef307d2695e138412263831c42499eb1 Mon Sep 17 00:00:00 2001 From: olegkkruglov <102592747+olegkkruglov@users.noreply.github.com> Date: Tue, 17 Sep 2024 05:50:27 -0700 Subject: [PATCH] Add DEPENDENTLOAD flag to vc linker on Windows (#2896) --- dev/make/compiler_definitions/vc.mkl.32e.mk | 2 ++ examples/cmake/setup_examples.cmake | 3 +++ samples/cmake/setup_samples.cmake | 3 +++ 3 files changed, 8 insertions(+) diff --git a/dev/make/compiler_definitions/vc.mkl.32e.mk b/dev/make/compiler_definitions/vc.mkl.32e.mk index de73bd6cb5a..975dc788fb9 100644 --- a/dev/make/compiler_definitions/vc.mkl.32e.mk +++ b/dev/make/compiler_definitions/vc.mkl.32e.mk @@ -30,6 +30,8 @@ CORE.SERV.COMPILER.vc = generic # Disable C4661 because of false positives COMPILER.win.vc = cl $(if $(MSVC_RT_is_release),-MD, -MDd) -nologo -EHsc -wd4661 -WX +link.dynamic.win.vc = /DEPENDENTLOADFLAG:0x2000 + p4_OPT.vc = mc3_OPT.vc = avx2_OPT.vc = -arch:AVX2 diff --git a/examples/cmake/setup_examples.cmake b/examples/cmake/setup_examples.cmake index 3f2058417c1..7d1fb3e5d50 100644 --- a/examples/cmake/setup_examples.cmake +++ b/examples/cmake/setup_examples.cmake @@ -123,6 +123,9 @@ function (add_examples examples_paths) endif() target_compile_options(${example} PRIVATE ${ONEDAL_CUSTOM_COMPILE_OPTIONS}) target_link_options(${example} PRIVATE ${ONEDAL_CUSTOM_LINK_OPTIONS}) + if(WIN32 AND "${ONEDAL_LINK}" STREQUAL "dynamic" AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC|IntelLLVM") + target_link_options(${example} PRIVATE /DEPENDENTLOADFLAG:0x2000) + endif() set_target_properties(${example} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/${CPU_ARCHITECTURE}_${LINK_TYPE}") endforeach() set_common_compiler_options() diff --git a/samples/cmake/setup_samples.cmake b/samples/cmake/setup_samples.cmake index dd7d3cc758b..abf480f02e9 100644 --- a/samples/cmake/setup_samples.cmake +++ b/samples/cmake/setup_samples.cmake @@ -108,6 +108,9 @@ function(add_samples samples_paths) target_compile_options(${sample} PRIVATE ${ONEDAL_CUSTOM_COMPILE_OPTIONS}) target_link_options(${sample} PRIVATE ${ONEDAL_CUSTOM_LINK_OPTIONS}) + if(WIN32 AND "${ONEDAL_LINK}" STREQUAL "dynamic" AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC|IntelLLVM") + target_link_options(${sample} PRIVATE /DEPENDENTLOADFLAG:0x2000) + endif() set_target_properties(${sample} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/_cmake_results/${CPU_ARCHITECTURE}_${LINK_TYPE}") add_custom_target(run_${sample}