Merge pull request #203 from belegdol/master

Added the ability to use system flac, jpeg, lua, sqlite3, portmidi and zlib based on wallyweek's work
This brings the system lib capabilities back to where they were prior to build system rewrite [Julian Sikorski]
This commit is contained in:
Miodrag Milanović 2015-06-07 06:20:28 +02:00
commit cee210f47e
15 changed files with 504 additions and 54 deletions

View File

@ -47,7 +47,11 @@
#define luaL_openlib(L,name,reg,nup) luaL_setfuncs(L,reg,nup)
#endif
#ifndef USE_SYSTEM_SQLITE
#include "sqlite3/sqlite3.h"
#else
#include <sqlite3.h>
#endif
/* compile time features */
#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK)

View File

@ -53,6 +53,12 @@
# LDOPTS =
# USE_SYSTEM_LIB_EXPAT = 1
# USE_SYSTEM_LIB_ZLIB = 1
# USE_SYSTEM_LIB_JPEG = 1
# USE_SYSTEM_LIB_FLAC = 1
# USE_SYSTEM_LIB_LUA = 1
# USE_SYSTEM_LIB_SQLITE3 = 1
# USE_SYSTEM_LIB_PORTMIDI = 1
# MESA_INSTALL_ROOT = /opt/mesa
# SDL_INSTALL_ROOT = /opt/sdl2
@ -294,6 +300,30 @@ ifndef USE_SYSTEM_LIB_EXPAT
PARAMS += --with-bundled-expat
endif
ifndef USE_SYSTEM_LIB_ZLIB
PARAMS += --with-bundled-zlib
endif
ifndef USE_SYSTEM_LIB_JPEG
PARAMS += --with-bundled-jpeg
endif
ifndef USE_SYSTEM_LIB_FLAC
PARAMS += --with-bundled-flac
endif
ifndef USE_SYSTEM_LIB_LUA
PARAMS += --with-bundled-lua
endif
ifndef USE_SYSTEM_LIB_SQLITE3
PARAMS += --with-bundled-sqlite3
endif
ifndef USE_SYSTEM_LIB_PORTMIDI
PARAMS += --with-bundled-portmidi
endif
#-------------------------------------------------
# distribution may change things
#-------------------------------------------------
@ -1048,8 +1078,12 @@ CPPCHECK_PARAMS += -Isrc/osd/modules/render
CPPCHECK_PARAMS += -Isrc/osd/windows
CPPCHECK_PARAMS += -Isrc/emu/cpu/m68000
CPPCHECK_PARAMS += -I3rdparty
ifndef USE_SYSTEM_LIB_LUA
CPPCHECK_PARAMS += -I3rdparty/lua/src
endif
ifndef USE_SYSTEM_LIB_ZLIB
CPPCHECK_PARAMS += -I3rdparty/zlib
endif
CPPCHECK_PARAMS += -I3rdparty/bgfx/include
CPPCHECK_PARAMS += -I3rdparty/bx/include
CPPCHECK_PARAMS += -Ibuild/generated/emu
@ -1062,7 +1096,9 @@ CPPCHECK_PARAMS += -DMAME_DEBUG
CPPCHECK_PARAMS += -DMAME_PROFILER
CPPCHECK_PARAMS += -DCRLF=3
CPPCHECK_PARAMS += -DLSB_FIRST
ifndef USE_SYSTEM_LIB_FLAC
CPPCHECK_PARAMS += -DFLAC__NO_DLL
endif
CPPCHECK_PARAMS += -DNATIVE_DRC=drcbe_x64
CPPCHECK_PARAMS += -DLUA_COMPAT_APIINTCASTS
CPPCHECK_PARAMS += -DWIN32

View File

@ -98,6 +98,36 @@ newoption {
description = 'Build bundled Expat library',
}
newoption {
trigger = 'with-bundled-zlib',
description = 'Build bundled Zlib library',
}
newoption {
trigger = 'with-bundled-jpeg',
description = 'Build bundled JPEG library',
}
newoption {
trigger = 'with-bundled-flac',
description = 'Build bundled FLAC library',
}
newoption {
trigger = 'with-bundled-lua',
description = 'Build bundled LUA library',
}
newoption {
trigger = 'with-bundled-sqlite3',
description = 'Build bundled SQLite library',
}
newoption {
trigger = 'with-bundled-portmidi',
description = 'Build bundled PortMidi library',
}
newoption {
trigger = "distro",
description = "Choose distribution",
@ -596,9 +626,29 @@ else
end
-- need to ensure FLAC functions are statically linked
defines {
"FLAC__NO_DLL",
}
if _OPTIONS["with-bundled-flac"] then
defines {
"FLAC__NO_DLL",
}
end
if not _OPTIONS["with-bundled-jpeg"] then
defines {
"USE_SYSTEM_JPEGLIB",
}
end
if not _OPTIONS["with-bundled-portmidi"] then
defines {
"USE_SYSTEM_PORTMIDI",
}
end
if not _OPTIONS["with-bundled-sqlite3"] then
defines {
"USE_SYSTEM_SQLITE",
}
end
if _OPTIONS["NOASM"]=="1" then
defines {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,9 +68,13 @@ function createProjects_ldplayer_ldplayer(_target, _subtarget)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mame/layout",
}
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
files{
MAME_DIR .. "src/emu/drivers/emudummy.c",
@ -89,4 +93,4 @@ function linkProjects_ldplayer_ldplayer(_target, _subtarget)
links {
"drvldplayer",
}
end
end

View File

@ -774,9 +774,14 @@ function createMAMEProjects(_target, _subtarget, _name)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mame/layout",
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
end
function createProjects_mame_arcade(_target, _subtarget)

View File

@ -29,9 +29,13 @@ function createProjects_mame_dummy(_target, _subtarget)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mess/layout",
}
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
files{
MAME_DIR .. "src/mess/drivers/coleco.c",
@ -43,4 +47,4 @@ function linkProjects_mame_dummy(_target, _subtarget)
links {
"mame_dummy",
}
end
end

View File

@ -874,11 +874,15 @@ function createMESSProjects(_target, _subtarget, _name)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mess/layout",
GEN_DIR .. "mame/layout",
MAME_DIR .. "src/emu/cpu/m68000",
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
end
function createProjects_mame_mess(_target, _subtarget)

View File

@ -96,9 +96,14 @@ function createProjects_mame_nl(_target, _subtarget)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mame/layout",
}
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
files{
MAME_DIR .. "src/mame/drivers/pong.c",

View File

@ -92,9 +92,13 @@ function createProjects_mame_tiny(_target, _subtarget)
MAME_DIR .. "src/lib",
MAME_DIR .. "src/lib/util",
MAME_DIR .. "3rdparty",
MAME_DIR .. "3rdparty/zlib",
GEN_DIR .. "mame/layout",
}
}
if _OPTIONS["with-bundled-zlib"] then
includedirs {
MAME_DIR .. "3rdparty/zlib",
}
end
files{
MAME_DIR .. "src/mame/machine/ticket.c",

View File

@ -10,7 +10,11 @@
#ifndef NO_USE_MIDI
#ifndef USE_SYSTEM_PORTMIDI
#include "portmidi/pm_common/portmidi.h"
#else
#include <portmidi.h>
#endif
#include "osdcore.h"
#include "corealloc.h"
#include "modules/osdmodule.h"