Skip to content

Commit f4a3bfd

Browse files
committed
Update CMakePresets.json
1 parent 15b8107 commit f4a3bfd

File tree

2 files changed

+55
-22
lines changed

2 files changed

+55
-22
lines changed

CMakePresets.json

+49-16
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,90 @@
11
{
22
"version": 4,
33
"configurePresets": [
4+
{
5+
"name": ".dev-vars",
6+
"description": "Default options for developer builds",
7+
"hidden": true,
8+
"warnings": {
9+
"dev": true
10+
},
11+
"cacheVariables": {
12+
"CMAKE_POSITION_INDEPENDENT_CODE": true,
13+
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
14+
"BUILD_SHARED_LIBS": true,
15+
"CMAKE_STAGING_PREFIX": "${sourceDir}/staging",
16+
"ALPAQA_WITH_DRIVERS": true,
17+
"ALPAQA_WITH_EXAMPLES": true,
18+
"ALPAQA_WITH_TESTS": true
19+
}
20+
},
421
{
522
"name": ".dev-linux",
23+
"description": "Default settings for developer builds on Linux",
624
"hidden": true,
25+
"inherits": [
26+
".dev-vars"
27+
],
728
"generator": "Ninja Multi-Config",
29+
"binaryDir": "${sourceDir}/build",
830
"warnings": {
931
"dev": true,
1032
"deprecated": true,
1133
"uninitialized": true
1234
},
35+
"environment": {
36+
"CFLAGS": "-fdiagnostics-color",
37+
"CXXFLAGS": "-fdiagnostics-color",
38+
"FCFLAGS": "-fdiagnostics-color"
39+
},
40+
"cacheVariables": {
41+
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
42+
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache"
43+
}
44+
},
45+
{
46+
"name": ".dev-linux-cross-native",
47+
"description": "Configuration for cross-compiling using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
48+
"hidden": true,
49+
"inherits": [
50+
".dev-linux"
51+
],
1352
"environment": {
1453
"CFLAGS": "-march=native -fdiagnostics-color",
1554
"CXXFLAGS": "-march=native -fdiagnostics-color",
1655
"FCFLAGS": "-march=native -fdiagnostics-color",
56+
"LDFLAGS": "-static-libstdc++",
1757
"CROSS_COMPILE": "x86_64-centos7-linux-gnu",
1858
"TOOLCHAIN_PREFIX": "${sourceDir}/toolchains/$env{CROSS_COMPILE}"
1959
},
2060
"toolchainFile": "$env{TOOLCHAIN_PREFIX}/$env{CROSS_COMPILE}.toolchain.cmake",
2161
"cacheVariables": {
22-
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
23-
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
2462
"CMAKE_PREFIX_PATH": "$env{TOOLCHAIN_PREFIX}/mumps/usr/local;$env{TOOLCHAIN_PREFIX}/ipopt/usr/local",
25-
"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",
26-
"CMAKE_POSITION_INDEPENDENT_CODE": true
63+
"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"
2764
}
2865
},
2966
{
30-
"name": "dev-linux",
67+
"name": "dev-linux-cross-native",
68+
"description": "Configuration for cross-compiling using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
3169
"inherits": [
32-
".dev-linux"
70+
".dev-linux-cross-native"
3371
],
34-
"binaryDir": "${sourceDir}/build-local",
3572
"cacheVariables": {
36-
"BUILD_SHARED_LIBS": true,
37-
"CMAKE_STAGING_PREFIX": "${sourceDir}/staging",
38-
"ALPAQA_WITH_DRIVERS": true,
39-
"ALPAQA_WITH_EXAMPLES": false,
40-
"ALPAQA_WITH_TESTS": false,
4173
"ALPAQA_WITH_CUTEST": true,
4274
"ALPAQA_WITH_QPALM": true,
4375
"ALPAQA_WITH_IPOPT": true,
4476
"ALPAQA_WITH_PYTHON": false
4577
}
4678
},
4779
{
48-
"name": "dev-linux-python",
80+
"name": "dev-linux-cross-native-python",
81+
"description": "Configuration for cross-compiling Python bindings using local x86_64-centos7-linux-gnu toolchain (with -march=native)",
4982
"inherits": [
50-
".dev-linux"
83+
".dev-linux-cross-native"
5184
],
52-
"binaryDir": "${sourceDir}/build-python",
85+
"binaryDir": "${sourceDir}/build/python",
5386
"cacheVariables": {
54-
"CMAKE_MODULE_LINKER_FLAGS": "-static-libstdc++",
87+
"BUILD_SHARED_LIBS": false,
5588
"ALPAQA_PYTHON_DEBUG_CONFIG": "Debug",
5689
"USE_GLOBAL_PYBIND11": true,
5790
"ALPAQA_WITH_PY_STUBS": true,

scripts/dev/install-locally.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ if [ ! -d "$pfx/qpalm" ]; then
2525
fi
2626

2727
# Configure
28-
cmake --preset dev-linux
28+
cmake --preset dev-linux-cross-native
2929
# Build
3030
for cfg in Debug RelWithDebInfo; do
31-
cmake --build build-local -j --config $cfg
32-
cmake --install build-local --config $cfg
33-
cmake --install build-local --config $cfg --component debug
31+
cmake --build build -j --config $cfg
32+
cmake --install build --config $cfg
33+
cmake --install build --config $cfg --component debug
3434
done
3535
# Package
36-
pushd build-local
36+
pushd build
3737
cpack -G 'TGZ;DEB' -C "RelWithDebInfo;Debug"
3838
popd
3939

@@ -43,7 +43,7 @@ cat <<- EOF > "$config"
4343
[cmake]
4444
config = ["Debug", "Release"]
4545
generator = "Ninja Multi-Config"
46-
preset = "dev-linux-python"
46+
preset = "dev-linux-cross-native-python"
4747
EOF
4848
. ./.venv/bin/activate
4949
pip install -U pip build

0 commit comments

Comments
 (0)