coin-or / ADOL-C

A Package for Automatic Differentiation of Algorithms Written in C/C++
Other
132 stars 25 forks source link

ADOL-C installation macbook #45

Open roosmartens opened 2 years ago

roosmartens commented 2 years ago

Hi,

I am trying to install adol-c to use with my CMake based project on my macbook. I am kind of a beginner with C++, and not sure how to use/install adol-c. Currently my CMakeLists.txt file is looking like this:

`cmake_minimum_required(VERSION 3.17) project(Thesis)

set(CMAKE_CXX_STANDARD 17)

find_package(Eigen3 3.3 REQUIRED NO_MODULE) find_package(autodiff REQUIRED) find_package(adolc REQUIRED)

add_executable(Thesis main.cpp constants.h main.h utils.cpp utils.h integration.cpp integration.h optimization.cpp optimization.h STMs.cpp STMs.h)

find_package(OpenMP REQUIRED) if (OPENMP_FOUND) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}") endif()

add_subdirectory(autodiff)

target_link_libraries (Thesis adolc Eigen3::Eigen autodiff::autodiff OpenMP::OpenMP_CXX)`

However, I get the following error message;

CMake Error at CMakeLists.txt:8 (find_package): By not providing "Findadolc.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "adolc", but CMake did not find one. Could not find a package configuration file provided by "adolc" with any of the following names: adolcConfig.cmake adolc-config.cmake Add the installation prefix of "adolc" to CMAKE_PREFIX_PATH or set "adolc_DIR" to a directory containing one of the above files. If "adolc" provides a separate development package or SDK, be sure it has been installed.

I tried using 'configure / make / make install' in the ADOL-C directory, also with different prefixes to install adol-c in different places (Thesis project root, usr/local/, etc). Any idea what I am doing wrong? Also, should I add '--with-openmp-flag=FLAG' during configuring if I want to use OpenMP with Adol-C?

Hopefully somebody can help me with this. Thanks in advance!

awalther1 commented 2 years ago

So far, ADOL-C does not come with a cmake facility. The usual way is to use the command line and the commands

configure make make install

on Linux systems. We do not have that many apply notebooks around to test the installation on a mac system. We will do so as soon as possible.

Best regards

Andrea