diff --git a/.circleci/config.yml b/.circleci/config.yml index 214632c3..4cf7b375 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,7 +77,7 @@ jobs: -DUSE_VALGRIND=OFF \ -DENABLE_THREAD_POOL_TESTS=OFF \ -DLLVM_VERSION=${LLVM_VERSION} \ - -DCPPAD_HOME="${curdir}/${CPPAD_INSTALL}/include" \ + -DCPPAD_HOME="${curdir}/${CPPAD_INSTALL}" \ -DEIGEN3_INCLUDE_DIR="${curdir}/${EIGEN_INSTALL}" \ .. cd test diff --git a/cmake/FindCppAD.cmake b/cmake/FindCppAD.cmake index a3062c19..1092278e 100644 --- a/cmake/FindCppAD.cmake +++ b/cmake/FindCppAD.cmake @@ -27,7 +27,7 @@ ENDIF () IF (DEFINED CPPAD_HOME) FIND_PATH(CPPAD_INCLUDE_DIR NAMES cppad/cppad.hpp - PATHS "${CPPAD_HOME}" + PATHS "${CPPAD_HOME}/include" NO_DEFAULT_PATH) FIND_LIBRARY(CPPAD_LIBRARY diff --git a/include/cppad/cg/dae_index_reduction/dummy_deriv.hpp b/include/cppad/cg/dae_index_reduction/dummy_deriv.hpp index f8d60de3..63c93441 100644 --- a/include/cppad/cg/dae_index_reduction/dummy_deriv.hpp +++ b/include/cppad/cg/dae_index_reduction/dummy_deriv.hpp @@ -429,7 +429,6 @@ class DummyDerivatives : public DaeIndexReduction { using namespace std; using std::vector; using std::map; - using std::map; auto& graph = idxIdentify_->getGraph(); //auto& vnodes = graph.variables(); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5c084f94..5fd78aec 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -168,6 +168,10 @@ FUNCTION(add_cppadcg_test source_file) IF( UNIX ) TARGET_LINK_LIBRARIES(${test_target_name} ${DL_LIBRARIES}) ENDIF() + TARGET_LINK_LIBRARIES(${test_target_name} ${CPPAD_LIBRARIES}) + TARGET_INCLUDE_DIRECTORIES(${test_target_name} PRIVATE ${CPPAD_INCLUDE_DIRS}) + TARGET_COMPILE_DEFINITIONS(${test_target_name} + PRIVATE CPPAD_CG_C_COMPILER=\"${CMAKE_C_COMPILER}\") ADD_TEST(NAME ${test_target_name} COMMAND ${test_target_name}) diff --git a/test/cppad/cg/CppADCGDynamicAtomicNestedTest.hpp b/test/cppad/cg/CppADCGDynamicAtomicNestedTest.hpp index ca8b2984..d9e91e8f 100644 --- a/test/cppad/cg/CppADCGDynamicAtomicNestedTest.hpp +++ b/test/cppad/cg/CppADCGDynamicAtomicNestedTest.hpp @@ -468,7 +468,7 @@ class CppADCGDynamicAtomicNestedTest : public CppADCGTest { * (compile source code) */ DynamicModelLibraryProcessor p(compDynHelp, "innerModel"); - GccCompiler compiler1; + GccCompiler compiler1(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler1); _dynamicLib = p.createDynamicLibrary(compiler1); @@ -514,7 +514,7 @@ class CppADCGDynamicAtomicNestedTest : public CppADCGTest { * Create the dynamic library * (compile source code) */ - GccCompiler compiler2; + GccCompiler compiler2(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler2); DynamicModelLibraryProcessor p2(compDynHelp2, "outerModel"); @@ -637,7 +637,7 @@ class CppADCGDynamicAtomicNestedTest : public CppADCGTest { * Create the dynamic library * (compile source code) */ - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); DynamicModelLibraryProcessor p(compDynHelp); diff --git a/test/cppad/cg/CppADCGDynamicAtomicTest.hpp b/test/cppad/cg/CppADCGDynamicAtomicTest.hpp index 067d3115..037bb265 100644 --- a/test/cppad/cg/CppADCGDynamicAtomicTest.hpp +++ b/test/cppad/cg/CppADCGDynamicAtomicTest.hpp @@ -763,7 +763,7 @@ class CppADCGDynamicAtomicTest : public CppADCGModelTest { * Create the dynamic library * (generate and compile source code) */ - GccCompiler compiler1; + GccCompiler compiler1(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler1); compiler1.setSourcesFolder("sources_atomiclibatomiclib_" + _modelName); compiler1.setSaveToDiskFirst(true); @@ -815,7 +815,7 @@ class CppADCGDynamicAtomicTest : public CppADCGModelTest { compDynHelp2.setVerbose(this->verbose_); DynamicModelLibraryProcessor p2(compDynHelp2, "outerModel"); - GccCompiler compiler2; + GccCompiler compiler2(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler2); compiler2.setSourcesFolder("sources_atomiclibatomiclib_" + _modelName); compiler2.setSaveToDiskFirst(true); @@ -912,7 +912,7 @@ class CppADCGDynamicAtomicTest : public CppADCGModelTest { DynamicModelLibraryProcessor p(compDynHelp); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); compiler.setSourcesFolder(folder); compiler.setSaveToDiskFirst(true); @@ -1069,7 +1069,7 @@ class CppADCGDynamicAtomicTest : public CppADCGModelTest { DynamicModelLibraryProcessor p(libSrcGen); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); compiler.setSourcesFolder(folder); compiler.setSaveToDiskFirst(true); diff --git a/test/cppad/cg/CppADCGDynamicTest.hpp b/test/cppad/cg/CppADCGDynamicTest.hpp index 6f30ab29..7db3b88e 100644 --- a/test/cppad/cg/CppADCGDynamicTest.hpp +++ b/test/cppad/cg/CppADCGDynamicTest.hpp @@ -154,7 +154,7 @@ class CppADCGDynamicTest : public CppADCGModelTest { const auto& cp = p; ASSERT_TRUE(cp.getOptions().empty()); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); //compiler.setSaveToDiskFirst(true); // useful to detect problem prepareTestCompilerFlags(compiler); if(libSourceGen.getMultiThreading() == MultiThreadingType::OPENMP) { diff --git a/test/cppad/cg/CppADCGOperationTestImpl.hpp b/test/cppad/cg/CppADCGOperationTestImpl.hpp index 1b997690..2d7b9e66 100644 --- a/test/cppad/cg/CppADCGOperationTestImpl.hpp +++ b/test/cppad/cg/CppADCGOperationTestImpl.hpp @@ -56,7 +56,7 @@ void* CppADCGOperationTest::getFunction(void * libHandle, const std::string& fun void CppADCGOperationTest::compile(const std::string& source, const std::string& library) { - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); try { diff --git a/test/cppad/cg/model/dynamiclib/dynamic_atomic_2.cpp b/test/cppad/cg/model/dynamiclib/dynamic_atomic_2.cpp index 93eb4dcb..6e198197 100644 --- a/test/cppad/cg/model/dynamiclib/dynamic_atomic_2.cpp +++ b/test/cppad/cg/model/dynamiclib/dynamic_atomic_2.cpp @@ -104,7 +104,7 @@ class CppADCGDynamicAtomic2Test : public CppADCGTest { SaveFilesModelLibraryProcessor::saveLibrarySourcesTo(compDynHelp, MODEL_NAME); DynamicModelLibraryProcessor p(compDynHelp); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); _dynamicLib = p.createDynamicLibrary(compiler); diff --git a/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse.cpp b/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse.cpp index 13a63df6..8f144a09 100644 --- a/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse.cpp +++ b/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse.cpp @@ -80,7 +80,7 @@ class CppADCGDynamicForRevTest2 : public CppADCGTest { compHelp.setCreateSparseJacobian(true); compHelp.setCreateSparseHessian(true); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); ModelLibraryCSourceGen compDynHelp(compHelp); diff --git a/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse_2.cpp b/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse_2.cpp index fec0c059..6742b987 100644 --- a/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse_2.cpp +++ b/test/cppad/cg/model/dynamiclib/dynamic_forward_reverse_2.cpp @@ -88,7 +88,7 @@ class CppADCGDynamicForRevTest : public CppADCGTest { compHelp.setCreateSparseJacobian(true); compHelp.setCreateSparseHessian(true); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); ModelLibraryCSourceGen compDynHelp(compHelp); diff --git a/test/cppad/cg/models/collocation.hpp b/test/cppad/cg/models/collocation.hpp index 87eb608c..d00ba59e 100644 --- a/test/cppad/cg/models/collocation.hpp +++ b/test/cppad/cg/models/collocation.hpp @@ -279,7 +279,7 @@ class CollocationModel : public PatternTestModel { //SaveFilesModelLibraryProcessor::saveLibrarySourcesTo(compDynHelpL, "sources_" + lName); DynamicModelLibraryProcessor p(compDynHelpL, lName); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); compiler.setSourcesFolder("sources_" + lName); compiler.setSaveToDiskFirst(true); diff --git a/test/cppad/cg/patterns/CppADCGPatternTest.hpp b/test/cppad/cg/patterns/CppADCGPatternTest.hpp index e414df98..f97f96a5 100644 --- a/test/cppad/cg/patterns/CppADCGPatternTest.hpp +++ b/test/cppad/cg/patterns/CppADCGPatternTest.hpp @@ -404,7 +404,7 @@ class CppADCGPatternTest : public CppADCGTest { if (!customHessSparsity_.empty()) compHelpL.setCustomSparseHessianElements(customHessSparsity_); - GccCompiler compiler; + GccCompiler compiler(CPPAD_CG_C_COMPILER); prepareTestCompilerFlags(compiler); compiler.setSourcesFolder("sources_" + libBaseName); compiler.setSaveToDiskFirst(true);