Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake and Eigen3 #15

Merged
merged 21 commits into from
Jul 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6360e77
initial CMake files
schulz0r Jul 17, 2020
7298dad
adolc is automatically added to this project in case it is not instal…
schulz0r Jul 18, 2020
05bf9cc
do not include <mem.h> when using MacOS X because header is unknown t…
schulz0r Jul 20, 2020
8b3ed5b
added f2c header from dmatrix library so that fortran types are recog…
schulz0r Jul 20, 2020
0e62c86
min() was not defined, changed to std::min
schulz0r Jul 20, 2020
226448b
added include directories for adolc. adolc header does not compile wh…
schulz0r Jul 20, 2020
872841b
added IPOPT header so that Ipopt::ApplicationReturnStatus::Solve_Succ…
schulz0r Jul 20, 2020
4d76bad
ipopt is now correctly added to the project
schulz0r Jul 20, 2020
1ce42b4
removed empty class declarations for DMatrix and its sparse equivalent
schulz0r Jul 20, 2020
ec7fbc5
now sparse option is enabled for adolc
schulz0r Jul 20, 2020
7229c1a
added options to build docs and examples
schulz0r Jul 20, 2020
3562af1
added executables for each example
schulz0r Jul 20, 2020
b5158b6
sparse matrix class has been moved to its own file
schulz0r Jul 21, 2020
c7723d8
added implementation for matrix functions which have been deprived of…
schulz0r Jul 21, 2020
2dd3689
removed code from sparse matrix
schulz0r Jul 21, 2020
c20b13e
moved the last chunk of sparse matrix code to sparsematrix.cxx
schulz0r Jul 21, 2020
765b4ab
added suite sparse and lusol to project
schulz0r Jul 23, 2020
a7f3e43
added sparse matrix header
schulz0r Jul 23, 2020
47b7c8a
removed dmatrix to make place for Eigen3
schulz0r Jul 24, 2020
0ee4047
added option to include examples. fixed example cmake lists
schulz0r Jul 24, 2020
45f106a
deleted invalid cmake files and Makefiles
schulz0r Jul 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
# Compiled Object files
*.slo
*.lo
Expand Down
15 changes: 15 additions & 0 deletions CMakeLists-adolc.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.8.2)

project(adolc-download NONE)

include(ExternalProject)
ExternalProject_Add(adolc
GIT_REPOSITORY https://github.com/coin-or/ADOL-C.git
GIT_TAG master
BUILD_IN_SOURCE ON
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/adolc-src"
CONFIGURE_COMMAND autoreconf -fi && ./configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/adolc-build --enable-sparse
BUILD_COMMAND make -j3
INSTALL_COMMAND make install
TEST_COMMAND ""
)
44 changes: 44 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required (VERSION 3.10)
project(PSOPT VERSION 4.0.1 LANGUAGES CXX)

option(BUILD_EXAMPLES "Build examples from the example subdirectory." OFF)

find_package(Eigen3 REQUIRED NO_MODULE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(adolc adolc)
pkg_check_modules(ipopt REQUIRED ipopt)

if(NOT TARGET ${adolc})
message(STATUS "ADOL-C will be downloaded and added to the project...")
# Download and unpack adolc at configure time
configure_file(CMakeLists-adolc.txt.in adolc-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/adolc-download )
if(result)
message(FATAL_ERROR "CMake step for adolc failed: ${result}")
endif()
execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/adolc-download )
if(result)
message(FATAL_ERROR "Build step for adolc failed: ${result}")
endif()

add_library(adolc SHARED IMPORTED)
target_include_directories(adolc INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/adolc-build/include/)
set_target_properties(adolc PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/adolc-build/lib64)

set(CMAKE_CXX_FLAGS "-std=c++11")
endif()

file(GLOB SRC src/*.cxx)
file(GLOB HEADER "src/*.h")

add_library(${PROJECT_NAME} ${SRC} ${HEADER})
target_include_directories(${PROJECT_NAME} PUBLIC src/ PRIVATE ${ipopt_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC adolc ${ipopt_LIBRARIES} PRIVATE Eigen3::Eigen)

if(${BUILD_EXAMPLES})
add_subdirectory(examples/)
endif()
199 changes: 0 additions & 199 deletions Makefile

This file was deleted.

92 changes: 0 additions & 92 deletions Makefile.cxsparse.vc

This file was deleted.

Loading