Files
libretro-puzzlescript/BUILD.gn

143 lines
3.9 KiB
Plaintext

cflags = [
"-fPIC",
"-Wall",
"-Wextra",
"-Werror",
"-O3",
]
cflags_c = [
"-std=c99",
"-D_GNU_SOURCE",
"-DCONFIG_VERSION=\"2024-01-13\"",
]
cflags_cc = [
"-std=c++17",
]
if (include_symbols) {
cflags += [ "-g" ]
}
if (debug_cxxstdlib) {
cflags_cc += [ "-D_GLIBCXX_DEBUG" ]
}
ldflags = [
"-Wl,--no-allow-shlib-undefined",
"-Wl,--version-script=" + rebase_path("src/export.map", root_build_dir),
]
if (target_cpu == "arm") {
ldflags += [
"-static-libstdc++",
]
}
if (use_precompiled_font) {
copy("generate_font") {
sources =[
"//tools/font.js",
]
outputs = [
"$target_gen_dir/custom/font.js",
]
}
} else {
action("generate_font") {
script = "tools/generate_font.py"
args = [
"--font=" + rebase_path("tools/fonts/saxmono/saxmono.ttf", root_build_dir),
"--size=22",
"--width=11",
"--height=25",
"--baseline=20",
"-o", rebase_path(target_gen_dir + "/custom/font.js", root_build_dir),
]
outputs = [
"$target_gen_dir/custom/font.js"
]
}
}
action("generate_internal_data") {
script = "tools/bundle_files.py"
deps = [ ":generate_font" ]
inputs = [
"$target_gen_dir/custom/font.js",
"//data/custom/main.js",
"//data/custom/overload.js",
"//data/custom/postsetup.js",
"//data/custom/setup.js",
"//data/PuzzleScript/src/js/colors.js",
"//data/PuzzleScript/src/js/compiler.js",
"//data/PuzzleScript/src/js/debug.js",
"//data/PuzzleScript/src/js/debug_off.js",
"//data/PuzzleScript/src/js/engine.js",
"//data/PuzzleScript/src/js/font.js",
"//data/PuzzleScript/src/js/globalVariables.js",
"//data/PuzzleScript/src/js/graphics.js",
"//data/PuzzleScript/src/js/inputoutput.js",
"//data/PuzzleScript/src/js/parser.js",
"//data/PuzzleScript/src/js/riffwave.js",
"//data/PuzzleScript/src/js/rng.js",
"//data/PuzzleScript/src/js/sfxr.js",
"//data/PuzzleScript/src/js/storagewrapper.js",
"//data/PuzzleScriptPlus/src/js/colors.js",
"//data/PuzzleScriptPlus/src/js/compiler.js",
"//data/PuzzleScriptPlus/src/js/debug.js",
"//data/PuzzleScriptPlus/src/js/debug_off.js",
"//data/PuzzleScriptPlus/src/js/engine.js",
"//data/PuzzleScriptPlus/src/js/font.js",
"//data/PuzzleScriptPlus/src/js/globalVariables.js",
"//data/PuzzleScriptPlus/src/js/graphics.js",
"//data/PuzzleScriptPlus/src/js/inputoutput.js",
"//data/PuzzleScriptPlus/src/js/parser.js",
"//data/PuzzleScriptPlus/src/js/riffwave.js",
"//data/PuzzleScriptPlus/src/js/rng.js",
"//data/PuzzleScriptPlus/src/js/sfxr.js",
"//data/PuzzleScriptPlus/src/js/storagewrapper.js",
]
args = [
"--out", rebase_path(target_gen_dir + "/bundled.h", root_build_dir),
] + rebase_path(inputs, root_build_dir)
outputs = [ "$target_gen_dir/bundled.h" ]
}
source_set("quickjs") {
sources = [
"src/quickjs/quickjs.c",
"src/quickjs/libbf.c",
"src/quickjs/libregexp.c",
"src/quickjs/libunicode.c",
"src/quickjs/cutils.c",
"src/quickjs/quickjs-libc.c",
]
include_dirs = [
"src/quickjs",
]
cflags += [
"-Wno-error",
"-w"
]
}
shared_library("puzzlescript_libretro") {
deps = [ ":quickjs", ":generate_internal_data" ]
sources = [
"src/core.cpp",
"src/audio.cpp",
"src/event.cpp",
"src/generator.cpp",
"src/graphics.cpp",
"src/js.cpp",
"src/rng.cpp",
"src/sfxr.cpp",
"src/sprite.cpp",
"src/pztime.cpp",
]
include_dirs = [
target_gen_dir,
"src/quickjs",
"src/libretro/include",
"src/stb",
]
}