summaryrefslogtreecommitdiff
path: root/rules/CC/foreign/cmake/EXPRESSIONS
diff options
context:
space:
mode:
authorOliver Reiche <oliver.reiche@huawei.com>2023-01-31 17:04:40 +0100
committerOliver Reiche <oliver.reiche@huawei.com>2023-01-31 17:04:40 +0100
commit164e900e96756c5eab57abac602c322d55e0c9b3 (patch)
tree4a7a163c49de5b4311a986c8369ba9698e06cc58 /rules/CC/foreign/cmake/EXPRESSIONS
parent1e48e8c0fd80c331666363799085a50f905c48da (diff)
parent392c7451987c10d5dbf23d484f2ed79aa7115e6b (diff)
downloadrules-cc-164e900e96756c5eab57abac602c322d55e0c9b3.tar.gz
Merge commit '392c7451987c10d5dbf23d484f2ed79aa7115e6b' into rules-cc
Diffstat (limited to 'rules/CC/foreign/cmake/EXPRESSIONS')
-rw-r--r--rules/CC/foreign/cmake/EXPRESSIONS61
1 files changed, 52 insertions, 9 deletions
diff --git a/rules/CC/foreign/cmake/EXPRESSIONS b/rules/CC/foreign/cmake/EXPRESSIONS
index a3fd429..4dfcc07 100644
--- a/rules/CC/foreign/cmake/EXPRESSIONS
+++ b/rules/CC/foreign/cmake/EXPRESSIONS
@@ -3,6 +3,9 @@
[ "source_dir"
, "cmake_options"
, "cmake_defines"
+ , "cmake_jobs"
+ , "pre_cmds"
+ , "post_cmds"
, "CC"
, "CXX"
, "CFLAGS"
@@ -44,7 +47,6 @@
, "cond": {"type": "var", "name": "BUILD_POSITION_INDEPENDENT"}
, "then": ["-DCMAKE_POSITION_INDEPENDENT_CODE=ON"]
}
- , [{"type": "join", "$1": ["-DCMAKE_AR=/usr/bin/ar"]}]
]
}
]
@@ -79,6 +81,11 @@
}
}
]
+ , [ "CMAKE_BUILD_PARALLEL_LEVEL"
+ , { "type": "join"
+ , "$1": {"type": "var", "name": "cmake_jobs", "default": []}
+ }
+ ]
, [ "ENV"
, { "type": "map_union"
, "$1":
@@ -91,7 +98,14 @@
}
]
, [ { "type": "env"
- , "vars": ["CC", "CXX", "CXXFLAGS", "CFLAGS", "LDFLAGS"]
+ , "vars":
+ [ "CC"
+ , "CXX"
+ , "CXXFLAGS"
+ , "CFLAGS"
+ , "LDFLAGS"
+ , "CMAKE_BUILD_PARALLEL_LEVEL"
+ ]
}
]
]
@@ -113,13 +127,42 @@
{ "type": "join"
, "separator": "\n"
, "$1":
- [ "set -eu"
- , "readonly CMAKE_AR=$(which $1)"
- , "shift"
- , "cmake \"$@\" -Ssource -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)"
- , "cmake --build build --target install >build.log || (cat configure.log build.log && exit 1)"
- , "find ./install -type l -delete"
- ]
+ { "type": "++"
+ , "$1":
+ [ [ "set -eu"
+ , "mkdir scratch"
+ , "readonly TMPDIR=\"$(pwd)/scratch\""
+ ]
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "pre_cmds"}
+ , "then":
+ { "type": "++"
+ , "$1":
+ [ ["(", "set --", "cd ./source"]
+ , {"type": "var", "name": "pre_cmds"}
+ , [")"]
+ ]
+ }
+ }
+ , [ "readonly CMAKE_AR=$(which $1)"
+ , "shift"
+ , "cmake \"$@\" -Ssource -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)"
+ , "cmake --build build --target install >build.log || (cat configure.log build.log && exit 1)"
+ , "find ./install -type l -delete"
+ ]
+ , { "type": "if"
+ , "cond": {"type": "var", "name": "post_cmds"}
+ , "then":
+ { "type": "++"
+ , "$1":
+ [ ["(", "set --", "cd ./install"]
+ , {"type": "var", "name": "post_cmds"}
+ , [")"]
+ ]
+ }
+ }
+ ]
+ }
}
}
}