summaryrefslogtreecommitdiffstatshomepage
path: root/scripts/genie.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/genie.lua')
-rw-r--r--scripts/genie.lua165
1 files changed, 118 insertions, 47 deletions
diff --git a/scripts/genie.lua b/scripts/genie.lua
index cfe0efeff9e..475c110ecb5 100644
--- a/scripts/genie.lua
+++ b/scripts/genie.lua
@@ -44,8 +44,8 @@ function findfunction(x)
end
function layoutbuildtask(_folder, _name)
- return { MAME_DIR .. "src/".._folder.."/".. _name ..".lay" , GEN_DIR .. _folder .. "/".._name..".lh",
- { MAME_DIR .. "src/build/file2str.py" }, {"@echo Converting src/".._folder.."/".._name..".lay...", PYTHON .. " $(1) $(<) $(@) layout_".._name }};
+ return { MAME_DIR .. "src/".._folder.."/".. _name ..".lay" , GEN_DIR .. _folder .. "/".._name..".lh",
+ { MAME_DIR .. "scripts/build/file2str.py" }, {"@echo Converting src/".._folder.."/".._name..".lay...", PYTHON .. " $(1) $(<) $(@) layout_".._name }};
end
CPUS = {}
@@ -283,6 +283,15 @@ newoption {
}
newoption {
+ trigger = "SSE3",
+ description = "SSE3 optimized code and SSE3 code generation.",
+ allowed = {
+ { "0", "Disabled" },
+ { "1", "Enabled" },
+ }
+}
+
+newoption {
trigger = "OPENMP",
description = "OpenMP optimized code.",
allowed = {
@@ -361,8 +370,17 @@ newoption {
}
newoption {
- trigger = "DRIVERS",
- description = "List of drivers to compile.",
+ trigger = "SOURCES",
+ description = "List of sources to compile.",
+}
+
+newoption {
+ trigger = "FORCE_VERSION_COMPILE",
+ description = "Force compiling of version.c file.",
+ allowed = {
+ { "0", "Disabled" },
+ { "1", "Enabled" },
+ }
}
if _OPTIONS["SHLIB"]=="1" then
@@ -410,7 +428,7 @@ else
solution (_OPTIONS["subtarget"])
else
solution (_OPTIONS["target"] .. _OPTIONS["subtarget"])
- end
+ end
end
configurations {
@@ -448,7 +466,7 @@ configuration { "Debug", "vs*" }
flags {
"Symbols",
}
-
+
configuration { "Release", "vs*" }
flags {
"Optimize",
@@ -498,15 +516,15 @@ msgarchiving ("Archiving $(notdir $@)...")
messageskip { "SkipCreatingMessage", "SkipBuildingMessage", "SkipCleaningMessage" }
-if (_OPTIONS["DRIVERS"] == nil) then
+if (_OPTIONS["SOURCES"] == nil) then
if (not os.isfile(path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))) then
error("File definition for TARGET=" .. _OPTIONS["target"] .. " SUBTARGET=" .. _OPTIONS["subtarget"] .. " does not exist")
end
dofile (path.join("target", _OPTIONS["target"],_OPTIONS["subtarget"] .. ".lua"))
else
- OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " target " .. _OPTIONS["subtarget"])
+ OUT_STR = os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " target " .. _OPTIONS["subtarget"])
load(OUT_STR)()
- os.outputof( PYTHON .. " " .. MAME_DIR .. "src/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["DRIVERS"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.c")
+ os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.c")
end
configuration { "gmake" }
flags {
@@ -561,7 +579,7 @@ if _OPTIONS["FASTDEBUG"]=="1" then
}
end
-configuration { }
+configuration { }
if _OPTIONS["PROFILER"]=="1" then
defines{
@@ -704,22 +722,38 @@ if (_OPTIONS["targetos"]=="solaris") then
}
else
buildoptions_c {
+-- "-std=gnu99",
"-std=gnu89",
-
+-- "-Wpedantic",
+-- "-pedantic",
+-- "-Wno-variadic-macros",
+-- "-Wno-long-long",
}
-end
+end
+
-
if _OPTIONS["CPP11"]=="1" then
buildoptions_cpp {
"-x c++",
"-std=gnu++11",
+-- "-std=c++11",
+-- "-Wpedantic",
+-- "-pedantic",
+-- "-Wno-variadic-macros",
+-- "-Wno-long-long",
+
}
else
--we compile C++ code to C++98 standard with GNU extensions
buildoptions_cpp {
"-x c++",
+-- "-Wpedantic",
+-- "-pedantic",
"-std=gnu++98",
+ "-Wno-variadic-macros",
+ "-Wno-long-long",
+ "-Wno-variadic-macros",
+-- "-std=c++98",
}
end
@@ -815,21 +849,33 @@ if _OPTIONS["OPTIMIZE"] then
}
end
if _OPTIONS["LTO"]=="1" then
--- -flto=4 -> 4 threads, reduce if you are low on memory (less than 8G)
buildoptions {
- "-flto=4",
- }
- buildoptions {
- "-fno-fat-lto-objects",
- }
- linkoptions {
- "-flto=4",
+-- windows native mingw GCC 5.2 fails with -flto=x with x > 1. bug unfixed as of this date
+ "-flto=1",
+ "-fuse-linker-plugin",
+-- these next flags allow MAME to compile in GCC 5.2. odr warnings should be fixed as LTO randomly crashes otherwise
+-- some GCC 4.9.x on Windows do not have -Wodr and -flto-odr-type-merging enabled. adjust accordingly...
+-- -ffat-lto-objects lets you link non-lto version without rebuilding all .o/.a
+ "-ffat-lto-objects",
+ "-flto-odr-type-merging",
+ "-Wodr",
+ "-flto-compression-level=9", -- lto didn't work with anything <9 on linux with < 12G RAM
+-- "-flto-report", -- if you get an error in lto after [WPA] stage, but before [LTRANS] stage, you need more memory!
+-- "-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report",
}
+-- same flags are needed by linker
linkoptions {
- "-fno-fat-lto-objects",
+ "-Wl,-no-keep-memory",
+ "-flto=1",
+ "-fuse-linker-plugin",
+ "-ffat-lto-objects",
+ "-flto-odr-type-merging",
+ "-Wodr",
+ "-flto-compression-level=9", -- lto didn't work with anything < 9 on linux with < 12G RAM
+-- "-flto-report", -- if you get an error in lto after [WPA] stage, but before [LTRANS] stage, you need more memory!
+-- "-fmem-report-wpa","-fmem-report","-fpre-ipa-mem-report","-fpost-ipa-mem-report","-flto-report-wpa","-fmem-report",
}
-
-
+
end
end
@@ -846,6 +892,15 @@ if _OPTIONS["SSE2"]=="1" then
}
end
+if _OPTIONS["SSE3"]=="1" then
+ buildoptions {
+ "-msse",
+ "-msse2",
+ "-msse3"
+ }
+end
+
+
if _OPTIONS["OPENMP"]=="1" then
buildoptions {
"-fopenmp",
@@ -856,7 +911,7 @@ if _OPTIONS["OPENMP"]=="1" then
defines {
"USE_OPENMP=1",
}
-
+
else
buildoptions {
"-Wno-unknown-pragmas",
@@ -898,7 +953,7 @@ end
"-Wpointer-arith",
"-Wstrict-prototypes",
}
-
+
if _OPTIONS["targetos"]~="freebsd" then
buildoptions_c {
"-Wbad-function-cast",
@@ -950,6 +1005,11 @@ end
"-Wno-extern-c-compat",
}
end
+ if (version >= 70000) then
+ buildoptions {
+ "-Wno-tautological-undefined-compare",
+ }
+ end
else
if (version == 40201) then
buildoptions {
@@ -969,17 +1029,29 @@ end
}
end
if (version >= 40800) then
- -- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
- buildoptions {
- "-Wno-array-bounds"
- }
+-- grr.. array-bounds works on GCC5.2 linux, but fails in sqllite3.c on MingW GCC 5.1.1 for now
+-- if (version < 50000) then
+-- -- array bounds checking seems to be buggy in 4.8.1 (try it on video/stvvdp1.c and video/model1.c without -Wno-array-bounds)
+ buildoptions {
+ "-Wno-array-bounds"
+ }
+-- end
end
if (version >= 50000) then
buildoptions {
- "-D__USE_MINGW_ANSI_STDIO=1",
+-- "-D__USE_MINGW_ANSI_STDIO=1", -- required or lua won't compile linux ignores this but Windows needs it
+ "-freport-bug",
+ "-D_GLIBCXX_USE_CXX11_ABI=0", -- does not seem to matter in linux, mingw needs to link printf,etc
+-- "-DNO_MEM_TRACKING", -- must comment out for mingw GCC 5.2 pedantic or get new/delete redef error
+-- next two should work, but compiler complains about end conditions that are int when loop variable is unsigned. maybe these can be fixed
+-- "-funsafe-loop-optimizations",
+-- "-Wunsafe-loop-optimizations",
+-- this six flag combo lets MAME compile with LTO=1 on linux with no errors and ~2% speed boost, but compile time is much longer
+-- "-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
+-- "-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
+
}
end
-
end
end
--ifeq ($(findstring arm,$(UNAME)),arm)
@@ -1007,6 +1079,11 @@ configuration { "asmjs" }
"-std=gnu++98",
}
archivesplit_size "20"
+ if os.getenv("EMSCRIPTEN") then
+ includedirs {
+ os.getenv("EMSCRIPTEN") .. "/system/lib/libcxxabi/include"
+ }
+ end
configuration { "android*" }
buildoptions {
@@ -1085,7 +1162,7 @@ configuration { "vs*" }
buildoptions {
"/wd4025", -- warning C4025: 'number' : based pointer passed to function with variable arguments: parameter number
"/wd4003", -- warning C4003: not enough actual parameters for macro 'xxx'
- "/wd4018", -- warning C4018: 'x' : signed/unsigned mismatch
+ "/wd4018", -- warning C4018: 'x' : signed/unsigned mismatch
"/wd4061", -- warning C4061: enumerator 'xxx' in switch of enum 'xxx' is not explicitly handled by a case label
"/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter
"/wd4127", -- warning C4127: conditional expression is constant
@@ -1129,7 +1206,7 @@ configuration { "vs*" }
"/wd4365", -- warning C4365: 'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch
"/wd4389", -- warning C4389: 'operator' : signed/unsigned mismatch
"/wd4245", -- warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
- "/wd4388", -- warning C4388:
+ "/wd4388", -- warning C4388:
"/wd4267", -- warning C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
"/wd4005", -- warning C4005: The macro identifier is defined twice. The compiler uses the second macro definition
"/wd4350", -- warning C4350: behavior change: 'member1' called instead of 'member2'
@@ -1138,10 +1215,10 @@ configuration { "vs*" }
"/wd4060", -- warning C4060: switch statement contains no 'case' or 'default' labels
"/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels
"/wd4640", -- warning C4640: 'instance' : construction of local static object is not thread-safe
- "/wd4290", -- warning C4290:
+ "/wd4290", -- warning C4290:
"/wd4355", -- warning C4355: 'this' : used in base member initializer list
"/wd4800", -- warning C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
- "/wd4371", -- warning C4371:
+ "/wd4371", -- warning C4371:
"/wd4548", -- warning C4548: expression before comma has no effect; expected expression with side-effect
}
if _OPTIONS["vs"]=="intel-15" then
@@ -1194,22 +1271,13 @@ configuration { "vs2015" }
"/wd4091", -- warning C4091: 'typedef ': ignored on left of '' when no variable is declared
"/wd4463", -- warning C4463: overflow; assigning 1 to bit-field that can only hold values from -1 to 0
"/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does
+ "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size
}
configuration { "vs2010" }
buildoptions {
"/wd4481", -- warning C4481: nonstandard extension used: override specifier 'override'
}
-configuration { "x32", "vs*" }
- libdirs {
- MAME_DIR .. "3rdparty/dxsdk/lib/x86",
- }
-
-configuration { "x64", "vs*" }
- libdirs {
- MAME_DIR .. "3rdparty/dxsdk/lib/x64",
- }
-
configuration { "winphone8* or winstore8*" }
removelinks {
"DelayImp",
@@ -1243,7 +1311,10 @@ dofile(path.join("src", "3rdparty.lua"))
group "core"
dofile(path.join("src", "emu.lua"))
-emuProject(_OPTIONS["target"],_OPTIONS["subtarget"])
+
+group "devices"
+dofile(path.join("src", "devices.lua"))
+devicesProject(_OPTIONS["target"],_OPTIONS["subtarget"])
group "drivers"
findfunction("createProjects_" .. _OPTIONS["target"] .. "_" .. _OPTIONS["subtarget"])(_OPTIONS["target"], _OPTIONS["subtarget"])