Skip to content

Commit 124f30d

Browse files
committed
Enable building projects that are separate of MAME but use same core and lives in separate git tree (nw)
1 parent 3408ed0 commit 124f30d

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
!/language/
2222
!/nl_examples/
2323
!/plugins/
24+
!/projects/
2425
!/regtests/
2526
!/samples/
2627
!/scripts/

makefile

+8
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ endif
217217
# build scripts will be run from
218218
# scripts/target/$(TARGET)/$(SUBTARGET).lua
219219
#-------------------------------------------------
220+
ifdef PROJECT
221+
PARAMS += --PROJECT='$(PROJECT)'
222+
TARGET := $(PROJECT)
223+
endif
220224

221225
ifndef TARGET
222226
TARGET := mame
@@ -800,8 +804,12 @@ SCRIPTS += scripts/target/$(TARGET)/mess.lua
800804
endif
801805

802806
ifndef SOURCES
807+
ifdef PROJECT
808+
SCRIPTS += projects/$(PROJECT)/scripts/target/$(TARGET)/$(SUBTARGET_FULL).lua
809+
else
803810
SCRIPTS += scripts/target/$(TARGET)/$(SUBTARGET_FULL).lua
804811
endif
812+
endif
805813

806814
ifdef REGENIE
807815
SCRIPTS+= regenie

projects/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!/.gitignore
3+
!/README.md

projects/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# **Projects** #
2+
3+
This is place where source code projects outside of MAME lives.
4+
Here you can git clone that kind of project and make it with "make PROJECT=example"

scripts/genie.lua

+13-1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ newoption {
386386
description = "Produce WebAssembly output when building with Emscripten.",
387387
}
388388

389+
newoption {
390+
trigger = "PROJECT",
391+
description = "Select projects to be built. Will look into project folder for files.",
392+
}
393+
389394
dofile ("extlib.lua")
390395

391396
if _OPTIONS["SHLIB"]=="1" then
@@ -516,7 +521,14 @@ msgprecompile ("Precompiling $(subst ../,,$<)...")
516521

517522
messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" }
518523

519-
if (_OPTIONS["SOURCES"] == nil) then
524+
if (_OPTIONS["PROJECT"] ~= nil) then
525+
PROJECT_DIR = path.join(path.getabsolute(".."),"projects",_OPTIONS["PROJECT"]) .. "/"
526+
if (not os.isfile(path.join("..", "projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
527+
error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
528+
end
529+
dofile (path.join(".." ,"projects", _OPTIONS["PROJECT"], "scripts", "target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
530+
end
531+
if (_OPTIONS["SOURCES"] == nil and _OPTIONS["PROJECT"] == nil) then
520532
if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
521533
error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
522534
end

scripts/src/main.lua

+4
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,12 @@ end
276276
links {
277277
ext_lib("zlib"),
278278
ext_lib("flac"),
279+
}
280+
if (STANDALONE~=true) then
281+
links {
279282
ext_lib("sqlite3"),
280283
}
284+
end
281285

282286
if _OPTIONS["NO_USE_MIDI"]~="1" then
283287
links {

0 commit comments

Comments
 (0)