Make building emulator optional (allow building tools without building MAME) (#11889)

This commit is contained in:
Miodrag Milanović 2024-01-01 02:41:59 +01:00 committed by GitHub
parent 7a1c86c4d1
commit d5340b8be4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 43 deletions

View File

@ -20,6 +20,7 @@
# TARGET = mame
# SUBTARGET = tiny
# TOOLS = 1
# EMULATOR = 1
# TESTS = 1
# BENCHMARKS = 1
# OSD = sdl
@ -650,6 +651,14 @@ PARAMS += --with-tools
endif
endif
ifndef EMULATOR
PARAMS += --with-emulator
else
ifeq '$(EMULATOR)' '1'
PARAMS += --with-emulator
endif
endif
ifdef TESTS
ifneq '$(TESTS)' '0'
PARAMS += --with-tests

View File

@ -120,6 +120,11 @@ newoption {
description = "Enable building tools.",
}
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
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"])
if _OPTIONS["with-emulator"] then
if (STANDALONE~=true) then
dofile(path.join("src", "mame", "frontend.lua"))
end
else
startproject (_OPTIONS["subtarget"])
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["subtarget"])
end
mainProject(_OPTIONS["target"],_OPTIONS["subtarget"])
strip()
end
mainProject(_OPTIONS["target"],_OPTIONS["subtarget"])
strip()
if _OPTIONS["with-tools"] then
group "tools"

View File

@ -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")