Bläddra i källkod

add add_options

ruki 2 år sedan
förälder
incheckning
0f061e95ae
3 ändrade filer med 22 tillägg och 0 borttagningar
  1. 1 0
      README.md
  2. 20 0
      configure
  3. 1 0
      src/xmake.sh

+ 1 - 0
README.md

@@ -227,6 +227,7 @@ $ make run
   - [x] set_installdir
   - [x] add_installfiles
   - [x] add_headerfiles
+  - [x] add_options
 - [x] target_end
 - [x] option
   - [x] set_default

+ 20 - 0
configure

@@ -2371,6 +2371,26 @@ add_arflags() {
     done
 }
 
+# add options in target
+add_options() {
+    if ! ${_loading_targets}; then
+        return
+    fi
+    local name=""
+    for name in $@; do
+        if has_config "${name}"; then
+            local itemname=""
+            local itemnames="includedirs linkdirs links"
+            for itemname in ${itemnames}; do
+                _get_option_item "${name}" "${itemname}"; local values="${_ret}"
+                if test_nz "${values}"; then
+                    _add_target_item "${_xmake_sh_target_current}" "${itemname}" "${values}"
+                fi
+            done
+        fi
+    done
+}
+
 #-----------------------------------------------------------------------------
 # toolchain configuration apis
 #

+ 1 - 0
src/xmake.sh

@@ -52,6 +52,7 @@ target "demo"
     add_headerfiles "(bar/*.h)" "hello"
     add_headerfiles "foo/(*.h)" "hello"
     add_installfiles "res/(png/**.png)" "share"
+    add_options "lua"
     if has_config "debug"; then
         add_defines "DEBUG" "TEST"
     fi