Skip to content

Commit

Permalink
Update CMakePresets.json
Browse files Browse the repository at this point in the history
  • Loading branch information
tttapa committed May 6, 2024
1 parent 15b8107 commit f4a3bfd
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 22 deletions.
65 changes: 49 additions & 16 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,57 +1,90 @@
{
"version": 4,
"configurePresets": [
{
"name": ".dev-vars",
"description": "Default options for developer builds",
"hidden": true,
"warnings": {
"dev": true
},
"cacheVariables": {
"CMAKE_POSITION_INDEPENDENT_CODE": true,
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"BUILD_SHARED_LIBS": true,
"CMAKE_STAGING_PREFIX": "${sourceDir}/staging",
"ALPAQA_WITH_DRIVERS": true,
"ALPAQA_WITH_EXAMPLES": true,
"ALPAQA_WITH_TESTS": true
}
},
{
"name": ".dev-linux",
"description": "Default settings for developer builds on Linux",
"hidden": true,
"inherits": [
".dev-vars"
],
"generator": "Ninja Multi-Config",
"binaryDir": "${sourceDir}/build",
"warnings": {
"dev": true,
"deprecated": true,
"uninitialized": true
},
"environment": {
"CFLAGS": "-fdiagnostics-color",
"CXXFLAGS": "-fdiagnostics-color",
"FCFLAGS": "-fdiagnostics-color"
},
"cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
}
},
{
"name": ".dev-linux-cross-native",
"description": "Configuration for cross-compiling using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
"hidden": true,
"inherits": [
".dev-linux"
],
"environment": {
"CFLAGS": "-march=native -fdiagnostics-color",
"CXXFLAGS": "-march=native -fdiagnostics-color",
"FCFLAGS": "-march=native -fdiagnostics-color",
"LDFLAGS": "-static-libstdc++",
"CROSS_COMPILE": "x86_64-centos7-linux-gnu",
"TOOLCHAIN_PREFIX": "${sourceDir}/toolchains/$env{CROSS_COMPILE}"
},
"toolchainFile": "$env{TOOLCHAIN_PREFIX}/$env{CROSS_COMPILE}.toolchain.cmake",
"cacheVariables": {
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_PREFIX_PATH": "$env{TOOLCHAIN_PREFIX}/mumps/usr/local;$env{TOOLCHAIN_PREFIX}/ipopt/usr/local",
"CMAKE_FIND_ROOT_PATH": "$env{TOOLCHAIN_PREFIX}/eigen-master;$env{TOOLCHAIN_PREFIX}/googletest;$env{TOOLCHAIN_PREFIX}/casadi;$env{TOOLCHAIN_PREFIX}/openblas;$env{TOOLCHAIN_PREFIX}/mumps;$env{TOOLCHAIN_PREFIX}/ipopt;$env{TOOLCHAIN_PREFIX}/qpalm;$env{TOOLCHAIN_PREFIX}/pybind11-2.11.1",
"CMAKE_POSITION_INDEPENDENT_CODE": true
"CMAKE_FIND_ROOT_PATH": "$env{TOOLCHAIN_PREFIX}/eigen-master;$env{TOOLCHAIN_PREFIX}/googletest;$env{TOOLCHAIN_PREFIX}/casadi;$env{TOOLCHAIN_PREFIX}/openblas;$env{TOOLCHAIN_PREFIX}/mumps;$env{TOOLCHAIN_PREFIX}/ipopt;$env{TOOLCHAIN_PREFIX}/qpalm;$env{TOOLCHAIN_PREFIX}/pybind11-2.11.1"
}
},
{
"name": "dev-linux",
"name": "dev-linux-cross-native",
"description": "Configuration for cross-compiling using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
"inherits": [
".dev-linux"
".dev-linux-cross-native"
],
"binaryDir": "${sourceDir}/build-local",
"cacheVariables": {
"BUILD_SHARED_LIBS": true,
"CMAKE_STAGING_PREFIX": "${sourceDir}/staging",
"ALPAQA_WITH_DRIVERS": true,
"ALPAQA_WITH_EXAMPLES": false,
"ALPAQA_WITH_TESTS": false,
"ALPAQA_WITH_CUTEST": true,
"ALPAQA_WITH_QPALM": true,
"ALPAQA_WITH_IPOPT": true,
"ALPAQA_WITH_PYTHON": false
}
},
{
"name": "dev-linux-python",
"name": "dev-linux-cross-native-python",
"description": "Configuration for cross-compiling Python bindings using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
"inherits": [
".dev-linux"
".dev-linux-cross-native"
],
"binaryDir": "${sourceDir}/build-python",
"binaryDir": "${sourceDir}/build/python",
"cacheVariables": {
"CMAKE_MODULE_LINKER_FLAGS": "-static-libstdc++",
"BUILD_SHARED_LIBS": false,
"ALPAQA_PYTHON_DEBUG_CONFIG": "Debug",
"USE_GLOBAL_PYBIND11": true,
"ALPAQA_WITH_PY_STUBS": true,
Expand Down
12 changes: 6 additions & 6 deletions scripts/dev/install-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ if [ ! -d "$pfx/qpalm" ]; then
fi

# Configure
cmake --preset dev-linux
cmake --preset dev-linux-cross-native
# Build
for cfg in Debug RelWithDebInfo; do
cmake --build build-local -j --config $cfg
cmake --install build-local --config $cfg
cmake --install build-local --config $cfg --component debug
cmake --build build -j --config $cfg
cmake --install build --config $cfg
cmake --install build --config $cfg --component debug
done
# Package
pushd build-local
pushd build
cpack -G 'TGZ;DEB' -C "RelWithDebInfo;Debug"
popd

Expand All @@ -43,7 +43,7 @@ cat <<- EOF > "$config"
[cmake]
config = ["Debug", "Release"]
generator = "Ninja Multi-Config"
preset = "dev-linux-python"
preset = "dev-linux-cross-native-python"
EOF
. ./.venv/bin/activate
pip install -U pip build
Expand Down

0 comments on commit f4a3bfd

Please sign in to comment.