diff --git a/C++/ADCodeGen/CMakeLists.txt b/C++/ADCodeGen/CMakeLists.txt index f11bbaf..ceae40d 100644 --- a/C++/ADCodeGen/CMakeLists.txt +++ b/C++/ADCodeGen/CMakeLists.txt @@ -8,6 +8,7 @@ include_directories("..") #include_directories(.) include_directories(../External/Eigen) include_directories(../External/Json/include) +include_directories(../External/lib/include) add_executable(ADCodeGen ad_dynamics.cpp @@ -16,4 +17,5 @@ add_executable(ADCodeGen ../Params/params.cpp main.cpp) +target_link_libraries(ADCodeGen ${CMAKE_SOURCE_DIR}/../External/lib/lib/libcppad_lib.so) #target_link_libraries(ADCodeGen cppad_cg_RK4.so m) diff --git a/C++/CMakeLists.txt b/C++/CMakeLists.txt index b01c963..694d74b 100644 --- a/C++/CMakeLists.txt +++ b/C++/CMakeLists.txt @@ -5,11 +5,10 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_FLAGS "-O0") include_directories(.) -include_directories(External/blasfeo/lib/include) -include_directories(External/hpipm/lib/include) include_directories(External/matplotlib) include_directories(External/Eigen) include_directories(External/Json/include) +include_directories(External/lib/include) add_executable(MPCC main.cpp @@ -40,4 +39,4 @@ find_package(Python3 COMPONENTS Interpreter NumPy Development) target_include_directories(MPCC PRIVATE ${Python3_INCLUDE_DIRS}) target_link_libraries(MPCC ${Python3_LIBRARIES}) -target_link_libraries(MPCC ${CMAKE_SOURCE_DIR}/External/hpipm/lib/lib/libhpipm.a ${CMAKE_SOURCE_DIR}/External/blasfeo/lib/lib/libblasfeo.a m) +target_link_libraries(MPCC ${CMAKE_SOURCE_DIR}/External/lib/lib/libhpipm.a ${CMAKE_SOURCE_DIR}/External/lib/lib/libblasfeo.a m dl) diff --git a/C++/README.md b/C++/README.md index b4ca7dc..77bf040 100644 --- a/C++/README.md +++ b/C++/README.md @@ -44,7 +44,7 @@ To install all the dependencies run ``` ./install.sh ``` -this clones `blasfeo`, `hpipm`, `matplotlip-cpp`, `nlohmann/json`, and `eigen`, from their git repo, and safes them in a folder External. Additionally, it installs `blasfeo` and `hpipm` in the same External folder, thus no admin rights are necessary. +this clones `blasfeo`, `hpipm`, `matplotlip-cpp`, `nlohmann/json`, `eigen`, `cppad`, and `cppad-codegen` from their git repo, and safes them in a folder External. Additionally, it installs `blasfeo`, `hpipm`, `cppad`, and `cppad-codegen` in the same External folder, thus no admin rights are necessary. You may need to install `llvm` and `clang` with admin rights in order for `cppad-codegen` to build properly. Note that `matplotlib-cpp` does also require `Python-2.7` and `matplotlib`, for more details see (https://github.com/lava/matplotlib-cpp). diff --git a/C++/install.sh b/C++/install.sh index c00a405..039e455 100755 --- a/C++/install.sh +++ b/C++/install.sh @@ -29,7 +29,7 @@ git clone "$repository_hpipm" "$localFolder_hpipm" repository_matplotlib="https://github.com/lava/matplotlib-cpp.git" localFolder_matplotlib="External/matplotlib" git clone "$repository_matplotlib" "$localFolder_matplotlib" -## clone eigne +## clone eigen repository_eigen="https://gitlab.com/libeigen/eigen.git" localFolder_eigen="External/Eigen" git clone "$repository_eigen" "$localFolder_eigen" @@ -37,20 +37,43 @@ git clone "$repository_eigen" "$localFolder_eigen" repository_json="https://github.com/nlohmann/json.git" localFolder_json="External/Json" git clone "$repository_json" "$localFolder_json" - +## clone cppad +repository_cppad="https://github.com/coin-or/CppAD.git" +localFolder_cppad="External/CppAD" +git clone "$repository_cppad" "$localFolder_cppad" +## clone cppad codegen +repository_cppadcg="https://github.com/joaoleal/CppADCodeGen.git" +localFolder_cppadcg="External/CppADCodeGen" +git clone "$repository_cppadcg" "$localFolder_cppadcg" cd External/blasfeo mkdir -p build -mkdir -p lib +mkdir -p ../lib cd build -cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../lib) +cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../../lib) make make install cd ../../hpipm mkdir -p build -mkdir -p lib +mkdir -p ../lib +cd build +cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../../lib) -DBLASFEO_PATH=$(realpath ../../lib) +make +make install + +cd ../../CppAD +mkdir -p build +mkdir -p ../lib +cd build +cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../../lib) +make +make install + +cd ../../CppADCodeGen +mkdir -p build +mkdir -p ../lib cd build -cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../lib) -DBLASFEO_PATH=$(realpath ../../blasfeo/lib) +cmake .. -DCMAKE_INSTALL_PREFIX=$(realpath ../../lib) make make install