vendor/scs/CMakeLists.txt in scs-0.4.1 vs vendor/scs/CMakeLists.txt in scs-0.4.2
- old
+ new
@@ -4,11 +4,11 @@
cmake_minimum_required(VERSION 3.5)
project(
scs
LANGUAGES C
- VERSION 3.2.3)
+ VERSION 3.2.6)
# Defines the CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and many other useful
# macros. See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)
@@ -119,12 +119,20 @@
# Disable all read/write functionality
option(NO_READ_WRITE "Disables all read/write functionality" OFF)
message(STATUS "Read/write functionality is NOT ${NO_READ_WRITE}")
-set(COMPILER_OPTS "-DUSE_LAPACK -DCTRLC")
+option(USE_LAPACK "Whether to use BLAS/LAPACK" ON)
+message(STATUS "BLAS/LAPACK usage is ${USE_LAPACK}")
+# Enable OpenMP support
+option(USE_OPENMP "Compile with OpenMP support" OFF)
+message(STATUS "OpenMP parallelization is ${USE_OPENMP}")
+
+set(COMPILER_OPTS "-DCTRLC")
+set(LAPACK_LINK_LIBRARIES "")
+
# Primitive types
if(SFLOAT)
set(SCS_FLOAT_TYPE "float")
set(COMPILER_OPTS "-DSFLOAT ${COMPILER_OPTS}")
else()
@@ -144,11 +152,21 @@
if(NO_READ_WRITE)
set(COMPILER_OPTS "-DNO_READ_WRITE=1 ${COMPILER_OPTS}")
endif()
+if (USE_LAPACK)
+ set(COMPILER_OPTS "-DUSE_LAPACK ${COMPILER_OPTS}")
+ list(APPEND LAPACK_LINK_LIBRARIES "blas" "lapack")
+endif()
+
+if(USE_OPENMP)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+endif()
+
message(STATUS "COMPILER_OPTS = ${COMPILER_OPTS}")
+message(STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
# TODO this is a hack that overwrites the scs_types.h file, we should find a way
# to do this that doesn't pollute the master directory.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/scs_types.h.in
${CMAKE_CURRENT_SOURCE_DIR}/include/scs_types.h NEWLINE_STYLE LF)
@@ -224,12 +242,12 @@
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/scs>")
# Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
target_compile_definitions(${${PROJECT_NAME}_DIRECT} PRIVATE ${COMPILER_OPTS})
-# The library depends on math (m) blas and lapack
-target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE m blas lapack)
+# The library depends on math (m) and (optionally) blas and lapack
+target_link_libraries(${${PROJECT_NAME}_DIRECT} PRIVATE m ${LAPACK_LINK_LIBRARIES})
# Set some properties
set_target_properties(
${${PROJECT_NAME}_DIRECT}
PROPERTIES VERSION ${scs_VERSION} PUBLIC_HEADER
@@ -272,11 +290,11 @@
# Compiled with blas and lapack, can solve LPs, SOCPs, SDPs, ECPs, and PCPs
target_compile_definitions(${${PROJECT_NAME}_INDIRECT} PRIVATE ${COMPILER_OPTS}
-DINDIRECT)
-# The library depends on math (m) blas and lapack
-target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC m blas lapack)
+# The library depends on math (m) and (optionally) blas and lapack
+target_link_libraries(${${PROJECT_NAME}_INDIRECT} PUBLIC m ${LAPACK_LINK_LIBRARIES})
# Set some properties
set_target_properties(
${${PROJECT_NAME}_INDIRECT}
PROPERTIES VERSION ${scs_VERSION} PUBLIC_HEADER