diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2023-02-14 17:20:48 +0100 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2023-05-30 15:33:18 +0200 |
commit | f5fb09192d1ad244006964d2d1425506718d3e58 (patch) | |
tree | 2fe4b65b1286fd9d4e4832ad20bb46bd74297078 /CC/foreign/cmake/EXPRESSIONS | |
parent | 25cc5a5d9e225e8a1b8d1a7221eb1968b28d928d (diff) | |
download | rules-cc-f5fb09192d1ad244006964d2d1425506718d3e58.tar.gz |
rules-cc/foreign: Support project sub-directory
Diffstat (limited to 'CC/foreign/cmake/EXPRESSIONS')
-rw-r--r-- | CC/foreign/cmake/EXPRESSIONS | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/CC/foreign/cmake/EXPRESSIONS b/CC/foreign/cmake/EXPRESSIONS index be345c2..bdb05ce 100644 --- a/CC/foreign/cmake/EXPRESSIONS +++ b/CC/foreign/cmake/EXPRESSIONS @@ -1,6 +1,7 @@ { "cmake-build": { "vars": [ "source_dir" + , "cmake_subdir" , "cmake_options" , "cmake_defines" , "cmake_jobs" @@ -143,6 +144,12 @@ ] } ] + , [ "CMAKE_SUBDIR" + , { "type": "join" + , "separator": "/" + , "$1": {"type": "var", "name": "cmake_subdir", "default": []} + } + ] , [ "script" , { "type": "singleton_map" , "key": "run_cmake.sh" @@ -169,9 +176,10 @@ ] } } - , [ "readonly CMAKE_AR=$(which $1)" - , "shift" - , "cmake \"$@\" -Ssource -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)" + , [ "readonly CMAKE_SUBDIR=\"$1\"" + , "readonly CMAKE_AR=$(which $2)" + , "shift 2" + , "cmake \"$@\" -S\"source/${CMAKE_SUBDIR}\" -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install >configure.log || (cat configure.log && exit 1)" ] , [ { "type": "join" , "separator": " " @@ -222,7 +230,11 @@ , "cmd": { "type": "++" , "$1": - [ ["/bin/sh", "run_cmake.sh", {"type": "var", "name": "AR"}] + [ [ "/bin/sh" + , "run_cmake.sh" + , {"type": "var", "name": "CMAKE_SUBDIR"} + , {"type": "var", "name": "AR"} + ] , {"type": "var", "name": "CMAKE_FLAGS"} ] } |