diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-16 16:56:39 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-16 16:56:39 +0200 |
commit | 75a8891687fa4f696f5add17fceab2797e0c6773 (patch) | |
tree | d352e3f7744453b597bdc33bb105e2c5d2e95fbf /rules/CC | |
parent | 91c86187e770b6a3b91d9acc6289006b4323f1ea (diff) | |
parent | db9ae6e0367c5dac8b0d37da00fe217e6b203af1 (diff) | |
download | rules-cc-75a8891687fa4f696f5add17fceab2797e0c6773.tar.gz |
Merge subtree 'rules' into rules-cc
Diffstat (limited to 'rules/CC')
-rw-r--r-- | rules/CC/foreign/cmake/EXPRESSIONS | 51 | ||||
-rw-r--r-- | rules/CC/foreign/cmake/RULES | 7 |
2 files changed, 40 insertions, 18 deletions
diff --git a/rules/CC/foreign/cmake/EXPRESSIONS b/rules/CC/foreign/cmake/EXPRESSIONS index 4dfcc07..8977d5a 100644 --- a/rules/CC/foreign/cmake/EXPRESSIONS +++ b/rules/CC/foreign/cmake/EXPRESSIONS @@ -81,11 +81,6 @@ } } ] - , [ "CMAKE_BUILD_PARALLEL_LEVEL" - , { "type": "join" - , "$1": {"type": "var", "name": "cmake_jobs", "default": []} - } - ] , [ "ENV" , { "type": "map_union" , "$1": @@ -98,14 +93,7 @@ } ] , [ { "type": "env" - , "vars": - [ "CC" - , "CXX" - , "CXXFLAGS" - , "CFLAGS" - , "LDFLAGS" - , "CMAKE_BUILD_PARALLEL_LEVEL" - ] + , "vars": ["CC", "CXX", "CXXFLAGS", "CFLAGS", "LDFLAGS"] } ] ] @@ -118,6 +106,21 @@ , "default": {"type": "CALL_EXPRESSION", "name": "default-AR"} } ] + , [ "CMAKE_JOBS" + , { "type": "if" + , "cond": {"type": "var", "name": "cmake_jobs"} + , "then": + [ { "type": "join" + , "$1": + [ "CMAKE_BUILD_PARALLEL_LEVEL=" + , { "type": "join_cmd" + , "$1": {"type": "var", "name": "cmake_jobs"} + } + ] + } + ] + } + ] , [ "script" , { "type": "singleton_map" , "key": "run_cmake.sh" @@ -147,15 +150,31 @@ , [ "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": "join" + , "separator": " " + , "$1": + { "type": "++" + , "$1": + [ {"type": "var", "name": "CMAKE_JOBS"} + , [ "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"] + [ [ "(" + , "set --" + , "readonly CMAKE_SOURCE_DIR=\"$(pwd)/source\"" + , "readonly CMAKE_BINARY_DIR=\"$(pwd)/build\"" + , "cd ./install" + ] , {"type": "var", "name": "post_cmds"} , [")"] ] diff --git a/rules/CC/foreign/cmake/RULES b/rules/CC/foreign/cmake/RULES index 8e8b934..8651f4e 100644 --- a/rules/CC/foreign/cmake/RULES +++ b/rules/CC/foreign/cmake/RULES @@ -50,7 +50,8 @@ , "installation but before the output files are collected. Useful for" , "renaming files or directories. Note that data between \"pre_cmds\" and" , "\"post_cmds\" can be exchanged via $TMPDIR, which is uniquely reserved" - , "for this action." + , "for this action. The CMake source and build directory can be accessed" + , "via $CMAKE_SOURCE_DIR and $CMAKE_BINARY_DIR, respectively." ] , "out_files": [ "Paths to the produced output files. The paths are considered relative" @@ -286,7 +287,9 @@ , "installation but before the output files are collected. Useful for" , "renaming files or directories (e.g., in case of SONAME mismatch). Note" , "that data between \"pre_cmds\" and \"post_cmds\" can be exchanged via" - , "$TMPDIR, which is uniquely reserved for this action." + , "$TMPDIR, which is uniquely reserved for this action. The CMake source" + , "and build directory can be accessed via $CMAKE_SOURCE_DIR and" + , "$CMAKE_BINARY_DIR, respectively." ] , "out_hdrs": [ "Paths to produced public header files. The path is considered" |