Browse Source

Support options for call rescompiler in CMake

Support options for call rescompiler in CMake
commit_hash:8110f08c01093f7c7186effee493f2c269031868
dimdim11 4 months ago
parent
commit
aa2573e03c
2 changed files with 12 additions and 4 deletions
  1. 10 2
      build/export_generators/cmake/cmake/common.cmake
  2. 2 2
      build/ymake.core.conf

+ 10 - 2
build/export_generators/cmake/cmake/common.cmake

@@ -193,7 +193,7 @@ endfunction()
 function(resources Tgt Output)
   set(opts "")
   set(oneval_args "")
-  set(multival_args INPUTS KEYS)
+  set(multival_args INPUTS KEYS OPTS)
   cmake_parse_arguments(RESOURCE_ARGS
     "${opts}"
     "${oneval_args}"
@@ -212,12 +212,20 @@ function(resources Tgt Output)
     list(APPEND ResourcesList ${Input})
     list(APPEND ResourcesList ${Key})
   endforeach()
+  list(LENGTH RESOURCE_ARGS_OPTS OptsCount)
+  if (${OptsCount} GREATER 0)
+    math(EXPR ListsMaxIdx "${OptsCount} - 1")
+    foreach(Idx RANGE ${ListsMaxIdx})
+      list(GET RESOURCE_ARGS_OPTS ${Idx} Opt)
+      list(APPEND OptsList ${Opt})
+    endforeach()
+  endif()
 
   get_built_tool_path(rescompiler_bin rescompiler_dependency tools/rescompiler/bin rescompiler)
 
   add_custom_command(
     OUTPUT ${Output}
-    COMMAND ${rescompiler_bin} ${Output} ${ResourcesList}
+    COMMAND ${rescompiler_bin} ${Output} ${ResourcesList} ${OptsList}
     DEPENDS ${RESOURCE_ARGS_INPUTS} ${rescompiler_dependency}
   )
 endfunction()

+ 2 - 2
build/ymake.core.conf

@@ -467,9 +467,9 @@ macro CHECK_DEPENDENT_DIRS(TYPE, ALL?"UNUSED":"", PEERDIRS?"PEERDIRS":"ALL", RES
     SET_APPEND(CHECK_DEPENDENT_DIRS_TYPES $TYPE)
 }
 
-macro _RESOURCE_SEM(INPUTS[], KEYS[]) {
+macro _RESOURCE_SEM(INPUTS[], KEYS[], OPTS[]) {
     SET(RESOURCE_OUTPUT ${hash:INPUTS}.cpp)
-    .SEM=target_macroses-ITEM && target_macroses-macro resources && target_macroses-args ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS ${hide;tool:"tools/rescompiler/bin"}
+    .SEM=target_macroses-ITEM && target_macroses-macro resources && target_macroses-args ${output;global:RESOURCE_OUTPUT} INPUTS ${input:INPUTS} KEYS $KEYS OPTS $OPTS ${hide;tool:"tools/rescompiler/bin"}
 }
 
 # tag:built-in