Gating network behind compile flag

This commit is contained in:
2026-08-11 12:52:38 -05:00
parent 5f34cb34b2
commit 830864aa8a
281 changed files with 334 additions and 13204 deletions
+3 -4
View File
@@ -1,6 +1,7 @@
import argparse
import csv
import os
from tools.writeifchanged import write_if_changed
parser = argparse.ArgumentParser(description="Color CSV to .h defines")
parser.add_argument("--csv", required=True, help="Path to color CSV file")
@@ -79,6 +80,4 @@ for line in "\n".join(js).rstrip().splitlines():
out[-1] = out[-1].rstrip(" \\")
out.append("")
os.makedirs(os.path.dirname(args.output), exist_ok=True)
with open(args.output, "w", encoding="utf-8") as f:
f.write("\n".join(out))
write_if_changed(args.output, "\n".join(out))
+3 -4
View File
@@ -1,6 +1,7 @@
import argparse
import json
import os
from tools.writeifchanged import write_if_changed
parser = argparse.ArgumentParser(description="Item JSON to .h defines")
parser.add_argument("--json", required=True, help="Path to item JSON file")
@@ -109,6 +110,4 @@ out += [
"",
]
os.makedirs(os.path.dirname(args.output), exist_ok=True)
with open(args.output, "w", encoding="utf-8") as f:
f.write("\n".join(out))
write_if_changed(args.output, "\n".join(out))
+7 -2
View File
@@ -4,11 +4,16 @@
# https://opensource.org/licenses/MIT
function(dusk_run_python CMAKE_TARGET_NAME PYTHON_MODULE)
cmake_parse_arguments(DUSK_RUN_PYTHON "" "OUTPUT" "DEPENDS;ARGS" ${ARGN})
find_package(Python3 COMPONENTS Interpreter REQUIRED)
add_custom_target(${CMAKE_TARGET_NAME} ALL
add_custom_command(
OUTPUT ${DUSK_RUN_PYTHON_OUTPUT}
WORKING_DIRECTORY ${DUSK_ROOT_DIR}
COMMAND
${Python3_EXECUTABLE} -m ${PYTHON_MODULE} ${ARGN}
${Python3_EXECUTABLE} -m ${PYTHON_MODULE} ${DUSK_RUN_PYTHON_ARGS}
DEPENDS ${DUSK_RUN_PYTHON_DEPENDS}
VERBATIM
)
add_custom_target(${CMAKE_TARGET_NAME} DEPENDS ${DUSK_RUN_PYTHON_OUTPUT})
endfunction()
+13
View File
@@ -0,0 +1,13 @@
import os
def write_if_changed(path, content):
try:
with open(path, "r", encoding="utf-8") as f:
if f.read() == content:
return
except FileNotFoundError:
pass
os.makedirs(os.path.dirname(path), exist_ok=True)
with open(path, "w", encoding="utf-8") as f:
f.write(content)