Skip to content

Commit cb7e338

Browse files
committed
only link with m on linux and disable fast link on win when cuda is used to avoid warnings for now (there may be a more elegant way later on)
1 parent ef08a96 commit cb7e338

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

CMakeLists.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,16 @@ endif()
401401
add_compile_options("$<$<AND:$<CONFIG:Debug,RelWithDebInfo>,$<COMPILE_LANGUAGE:CUDA>>:-G>")
402402
# add_compile_options("$<$<COMPILE_LANGUAGE:CUDA>:-G>")
403403

404-
if (CUPDLP_GPU)
405-
add_compile_options("-Wno-deprecated-declarations")
404+
if (CUPDLP_GPU AND UNIX)
405+
add_compile_options("-Wno-deprecated-declarations")
406406
endif()
407407
# add_compile_options("-Wno-implicit-function-declaration")
408408

409409
# set(CMAKE_C_FLAGS "-Wno-deprecated-declarations")
410-
set(CMAKE_C_FLAGS "-Wno-implicit-function-declaration")
410+
if (UNIX)
411+
set(CMAKE_C_FLAGS "-Wno-implicit-function-declaration")
412+
endif()
413+
411414

412415

413416
# If Visual Studio targets are being built.
@@ -424,7 +427,10 @@ if(MSVC)
424427
# add_link_options("/DEBUG:FASTLINK")
425428

426429
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/Z7>")
427-
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/DEBUG:FASTLINK>")
430+
431+
if (NOT CUPDLP_GPU)
432+
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:/DEBUG:FASTLINK>")
433+
endif()
428434

429435
if(STDCALL)
430436
# /Gz - stdcall calling convention

src/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,13 @@ else()
201201
set(CUPDLP_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/src/pdlp/cupdlp/")
202202

203203
add_subdirectory(pdlp/cupdlp/cuda)
204-
target_link_libraries(highs cudalin ${CUDA_LIBRARY} m)
204+
205+
if (WIN32)
206+
target_link_libraries(highs cudalin ${CUDA_LIBRARY})
207+
else()
208+
target_link_libraries(highs cudalin ${CUDA_LIBRARY} m)
209+
endif()
210+
205211
set_target_properties(highs PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
206212

207213
endif()

src/pdlp/cupdlp/cuda/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ target_compile_definitions(cudalin
2828
$<$<CONFIG:Debug>:CUPDLP_DEBUG>
2929
)
3030

31-
target_link_libraries(cudalin ${CUDA_LIBRARY} m)
31+
if (WIN32)
32+
target_link_libraries(cudalin ${CUDA_LIBRARY})
33+
else()
34+
target_link_libraries(cudalin ${CUDA_LIBRARY} m)
35+
endif()
3236

3337
# add a test
3438
add_executable(testcudalin test_cuda_linalg.c)

0 commit comments

Comments
 (0)