From 9027ce95756981dc2efa87a91049d5273ea34c8a Mon Sep 17 00:00:00 2001 From: Julian Sikorski Date: Sat, 6 Jun 2015 23:39:24 +0200 Subject: Added the ability to use system flac, jpeg, lua, sqlite3, portmidi and zlib based on wallyweek's work --- scripts/src/3rdparty.lua | 42 +++++++- scripts/src/emu.lua | 48 +++++++-- scripts/src/lib.lua | 13 ++- scripts/src/main.lua | 41 +++++++- scripts/src/tools.lua | 264 ++++++++++++++++++++++++++++++++++++++++++----- 5 files changed, 369 insertions(+), 39 deletions(-) (limited to 'scripts/src') diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index 34c9a14599c..c2808c55dc5 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -34,6 +34,7 @@ end -- zlib library objects -------------------------------------------------- +if _OPTIONS["with-bundled-zlib"] then project "zlib" uuid "3d78bd2a-2bd0-4449-8087-42ddfaef7ec9" kind "StaticLib" @@ -71,6 +72,11 @@ project "zlib" "-Wshadow" } end +else +links { + "z", +} +end -------------------------------------------------- -- SoftFloat library objects @@ -112,6 +118,7 @@ project "softfloat" -- libJPEG library objects -------------------------------------------------- +if _OPTIONS["with-bundled-jpeg"] then project "jpeg" uuid "447c6800-dcfd-4c48-b72a-a8223bb409ca" kind "StaticLib" @@ -169,11 +176,17 @@ project "jpeg" "-Wshadow" } end +else +links { + "jpeg", +} +end -------------------------------------------------- -- libflac library objects -------------------------------------------------- +if _OPTIONS["with-bundled-flac"] then project "flac" uuid "b6fc19e8-073a-4541-bb7b-d24b548d424a" kind "StaticLib" @@ -223,6 +236,11 @@ project "flac" "-Wshadow" } end +else +links { + "FLAC", +} +end -------------------------------------------------- -- lib7z library objects @@ -268,6 +286,7 @@ project "7z" -- LUA library objects -------------------------------------------------- +if _OPTIONS["with-bundled-lua"] then project "lua" uuid "d9e2eed1-f1ab-4737-a6ac-863700b1a5a9" kind "StaticLib" @@ -342,6 +361,11 @@ project "lua" "-Wshadow" } end +else +links { + "lua", +} +end -------------------------------------------------- -- sqlite3 lua library objects @@ -362,8 +386,12 @@ project "lsqlite3" includedirs { MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", } + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end files { MAME_DIR .. "3rdparty/lsqlite3/lsqlite3.c", @@ -435,6 +463,7 @@ project "jsoncpp" -- SQLite3 library objects -------------------------------------------------- +if _OPTIONS["with-bundled-sqlite3"] then project "sqllite3" uuid "5cb3d495-57ed-461c-81e5-80dc0857517d" kind "StaticLib" @@ -455,11 +484,17 @@ project "sqllite3" "-Wshadow" } end +else +links { + "sqlite3", +} +end -------------------------------------------------- -- portmidi library objects -------------------------------------------------- if _OPTIONS["NO_USE_MIDI"]~="1" then +if _OPTIONS["with-bundled-portmidi"] then project "portmidi" uuid "587f2da6-3274-4a65-86a2-f13ea315bb98" kind "StaticLib" @@ -514,6 +549,11 @@ project "portmidi" "-Wshadow" } end +else +links { + "portmidi", +} +end end -------------------------------------------------- -- BGFX library objects diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index f81ca07af5c..2cd14d3cac4 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -15,8 +15,6 @@ includedirs { MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", GEN_DIR .. "emu/layout", } @@ -25,6 +23,16 @@ if _OPTIONS["with-bundled-expat"] then MAME_DIR .. "3rdparty/expat/lib", } end +if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } +end +if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } +end files { MAME_DIR .. "src/emu/emu.h", @@ -371,8 +379,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", GEN_DIR .. "emu/layout", MAME_DIR .. "src/emu/cpu/m68000", @@ -382,6 +388,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end dofile(path.join("src", "cpu.lua")) @@ -410,8 +426,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", MAME_DIR .. "src/mess", -- some mess bus devices need this MAME_DIR .. "src/mame", -- used for nes bus devices GEN_DIR .. "emu", @@ -422,6 +436,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end dofile(path.join("src", "bus.lua")) @@ -440,8 +464,6 @@ function emuProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/lua/src", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. "emu", } if _OPTIONS["with-bundled-expat"] then @@ -449,6 +471,16 @@ function emuProject(_target, _subtarget) MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["with-bundled-lua"] then + includedirs { + MAME_DIR .. "3rdparty/lua/src", + } + end files { disasm_files diff --git a/scripts/src/lib.lua b/scripts/src/lib.lua index 774e674db1a..dab7f0dc9c4 100644 --- a/scripts/src/lib.lua +++ b/scripts/src/lib.lua @@ -14,13 +14,17 @@ project "utils" MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", } if _OPTIONS["with-bundled-expat"] then includedirs { MAME_DIR .. "3rdparty/expat/lib", } end + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end files { MAME_DIR .. "src/lib/util/bitstream.h", @@ -110,9 +114,14 @@ project "formats" MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + files { MAME_DIR .. "src/lib/formats/2d_dsk.c", MAME_DIR .. "src/lib/formats/2d_dsk.h", diff --git a/scripts/src/main.lua b/scripts/src/main.lua index 809a18be70a..6bbdc01833c 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -95,16 +95,44 @@ function mainProject(_target, _subtarget) "expat", "softfloat", "jpeg", - "flac", "7z", "formats", "lua", "lsqlite3", - "sqllite3", - "zlib", "jsoncpp", "mongoose", } + + if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } + else + links { + "z", + } + end + + if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } + else + links { + "FLAC", + } + end + + if _OPTIONS["with-bundled-sqlite3"] then + links { + "sqllite3", + } + else + links { + "sqlite3", + } + end + if _OPTIONS["NO_USE_MIDI"]~="1" then links { "portmidi", @@ -130,11 +158,16 @@ function mainProject(_target, _subtarget) MAME_DIR .. "src/lib", MAME_DIR .. "src/lib/util", MAME_DIR .. "3rdparty", - MAME_DIR .. "3rdparty/zlib", GEN_DIR .. _target .. "/layout", GEN_DIR .. "resource", } + if _OPTIONS["with-bundled-zlib"] then + includedirs { + MAME_DIR .. "3rdparty/zlib", + } + end + if _OPTIONS["targetos"]=="macosx" and (not override_resources) then linkoptions { "-sectcreate __TEXT __info_plist " .. GEN_DIR .. "/resource/" .. _subtarget .. "-Info.plist" diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index b7a88f038f7..4f58b12d641 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -24,10 +24,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -60,12 +69,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -100,10 +127,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -138,12 +174,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/emu", @@ -179,12 +233,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -218,12 +290,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -257,10 +347,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -293,10 +392,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -329,10 +437,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -365,12 +482,30 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -403,10 +538,19 @@ end links { "utils", "expat", - "zlib", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -439,13 +583,31 @@ end links { "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], "netlist", } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib/util", @@ -480,12 +642,30 @@ links { "formats", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", @@ -521,12 +701,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", @@ -562,12 +760,30 @@ links { "emu", "utils", "expat", - "zlib", - "flac", "7z", "ocore_" .. _OPTIONS["osd"], } +if _OPTIONS["with-bundled-zlib"] then + links { + "zlib", + } +else + links { + "z", + } +end + +if _OPTIONS["with-bundled-flac"] then + links { + "flac", + } +else + links { + "FLAC", + } +end + includedirs { MAME_DIR .. "src/osd", MAME_DIR .. "src/lib", -- cgit v1.2.3-70-g09d2