-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
48 lines (43 loc) · 1.77 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.24)
project(CUPDLP VERSION 0.0.1)
option(BUILD_CUDA "<BUILD_CUDA_OR_NOT>" OFF)
option(BUILD_APPS "<BUILD_APPS_OR_NOT>" OFF)
option(BUILD_PYTHON "<BUILD_PYTHON_OR_NOT>" OFF)
message(NOTICE "----------------------- cuPDLP-C ------------------------")
enable_language(C CXX)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
string(REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "-O3" "-O2" CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
message("reset release flags: ${CMAKE_C_FLAGS_RELEASE}")
message(NOTICE "--------------------- cuPDLP CPU/GPU CONFIG -----------------------")
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
message(NOTICE "-- Sets build with CUDA ${BUILD_CUDA}")
if (${BUILD_CUDA} STREQUAL "ON")
include(FindCUDAConf.cmake)
else ()
set(CUDA_LIBRARY-NOTFOUND true)
endif ()
# add subdirectories
add_subdirectory(cupdlp)
add_subdirectory(interface)
add_subdirectory(third-party)
message(NOTICE "-- Sets build applications ${BUILD_APPS}")
if (${BUILD_APPS} STREQUAL "ON")
add_subdirectory(apps)
endif ()
message(NOTICE "-- Sets build PYTHON ${BUILD_PYTHON}")
if (${BUILD_PYTHON} STREQUAL "ON")
add_subdirectory("pycupdlp")
else ()
set(CUDA_LIBRARY-NOTFOUND true)
endif ()