
# Auto-generated by CVXPYgen %DATE.
# Content: Instructions for build file generation.

cmake_minimum_required (VERSION 3.5)

project (cvxpygen)

# compiler configuration
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
    set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g")
    set (CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} -lm")
endif()
set (CMAKE_POSITION_INDEPENDENT_CODE ON)  # -fPIC
set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/out)

# subdirectory with canonical solver code
add_subdirectory (solver_code)

# list with all directories including header files, passed to parent scope
list (APPEND
      cpg_include
      ${CMAKE_CURRENT_SOURCE_DIR}/include
      ${CMAKE_CURRENT_SOURCE_DIR}/solver_code/include
)
set (cpg_include "${cpg_include}" PARENT_SCOPE)

# list with all header files, passed to parent scope
list (APPEND
      cpg_head
      ${CMAKE_CURRENT_SOURCE_DIR}/include/cpg_workspace.h
      ${CMAKE_CURRENT_SOURCE_DIR}/include/cpg_solve.h
      ${solver_head}
)
set (cpg_head "${cpg_head}" PARENT_SCOPE)

# list with all source files, passed to parent scope
list (APPEND
      cpg_src
      ${CMAKE_CURRENT_SOURCE_DIR}/src/cpg_workspace.c
      ${CMAKE_CURRENT_SOURCE_DIR}/src/cpg_solve.c
      ${solver_src}
)
set (cpg_src "${cpg_src}" PARENT_SCOPE)

# directories including header files
include_directories (${cpg_include})

# example executable target
add_executable (cpg_example ${cpg_head} ${cpg_src} ${CMAKE_CURRENT_SOURCE_DIR}/src/cpg_example.c)

# static library target for python extension module
add_library (cpg STATIC ${cpg_head} ${cpg_src})
