summaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
author Miodrag Milanović <mmicko@gmail.com>2024-01-01 02:41:59 +0100
committer GitHub <noreply@github.com>2023-12-31 20:41:59 -0500
commitd5340b8be45db2815a6ce152813d991efa93d54f (patch)
tree2ceceea369a7045ba8a719c7a8d8fa5695728e05 /scripts
parent7a1c86c4d19d2923d6ce60de07a5203c3437c303 (diff)
Make building emulator optional (allow building tools without building MAME) (#11889)
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genie.lua91
-rw-r--r--scripts/src/emu.lua3
2 files changed, 53 insertions, 41 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index 001b81339ae..3a6a2bfd38b 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -121,6 +121,11 @@ newoption {
}
newoption {
+ trigger = "with-emulator",
+ description = "Enable building emulator.",
+}
+
+newoption {
trigger = "with-tests",
description = "Enable building tests.",
}
@@ -529,30 +534,32 @@ msgprecompile ("Precompiling $(subst ../,,$<)...")
messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" }
-if (_OPTIONS["PROJECT"] ~= nil) then
- PROJECT_DIR = path.join(path.getabsolute(".."),"projects",_OPTIONS["PROJECT"]) .. "/"
- if (not os.isfile(path.join("..", "projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
- error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
- end
- dofile (path.join(".." ,"projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
-elseif (_OPTIONS["SOURCES"] == nil) and (_OPTIONS["SOURCEFILTER"] == nil) then
- local subtargetscript = path.join("target", _OPTIONS["target"], _OPTIONS["subtarget"] .. ".lua")
- local subtargetfilter = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["subtarget"] .. ".flt")
- if os.isfile(subtargetscript) then
- dofile(subtargetscript)
- elseif os.isfile(subtargetfilter) then
- local makedep = path.join(MAME_DIR, "scripts", "build", "makedep.py")
- local driverlist = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["target"] .. ".lst")
- local OUT_STR = os.outputof(
- string.format(
- "%s %s -r %s filterproject -t %s -f %s %s",
- PYTHON, makedep, MAME_DIR, _OPTIONS["subtarget"], subtargetfilter, driverlist))
- if #OUT_STR == 0 then
- error("Error creating projects from driver filter file for subtarget " .. _OPTIONS["subtarget"])
+if _OPTIONS["with-emulator"] then
+ if (_OPTIONS["PROJECT"] ~= nil) then
+ PROJECT_DIR = path.join(path.getabsolute(".."),"projects",_OPTIONS["PROJECT"]) .. "/"
+ if (not os.isfile(path.join("..", "projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
+ error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
+ end
+ dofile (path.join(".." ,"projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
+ elseif (_OPTIONS["SOURCES"] == nil) and (_OPTIONS["SOURCEFILTER"] == nil) then
+ local subtargetscript = path.join("target", _OPTIONS["target"], _OPTIONS["subtarget"] .. ".lua")
+ local subtargetfilter = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["subtarget"] .. ".flt")
+ if os.isfile(subtargetscript) then
+ dofile(subtargetscript)
+ elseif os.isfile(subtargetfilter) then
+ local makedep = path.join(MAME_DIR, "scripts", "build", "makedep.py")
+ local driverlist = path.join(MAME_DIR, "src", _OPTIONS["target"], _OPTIONS["target"] .. ".lst")
+ local OUT_STR = os.outputof(
+ string.format(
+ "%s %s -r %s filterproject -t %s -f %s %s",
+ PYTHON, makedep, MAME_DIR, _OPTIONS["subtarget"], subtargetfilter, driverlist))
+ if #OUT_STR == 0 then
+ error("Error creating projects from driver filter file for subtarget " .. _OPTIONS["subtarget"])
+ end
+ load(OUT_STR)()
+ else
+ error("Definition file for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
end
- load(OUT_STR)()
- else
- error("Definition file for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
end
end
@@ -1480,32 +1487,34 @@ group "core"
dofile(path.join("src", "emu.lua"))
-if (STANDALONE~=true) then
- dofile(path.join("src", "mame", "frontend.lua"))
-end
-
group "devices"
dofile(path.join("src", "devices.lua"))
devicesProject(_OPTIONS["target"],_OPTIONS["subtarget"])
-if (STANDALONE~=true) then
- group "drivers"
- findfunction("createProjects_" .. _OPTIONS["target"] .. "_" .. _OPTIONS["subtarget"])(_OPTIONS["target"], _OPTIONS["subtarget"])
-end
+if _OPTIONS["with-emulator"] then
+ if (STANDALONE~=true) then
+ dofile(path.join("src", "mame", "frontend.lua"))
+ end
-group "emulator"
-dofile(path.join("src", "main.lua"))
-if (_OPTIONS["SOURCES"] == nil) and (_OPTIONS["SOURCEFILTER"] == nil) then
- if (_OPTIONS["target"] == _OPTIONS["subtarget"]) then
- startproject (_OPTIONS["target"])
+ if (STANDALONE~=true) then
+ group "drivers"
+ findfunction("createProjects_" .. _OPTIONS["target"] .. "_" .. _OPTIONS["subtarget"])(_OPTIONS["target"], _OPTIONS["subtarget"])
+ end
+
+ group "emulator"
+ dofile(path.join("src", "main.lua"))
+ if (_OPTIONS["SOURCES"] == nil) and (_OPTIONS["SOURCEFILTER"] == nil) then
+ if (_OPTIONS["target"] == _OPTIONS["subtarget"]) then
+ startproject (_OPTIONS["target"])
+ else
+ startproject (_OPTIONS["target"] .. _OPTIONS["subtarget"])
+ end
else
- startproject (_OPTIONS["target"] .. _OPTIONS["subtarget"])
+ startproject (_OPTIONS["subtarget"])
end
-else
- startproject (_OPTIONS["subtarget"])
+ mainProject(_OPTIONS["target"],_OPTIONS["subtarget"])
+ strip()
end
-mainProject(_OPTIONS["target"],_OPTIONS["subtarget"])
-strip()
if _OPTIONS["with-tools"] then
group "tools"
diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua
index bed80ebccb6..df53570a61e 100644
--- a/scripts/src/emu.lua
+++ b/scripts/src/emu.lua
@@ -9,6 +9,8 @@
--
---------------------------------------------------------------------------
+if _OPTIONS["with-emulator"] then
+
project ("emu")
uuid ("e6fa15e4-a354-4526-acef-13c8e80fcacf")
kind (LIBTYPE)
@@ -308,6 +310,7 @@ custombuildtask {
layoutbuildtask("emu/layout", "triphsxs"),
layoutbuildtask("emu/layout", "quadhsxs"),
}
+end
project ("precompile")
uuid ("a6fb15d4-b123-4445-acef-13c8e80fcacf")