Commit ccdb3334 authored by Dominik Bongartz's avatar Dominik Bongartz
Browse files

Release version v0.5.0

parent 13bbd7a7
Pipeline #486983 skipped
......@@ -3,3 +3,4 @@ Build/
_skbuild/
*.egg-info/
dist/
MANIFEST
stages:
- build
- test
- deploy
build_windows:
stage: build
tags:
- windows
- maingo
variables:
GIT_STRATEGY: clone
before_script:
- git submodule init
- git submodule update
script:
- mkdir build
- '$env:path += ";C:\Program Files\cmake\bin"'
- cmake -B build -G "Visual Studio 15 2017" -A x64 -D MAiNGO_build_test=TRUE -D MAiNGO_build_python_interface=TRUE -D MAiNGO_build_parser=false
- cd build
- cmake --build . --config Release -j4
- cd ..
artifacts:
paths:
- build/Release/
exclude:
- build/Release/*.lib
- build/Release/**/*.exp
- build/Release/**/*.lib
test_windows:
stage: test
needs: [build_windows]
tags:
- windows
- maingo
script:
- cd build\Release
- .\test-maingo.exe
- py testMaingopy.py
build_linux:
stage: build
tags:
- linux
variables:
GIT_STRATEGY: clone
before_script:
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- git submodule init
- ./switchToSsh
- git submodule update -j 1
script:
- mkdir build
- cd build
- cmake -S .. -D MAiNGO_build_test=TRUE -D MAiNGO_build_python_interface=TRUE -D MAiNGO_build_parser=false
- make -j4
- cd ..
artifacts:
paths:
- build/test-maingo
- build/maingopy/
- build/testMaingopy.py
- build/individualPythonTests/
test_linux:
stage: test
needs: [build_linux]
tags:
- linux
script:
- cd build
- ./test-maingo
- python3 testMaingopy.py
pages:
stage: deploy
needs:
- job: test_windows
artifacts: false
- job: test_linux
artifacts: false
tags:
- linux
script:
- cd doc
- doxygen Doxyfile
- mv html ../public
- cd ..
artifacts:
paths:
- public
only:
- master
\ No newline at end of file
[submodule "dep/filib"]
path = dep/filib
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/filib.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/filib.git
[submodule "dep/nlopt"]
path = dep/nlopt
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/nlopt.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/nlopt.git
[submodule "dep/fadbad"]
path = dep/fadbad
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/fadbad.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/fadbad.git
[submodule "dep/cpplapack"]
path = dep/cpplapack
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/cpplapack.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/cpplapack.git
[submodule "dep/ipopt"]
path = dep/ipopt
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/ipopt.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/ipopt.git
[submodule "dep/mumps"]
path = dep/mumps
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/mumps.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/mumps.git
[submodule "dep/blas"]
path = dep/blas
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/blas.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/blas.git
[submodule "dep/lapack"]
path = dep/lapack
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/lapack.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/lapack.git
[submodule "dep/knitro"]
path = dep/knitro
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/knitro.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/knitro.git
[submodule "dep/cplex"]
path = dep/cplex
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/cplex.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/cplex.git
[submodule "dep/clp"]
path = dep/clp
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/clp.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/clp.git
[submodule "dep/json"]
path = dep/json
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/json.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/json.git
[submodule "dep/pybind11"]
path = dep/pybind11
url = https://github.com/pybind/pybind11
[submodule "dep/babbase"]
path = dep/babbase
url = https://git.rwth-aachen.de/avt.svt/public/babbase.git
[submodule "dep/melon"]
path = dep/melon
url = https://git.rwth-aachen.de/avt.svt/public/melon.git
[submodule "dep/libale"]
path = dep/libale
url = https://git.rwth-aachen.de/avt.svt/public/libale.git
url = https://git.rwth-aachen.de/avt-svt/public/libale.git
[submodule "dep/melon"]
path = dep/melon
url = https://git.rwth-aachen.de/avt-svt/public/melon.git
[submodule "dep/babbase"]
path = dep/babbase
url = https://git.rwth-aachen.de/avt-svt/public/babbase.git
[submodule "dep/mcpp"]
path = dep/mcpp
url = https://git.rwth-aachen.de/avt.svt/public/thirdparty/mcpp.git
url = https://git.rwth-aachen.de/avt-svt/public/thirdparty/mcpp.git
cmake_minimum_required(VERSION 3.15)
project(MAiNGO CXX)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/MAiNGOversion.cmake)
project(MAiNGO
VERSION ${MAiNGO_VERSION}
LANGUAGES CXX)
#--------------------------- Options --------------------------------
set(MAiNGO_build_standalone FALSE CACHE BOOL "Build MAiNGO as standalone solver with problem.h.")
set(MAiNGO_build_parser TRUE CACHE BOOL "Build MAiNGO executable with parser (not compatible with Intel compiler due to missing C++17 features).")
set(MAiNGO_build_python_interface FALSE CACHE BOOL "Build a Python extension module for calling MAiNGO from Python.")
set(MAiNGO_build_test FALSE CACHE BOOL "Build MAiNGO test cases.")
set(MAiNGO_use_melon TRUE CACHE BOOL "Build MAiNGO executable with the MeLOn toolbox (not compatible with Intel compiler due to missing C++17 features).")
#--------------------------- Settings --------------------------------
set(MAiNGO_use_melon TRUE CACHE BOOL "Build MAiNGO executable with the MeLOn toolbox.")
set(MAiNGO_use_cplex TRUE CACHE BOOL "Use CPLEX if it is available on the system.")
set(MAiNGO_use_knitro TRUE CACHE BOOL "Use KNITRO if it is available on the system.")
set(MAiNGO_use_mpi FALSE CACHE BOOL "Build parallel version of MAiNGO.")
set(MAiNGO_build_python_interface FALSE CACHE BOOL "Build the Python package 'maingopy' that allows to call MAiNGO from Python.")
set(MAiNGO_build_standalone FALSE CACHE BOOL "Build MAiNGOcpp executable as standalone solver with problem.h.")
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(MAiNGO_build_parser TRUE CACHE BOOL "Build MAiNGO executable with parser.")
set(MAiNGO_build_test TRUE CACHE BOOL "Build MAiNGO test cases.")
else()
set(MAiNGO_build_parser FALSE CACHE BOOL "Build MAiNGO executable with parser.")
set(MAiNGO_build_test FALSE CACHE BOOL "Build MAiNGO test cases.")
endif()
#------------------------ MAiNGO library -----------------------------
include(${PROJECT_SOURCE_DIR}/cmake/MAiNGOsourceFiles.cmake)
#------------------------ Adjust settings when building with scikit-build -----------------------------
if(SKBUILD)
message(STATUS "The project is built using scikit-build, also building Python interface.")
# Enforce use of Python interface
set(MAiNGO_build_python_interface TRUE CACHE INTERNAL "" FORCE)
set(MAiNGO_use_cplex FALSE CACHE INTERNAL "" FORCE)
set(MAiNGO_use_knitro FALSE CACHE INTERNAL "" FORCE)
# Default: disable use of CPLEX and KNITRO
message(STATUS "Not using CPLEX and KNITRO even if they are available. If you still want to use them, you need to explicitly enable the corresponding CMake options.")
set(MAiNGO_use_cplex FALSE CACHE BOOL "Use CPLEX if it is available on the system." FORCE)
set(MAiNGO_use_knitro FALSE CACHE BOOL "Use KNITRO if it is available on the system." FORCE)
# Disable stuff that is not compatible with the Python package to be installed
set(MAiNGO_use_mpi FALSE CACHE INTERNAL "" FORCE)
set(MAiNGO_build_standalone FALSE CACHE INTERNAL "" FORCE)
set(MAiNGO_build_parser FALSE CACHE INTERNAL "" FORCE)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(BUILD_SHARED_LIBS FALSE CACHE INTERNAL "" FORCE)
set(MAiNGO_build_test FALSE CACHE INTERNAL "" FORCE)
set(BLAS_usePrecompiledDll FALSE CACHE INTERNAL "" FORCE)
set(LAPACK_usePrecompiledDlls FALSE CACHE INTERNAL "" FORCE)
set(MUMPS_usePrecompiledDll FALSE CACHE INTERNAL "" FORCE)
# Force required settings
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(BUILD_SHARED_LIBS FALSE CACHE INTERNAL "" FORCE)
endif()
if(MAiNGO_build_python_interface)
# if building the python interface, the generated module needs PIC, even if building static libraries
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
#------------------------ MAiNGO library -----------------------------
include(${PROJECT_SOURCE_DIR}/cmake/MAiNGOsourceFiles.cmake)
add_library(maingo-core ${MAiNGO_SRC})
if(WIN32 AND BUILD_SHARED_LIBS)
set_target_properties(maingo-core PRIVATE WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
target_include_directories(maingo-core PUBLIC ${PROJECT_SOURCE_DIR}/inc)
configure_file(${PROJECT_SOURCE_DIR}/inc/version.h.in maingo-core/version.h)
target_include_directories(maingo-core
PUBLIC
${PROJECT_SOURCE_DIR}/inc
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/maingo-core
)
target_compile_features(maingo-core PRIVATE cxx_std_14)
if(MSVC)
target_compile_options(maingo-core PRIVATE /MP;/Qpar)
......@@ -69,9 +93,6 @@ target_link_libraries(maingo-core
ipopt
clp
)
if(MAiNGO_use_melon)
target_link_libraries(maingo-core PUBLIC melon)
endif()
if(MAiNGO_build_parser)
add_library(parser STATIC ${PARSER_SRC})
target_include_directories(parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
......@@ -80,6 +101,9 @@ if(MAiNGO_build_parser)
target_link_libraries(maingo-core PUBLIC parser)
target_compile_definitions(maingo-core PUBLIC HAVE_MAiNGO_PARSER)
endif()
if(MAiNGO_use_melon)
target_link_libraries(maingo-core PUBLIC melon)
endif()
if(MAiNGO_use_knitro)
# knitro always needs to be linked after all other math-related libraries because of incompatibility with several math routines
target_link_libraries(maingo-core PRIVATE knitro)
......@@ -92,7 +116,7 @@ if(MAiNGO_use_mpi)
endif()
#----------------- If this is the top level, include dependencies and build executable --------------------
#----------------- If this is the top level, include dependencies --------------------
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# --------------- Dependencies ---------------------------
......@@ -112,10 +136,6 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
add_dependency_subdir(nlopt)
add_dependency_subdir(clp)
add_dependency_subdir(filib)
if(MAiNGO_use_melon)
add_dependency_subdir(melon)
add_dependency_subdir(json)
endif()
if(MAiNGO_build_parser)
add_dependency_subdir(libale)
endif()
......@@ -135,6 +155,13 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
endif()
add_dependency_subdir(pybind11)
endif()
if(MAiNGO_use_melon) # Melon needs to go after pybind11, since it's CMakeLists.txt need pybind11_add_module if using the Python interface of MeLOn
if(MAiNGO_build_python_interface)
set(MeLOn_build_python_interface TRUE CACHE BOOL "" FORCE)
endif()
add_dependency_subdir(melon)
add_dependency_subdir(json)
endif()
message("Done configuring dependencies.")
message("=================================================================")
message("=================================================================")
......@@ -146,135 +173,173 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
# --------- Setup the Executable/.dll output Directory -------------
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR} CACHE PATH "Single Directory for all Executables.")
# --------------- MAiNGO executable (using ALE parser) ---------------------------
if (MAiNGO_build_parser)
add_executable(MAiNGO ${PROJECT_SOURCE_DIR}/examples/mainAleParser.cpp)
target_link_libraries(MAiNGO PRIVATE maingo-core)
target_compile_features(MAiNGO PRIVATE cxx_std_17)
if(MSVC)
target_compile_options(MAiNGO PRIVATE /MP;/Qpar)
set_target_properties(MAiNGO PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
else()
target_compile_options(MAiNGO
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
endif()
# --------------- MAiNGO executable (using ALE parser) ---------------------------
if (MAiNGO_build_parser)
add_executable(MAiNGO ${PROJECT_SOURCE_DIR}/examples/mainAleParser.cpp)
target_link_libraries(MAiNGO PRIVATE maingo-core)
target_compile_features(MAiNGO PRIVATE cxx_std_17)
if(MSVC)
target_compile_options(MAiNGO PRIVATE /MP;/Qpar)
set_target_properties(MAiNGO PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
else()
target_compile_options(MAiNGO
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
# --------------- Standalone MAiNGO executable (for C++ API) ---------------------------
if (MAiNGO_build_standalone)
add_executable(MAiNGOcpp ${PROJECT_SOURCE_DIR}/examples/mainCppApi.cpp)
target_link_libraries(MAiNGOcpp PRIVATE maingo-core)
target_compile_features(MAiNGOcpp PRIVATE cxx_std_14)
if(MSVC)
target_compile_options(MAiNGOcpp PRIVATE /MP;/Qpar)
set_target_properties(MAiNGOcpp PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
else()
target_compile_options(MAiNGOcpp
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
endif()
# --------------- Standalone MAiNGO executable (for C++ API) ---------------------------
if (MAiNGO_build_standalone)
add_executable(MAiNGOcpp ${PROJECT_SOURCE_DIR}/examples/mainCppApi.cpp)
target_link_libraries(MAiNGOcpp PRIVATE maingo-core)
target_compile_features(MAiNGOcpp PRIVATE cxx_std_14)
if(MSVC)
target_compile_options(MAiNGOcpp PRIVATE /MP;/Qpar)
set_target_properties(MAiNGOcpp PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
else()
target_compile_options(MAiNGOcpp
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
# --------------- Python interface ---------------------------
if(MAiNGO_build_python_interface)
if(MSVC)
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release)
else()
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
endif()
pybind11_add_module(_pymaingo pymaingo/_pymaingo.cpp)
target_compile_features(_pymaingo PRIVATE cxx_std_14)
target_link_libraries(_pymaingo PRIVATE maingo-core)
target_compile_options(_pymaingo PRIVATE $<$<CXX_COMPILER_ID:AppleClang>: -fvisibility=default>)
if(SKBUILD)
install(TARGETS maingo-core DESTINATION . )
install(TARGETS _pymaingo DESTINATION .)
else()
set_target_properties(_pymaingo PROPERTIES
LIBRARY_OUTPUT_DIRECTORY $<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/pymaingo
)
add_custom_target(pymaingo ALL
COMMAND ${CMAKE_COMMAND} -E make_directory
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/pymaingo
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/pymaingo/__init__.py
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/pymaingo
)
if(${BLAS_usePrecompiledDll})
add_custom_target(copyBlasDllPymaingo ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/blasd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/blas.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/pymaingo/blasd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/pymaingo/blas.dll>)
add_dependencies(copyBlasDllPymaingo copyBlasDll)
endif()
if(${LAPACK_usePrecompiledDlls})
add_custom_target(copyLapackDllPymaingo ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/lapackd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/lapack.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/pymaingo/lapackd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/pymaingo/lapack.dll>)
add_dependencies(copyLapackDllPymaingo copyLapackDll)
endif()
if(${MUMPS_usePrecompiledDll})
add_custom_target(copyMumpsDllPymaingo ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/mumpsd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/mumps.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/pymaingo/mumpsd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/pymaingo/mumps.dll>)
add_dependencies(copyMumpsDllPymaingo copyMumpsDll)
endif()
endif()
endif()
# --------------- Python interface ---------------------------
if(MAiNGO_build_python_interface)
# Get output directories right
if(MSVC)
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug)
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release)
else()
set(RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR})
set(RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR})
endif()
# Create target for _maingopy extension module
pybind11_add_module(_maingopy maingopy/_maingopy.cpp)
target_compile_features(_maingopy PRIVATE cxx_std_14)
target_link_libraries(_maingopy PRIVATE maingo-core)
target_compile_options(_maingopy PRIVATE $<$<CXX_COMPILER_ID:AppleClang>: -fvisibility=default>)
# --------------- MAiNGO Tests ---------------------------
if(MAiNGO_build_test)
add_executable(test-maingo ${PROJECT_SOURCE_DIR}/tests/testProblems/main.cpp)
target_link_libraries(test-maingo PRIVATE maingo-core)
target_compile_features(test-maingo PRIVATE cxx_std_17)
if(MSVC)
target_compile_options(test-maingo PRIVATE /MP;/Qpar)
set_target_properties(test-maingo PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
# Create target for maingopy package
if(SKBUILD)
install(TARGETS maingo-core DESTINATION . )
install(TARGETS _maingopy DESTINATION .)
if(MAiNGO_use_melon AND MeLOn_build_python_interface)
install(TARGETS melonpy DESTINATION .)
install(FILES ${PROJECT_SOURCE_DIR}/maingopy/__init__maingopy_and_melonpy.py.in DESTINATION . RENAME __init__.py)
else()
target_compile_options(test-maingo
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
if (MAiNGO_build_python_interface)
set(PYTHON_TEST_DIR ${PROJECT_SOURCE_DIR}/pymaingo/tests)
add_custom_target(test-pymaingo ALL
COMMAND ${CMAKE_COMMAND} -E copy
${PYTHON_TEST_DIR}/testPyMAiNGO.py
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>
else()
set_target_properties(_maingopy PROPERTIES
LIBRARY_OUTPUT_DIRECTORY $<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
ARCHIVE_OUTPUT_DIRECTORY $<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
)
if(MAiNGO_use_melon AND MeLOn_build_python_interface)
set_target_properties(melonpy PROPERTIES
LIBRARY_OUTPUT_DIRECTORY $<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
ARCHIVE_OUTPUT_DIRECTORY $<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
)
add_custom_target(maingopy ALL
COMMAND ${CMAKE_COMMAND} -E make_directory
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
COMMAND ${CMAKE_COMMAND} -E copy
${PYTHON_TEST_DIR}/individualPythonTests/testEvaluationContainer.py
${PYTHON_TEST_DIR}/individualPythonTests/testIntrinsicFunctions.py
${PYTHON_TEST_DIR}/individualPythonTests/testMAiNGOmodel.py
${PYTHON_TEST_DIR}/individualPythonTests/testOptimizationVariables.py
${PYTHON_TEST_DIR}/individualPythonTests/testSolver.py
${PYTHON_TEST_DIR}/individualPythonTests/__init__.py
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
${PROJECT_SOURCE_DIR}/maingopy/__init__maingopy_and_melonpy.py.in
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy/__init__.py
)
add_dependencies(melonpy maingopy)
add_dependencies(_maingopy maingopy)
else()
add_custom_target(maingopy ALL
COMMAND ${CMAKE_COMMAND} -E make_directory
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/examples/MAiNGOSettings.txt
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
${PROJECT_SOURCE_DIR}/maingopy/__init__only_maingopy.py.in
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/maingopy/__init__.py
)
add_dependencies(_maingopy maingopy)
endif()
if(${BLAS_usePrecompiledDll})
add_custom_target(copyBlasDllmaingopy ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/blasd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/blas.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/maingopy/blasd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/maingopy/blas.dll>)
add_dependencies(copyBlasDllmaingopy copyBlasDll melonpy)
endif()
if(${LAPACK_usePrecompiledDlls})
add_custom_target(copyLapackDllmaingopy ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/lapackd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/lapack.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/maingopy/lapackd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/maingopy/lapack.dll>)
add_dependencies(copyLapackDllmaingopy copyLapackDll melonpy)
endif()
if(${MUMPS_usePrecompiledDll})
add_custom_target(copyMumpsDllmaingopy ALL
COMMAND ${CMAKE_COMMAND} -E copy
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/mumpsd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/mumps.dll>
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}/maingopy/mumpsd.dll>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}/maingopy/mumps.dll>)
add_dependencies(copyMumpsDllmaingopy copyMumpsDll melonpy)
endif()
endif()
endif()
# --------------- MAiNGO Tests ---------------------------
if(MAiNGO_build_test)
add_executable(test-maingo ${PROJECT_SOURCE_DIR}/tests/testProblems/main.cpp)
target_link_libraries(test-maingo PRIVATE maingo-core)
target_compile_features(test-maingo PRIVATE cxx_std_17)
if(MSVC)
target_compile_options(test-maingo PRIVATE /MP;/Qpar)
set_target_properties(test-maingo PROPERTIES LINK_FLAGS /ignore:4099) #/ignore:4099 disables annoying linker warning because cplex does not provide debugging information
else()
target_compile_options(test-maingo
PRIVATE
$<$<CXX_COMPILER_ID:Intel>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:GNU>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:AppleClang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
$<$<CXX_COMPILER_ID:Clang>: $<$<NOT:$<CONFIG:DEBUG>>:-O3> $<$<CONFIG:DEBUG>:-O0>>
)
endif()
if (MAiNGO_build_python_interface)
set(PYTHON_TEST_DIR ${PROJECT_SOURCE_DIR}/maingopy/tests)
add_custom_target(test-maingopy ALL
COMMAND ${CMAKE_COMMAND} -E copy
${PYTHON_TEST_DIR}/testMaingopy.py
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>
COMMAND ${CMAKE_COMMAND} -E make_directory
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
COMMAND ${CMAKE_COMMAND} -E copy
${PYTHON_TEST_DIR}/individualPythonTests/testEvaluationContainer.py
${PYTHON_TEST_DIR}/individualPythonTests/testIntrinsicFunctions.py
${PYTHON_TEST_DIR}/individualPythonTests/testMAiNGOmodel.py
${PYTHON_TEST_DIR}/individualPythonTests/testOptimizationVariables.py
${PYTHON_TEST_DIR}/individualPythonTests/testSolver.py
${PYTHON_TEST_DIR}/individualPythonTests/__init__.py
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
COMMAND ${CMAKE_COMMAND} -E copy
${PROJECT_SOURCE_DIR}/examples/MAiNGOSettings.txt
$<$<CONFIG:Debug>:${RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$<NOT:$<CONFIG:Debug>>:${RUNTIME_OUTPUT_DIRECTORY_RELEASE}>/individualPythonTests
)
endif()
endif()
\ No newline at end of file
The code of MAiNGO is licensed under the Eclipse Public License v2.0 (EPL 2.0).
MAiNGO uses several third-party libraries by various authors.
Note that these do not allow using MAiNGO in conjunction with these libraries in commercial software.
For full details, please see the COPYING, COPYRIGHT, README, and AUTHOR files
in the repositories linked at https://git.rwth-aachen.de/avt.svt/public/maingo/-/tree/master/dep.
As brief summary, the open-source libraries (partially) distributed with
source or binary distributions of MAiNGO are licensed under the following licenses:
- babbase, libale & MeLOn: EPL 2.0
- MC++, IPOPT, CLP: EPL 1.0
- Filib++, NLopt, cpplapack: LGPL
- json: MIT
- MUMPS: CeCILL-C
- pybind11, netlib LAPACK: Modified BSD
- netlib BLAS, fadbad++: own licenses
The coyprights and license terms are given below.
------------------------------------------------------------------------------------------------------
MAiNGO, babbase, libale, & MeLOn:
Copyright (c) 2017-2020 Process Systems Engineering (AVT.SVT), RWTH Aachen University
Eclipse Public License - v 2.0