diff options
-rw-r--r-- | CC/foreign/cmake/EXPRESSIONS | 22 | ||||
-rw-r--r-- | CC/foreign/cmake/RULES | 6 |
2 files changed, 25 insertions, 3 deletions
diff --git a/CC/foreign/cmake/EXPRESSIONS b/CC/foreign/cmake/EXPRESSIONS index c7e35b8..2266f61 100644 --- a/CC/foreign/cmake/EXPRESSIONS +++ b/CC/foreign/cmake/EXPRESSIONS @@ -8,6 +8,7 @@ , "cmake_options" , "cmake_defines" , "cmake_jobs" + , "cmake_targets" , "pre_cmds" , "post_cmds" , "CC" @@ -167,6 +168,13 @@ , "$1": {"type": "var", "name": "cmake_subdir", "default": []} } ] + , [ "cmake_targets" + , { "type": "if" + , "cond": {"type": "var", "name": "cmake_targets"} + , "then": {"type": "var", "name": "cmake_targets"} + , "else": ["install"] + } + ] , [ "script" , { "type": "singleton_map" , "key": "run_cmake.sh" @@ -200,18 +208,26 @@ , "shift 2" , "${ROOT}/expand_exec TMPDIR LOCALBASE CC CXX CFLAGS CXXFLAGS LDFLAGS AR -- cmake -S\"source/${CMAKE_SUBDIR}\" -Bbuild -DCMAKE_AR=${CMAKE_AR} -DCMAKE_INSTALL_PREFIX=./install -DCMAKE_PREFIX_PATH=\"$LOCALBASE\" -DPKG_CONFIG_ARGN=--define-prefix --no-warn-unused-cli \"$@\" >configure.log 2>&1 || (cat configure.log && exit 1)" ] - , [ { "type": "join" + , { "type": "foreach" + , "range": {"type": "var", "name": "cmake_targets"} + , "var": "target" + , "body": + { "type": "join" , "separator": " " , "$1": { "type": "++" , "$1": [ {"type": "var", "name": "CMAKE_JOBS"} - , [ "${ROOT}/expand_exec TMPDIR LOCALBASE CC CXX CFLAGS CXXFLAGS LDFLAGS AR -- cmake --build build --target install >build.log 2>&1 || (cat configure.log build.log && exit 1)" + , [ "${ROOT}/expand_exec TMPDIR LOCALBASE CC CXX CFLAGS CXXFLAGS LDFLAGS AR -- cmake --build build --target" + , { "type": "join_cmd" + , "$1": [{"type": "var", "name": "target"}] + } + , ">>build.log 2>&1 || (cat build.log && exit 1)" ] ] } } - ] + } , ["find ./install -type l -delete"] , { "type": "if" , "cond": {"type": "var", "name": "post_cmds"} diff --git a/CC/foreign/cmake/RULES b/CC/foreign/cmake/RULES index 0b1086c..63d6e48 100644 --- a/CC/foreign/cmake/RULES +++ b/CC/foreign/cmake/RULES @@ -12,6 +12,7 @@ [ "subdir" , "options" , "defines" + , "targets" , "jobs" , "pre_cmds" , "post_cmds" @@ -50,6 +51,10 @@ [ "CMake defines for the configuration phase." , "(e.g., [\"CMAKE_BUILD_TYPE=Release\"])" ] + , "targets": + [ "The CMake targets to build in the specified order" + , "(default: [\"install\"])." + ] , "jobs": [ "Number of jobs to run simultaneously. If omitted, CMake's default" , "number is used." @@ -190,6 +195,7 @@ , ["cmake_subdir", {"type": "FIELD", "name": "subdir"}] , ["cmake_options", {"type": "FIELD", "name": "options"}] , ["cmake_defines", {"type": "FIELD", "name": "defines"}] + , ["cmake_targets", {"type": "FIELD", "name": "targets"}] , ["cmake_jobs", {"type": "FIELD", "name": "jobs"}] , ["pre_cmds", {"type": "FIELD", "name": "pre_cmds"}] , ["post_cmds", {"type": "FIELD", "name": "post_cmds"}] |