2015-05-09 16:05:30 +02:00
-- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team
2016-05-08 19:07:18 +02:00
STANDALONE = false
2015-05-09 16:05:30 +02:00
2016-11-03 10:04:29 +01:00
-- Big project specific
premake.make . makefile_ignore = true
premake._checkgenerate = false
2015-11-02 22:37:01 +11:00
newoption {
2016-03-29 08:49:47 +02:00
trigger = ' build-dir ' ,
description = ' Build directory name ' ,
2015-11-02 22:37:01 +11:00
}
2015-03-26 09:00:39 +01:00
premake.check_paths = true
premake.make . override = { " TARGET " }
2016-02-26 20:30:37 +01:00
2015-03-26 09:00:39 +01:00
MAME_DIR = ( path.getabsolute ( " .. " ) .. " / " )
2015-12-20 09:45:39 +01:00
--MAME_DIR = string.gsub(MAME_DIR, "(%s)", "\\%1")
2015-11-02 22:37:01 +11:00
local MAME_BUILD_DIR = ( MAME_DIR .. _OPTIONS [ " build-dir " ] .. " / " )
2015-03-26 09:00:39 +01:00
local naclToolchain = " "
2016-04-02 17:48:31 +02:00
newoption {
trigger = " precompile " ,
description = " Precompiled headers generation. " ,
allowed = {
{ " 0 " , " Disabled " } ,
{ " 1 " , " Enabled " } ,
}
}
2015-03-26 09:00:39 +01:00
2015-04-02 22:53:14 +11:00
function backtick ( cmd )
2015-04-02 19:04:09 +02:00
result = string.gsub ( string.gsub ( os.outputof ( cmd ) , " \r ? \n $ " , " " ) , " $ " , " " )
return result
2015-04-02 22:53:14 +11:00
end
function str_to_version ( str )
2015-03-26 09:00:39 +01:00
local val = 0
2022-05-17 03:16:54 +10:00
if not str then
2015-03-26 09:00:39 +01:00
return val
end
2022-05-17 03:16:54 +10:00
local scale = 10000
for word , sep in str : gmatch ( ' ([^.-]+)([.-]?) ' ) do
local part = tonumber ( word )
if not part then
return val
end
val = val + tonumber ( word ) * scale
scale = scale // 100
if ( scale == 0 ) or ( sep ~= ' . ' ) then
2019-10-17 21:40:16 -05:00
return val
end
2015-03-26 09:00:39 +01:00
end
2016-03-29 08:49:47 +02:00
return val
2015-03-26 09:00:39 +01:00
end
2015-03-28 15:19:21 +01:00
function findfunction ( x )
2016-03-29 08:49:47 +02:00
assert ( type ( x ) == " string " )
2022-05-17 03:16:54 +10:00
local f = _G
2016-03-29 08:49:47 +02:00
for v in x : gmatch ( " [^%.]+ " ) do
2022-05-17 03:16:54 +10:00
if type ( f ) ~= " table " then
return nil , " looking for ' " .. v .. " ' expected table, not " .. type ( f )
end
f = f [ v ]
2016-03-29 08:49:47 +02:00
end
if type ( f ) == " function " then
2022-05-17 03:16:54 +10:00
return f
2016-03-29 08:49:47 +02:00
else
2022-05-17 03:16:54 +10:00
return nil , " expected function, not " .. type ( f )
2016-03-29 08:49:47 +02:00
end
2015-03-28 15:19:21 +01:00
end
2015-04-04 14:44:06 +02:00
function layoutbuildtask ( _folder , _name )
2015-10-05 10:28:46 -05:00
return { MAME_DIR .. " src/ " .. _folder .. " / " .. _name .. " .lay " , GEN_DIR .. _folder .. " / " .. _name .. " .lh " ,
2016-03-30 20:38:44 +02:00
{ MAME_DIR .. " scripts/build/complay.py " } , { " @echo Compressing src/ " .. _folder .. " / " .. _name .. " .lay... " , PYTHON .. " $(1) $(<) $(@) layout_ " .. _name } } ;
2015-04-04 14:44:06 +02:00
end
2015-03-29 14:48:29 +11:00
2016-01-01 07:56:20 +01:00
function precompiledheaders ( )
2016-04-02 17:48:31 +02:00
if _OPTIONS [ " precompile " ] == nil or ( _OPTIONS [ " precompile " ] ~= nil and _OPTIONS [ " precompile " ] == " 1 " ) then
2021-10-26 10:59:28 +02:00
pchheader ( " emu.h " )
2016-04-02 17:48:31 +02:00
configuration { }
end
2016-01-01 07:56:20 +01:00
end
2019-08-13 19:20:53 +02:00
function precompiledheaders_novs ( )
precompiledheaders ( )
if string.sub ( _ACTION , 1 , 4 ) == " vs20 " then
--print("Disabling pch for Visual Studio")
flags {
" NoPCH "
}
end
end
2015-12-06 17:07:50 +01:00
function addprojectflags ( )
local version = str_to_version ( _OPTIONS [ " gcc_version " ] )
2016-07-30 18:03:24 +10:00
if _OPTIONS [ " gcc " ] ~= nil and string.find ( _OPTIONS [ " gcc " ] , " gcc " ) then
2019-11-01 17:27:05 +01:00
buildoptions_cpp {
" -Wsuggest-override " ,
}
2015-12-06 17:07:50 +01:00
end
end
2021-03-04 09:36:22 +01:00
function opt_tool ( hash , entry )
if _OPTIONS [ " with-tools " ] then
hash [ entry ] = true
return true
end
return hash [ entry ]
end
2015-03-26 09:00:39 +01:00
CPUS = { }
SOUNDS = { }
MACHINES = { }
VIDEOS = { }
BUSES = { }
2016-08-12 18:27:54 +02:00
FORMATS = { }
2015-03-26 09:00:39 +01:00
newoption {
trigger = " with-tools " ,
description = " Enable building tools. " ,
2015-03-31 18:34:57 +11:00
}
2015-03-26 09:00:39 +01:00
2024-01-01 02:41:59 +01:00
newoption {
trigger = " with-emulator " ,
description = " Enable building emulator. " ,
}
2015-05-27 15:02:33 +02:00
newoption {
trigger = " with-tests " ,
description = " Enable building tests. " ,
}
2016-01-29 11:47:40 +01:00
newoption {
trigger = " with-benchmarks " ,
description = " Enable building benchmarks. " ,
}
2015-03-26 09:00:39 +01:00
newoption {
trigger = " osd " ,
2015-04-04 18:25:04 +11:00
description = " Choose OSD layer implementation " ,
2015-03-26 09:00:39 +01:00
}
newoption {
trigger = " targetos " ,
description = " Choose target OS " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " android " , " Android " } ,
2015-03-29 15:17:21 +02:00
{ " asmjs " , " Emscripten/asm.js " } ,
{ " freebsd " , " FreeBSD " } ,
2015-04-04 15:13:48 +11:00
{ " netbsd " , " NetBSD " } ,
{ " openbsd " , " OpenBSD " } ,
2016-03-29 08:49:47 +02:00
{ " linux " , " Linux " } ,
2015-03-29 15:17:21 +02:00
{ " macosx " , " OSX " } ,
{ " windows " , " Windows " } ,
2015-04-04 15:13:48 +11:00
{ " haiku " , " Haiku " } ,
2015-04-10 12:37:34 +02:00
{ " solaris " , " Solaris SunOS " } ,
2015-03-26 09:00:39 +01:00
} ,
}
newoption {
trigger = " target " ,
description = " Building target " ,
}
newoption {
trigger = " subtarget " ,
description = " Building subtarget " ,
}
newoption {
trigger = " gcc_version " ,
description = " GCC compiler version " ,
}
2015-03-26 14:43:39 +01:00
newoption {
trigger = " CC " ,
description = " CC replacement " ,
}
2015-03-26 15:49:06 +01:00
newoption {
trigger = " CXX " ,
description = " CXX replacement " ,
}
2015-03-26 14:43:39 +01:00
newoption {
trigger = " LD " ,
description = " LD replacement " ,
}
2021-03-30 13:57:51 +02:00
newoption {
trigger = " AR " ,
description = " AR replacement " ,
}
2015-11-02 21:05:34 -06:00
newoption {
trigger = " TOOLCHAIN " ,
description = " Toolchain prefix "
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " PROFILE " ,
description = " Enable profiling. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " SYMBOLS " ,
description = " Enable symbols. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " SYMLEVEL " ,
description = " Symbols level. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " PROFILER " ,
description = " Include the internal profiler. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " OPTIMIZE " ,
description = " Optimization level. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
newoption {
trigger = " ARCHOPTS " ,
2018-11-29 14:10:27 +11:00
description = " Additional options for target C/C++/Objective-C/Objective-C++ compilers and linker. " ,
}
newoption {
trigger = " ARCHOPTS_C " ,
description = " Additional options for target C++ compiler. " ,
}
newoption {
trigger = " ARCHOPTS_CXX " ,
description = " Additional options for target C++ compiler. " ,
}
newoption {
trigger = " ARCHOPTS_OBJC " ,
description = " Additional options for target Objective-C compiler. " ,
}
newoption {
trigger = " ARCHOPTS_OBJCXX " ,
description = " Additional options for target Objective-C++ compiler. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
2015-06-06 13:38:19 +02:00
newoption {
trigger = " OPT_FLAGS " ,
description = " OPT_FLAGS. " ,
}
2015-03-29 18:58:39 +02:00
newoption {
trigger = " LDOPTS " ,
description = " Additional linker options " ,
2015-04-02 19:04:09 +02:00
}
2015-03-29 18:58:39 +02:00
2015-03-26 15:45:59 +01:00
newoption {
trigger = " MAP " ,
description = " Generate a link map. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
2015-04-01 16:11:48 +11:00
newoption {
trigger = " NOASM " ,
description = " Disable implementations based on assembler code " ,
allowed = {
{ " 0 " , " Enable assembler code " } ,
{ " 1 " , " Disable assembler code " } ,
} ,
}
2015-04-02 22:22:19 +11:00
newoption {
trigger = " BIGENDIAN " ,
description = " Build for big endian target " ,
allowed = {
{ " 0 " , " Little endian target " } ,
{ " 1 " , " Big endian target " } ,
} ,
}
2015-03-26 19:29:26 +01:00
newoption {
trigger = " FORCE_DRC_C_BACKEND " ,
description = " Force DRC C backend. " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 19:29:26 +01:00
2015-03-28 07:03:44 +01:00
newoption {
trigger = " NOWERROR " ,
description = " NOWERROR " ,
2015-04-02 19:04:09 +02:00
}
2015-03-28 07:03:44 +01:00
2015-04-06 16:27:14 +02:00
newoption {
trigger = " DEPRECATED " ,
description = " Generate deprecation warnings during compilation. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-06 16:27:14 +02:00
{ " 1 " , " Enabled " } ,
}
}
newoption {
trigger = " LTO " ,
description = " Clang link time optimization. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-06 16:27:14 +02:00
{ " 1 " , " Enabled " } ,
}
}
newoption {
trigger = " SSE2 " ,
description = " SSE2 optimized code and SSE2 code generation. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-06 16:27:14 +02:00
{ " 1 " , " Enabled " } ,
}
}
2015-07-23 10:33:55 -05:00
newoption {
trigger = " SSE3 " ,
description = " SSE3 optimized code and SSE3 code generation. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-07-23 10:33:55 -05:00
{ " 1 " , " Enabled " } ,
}
}
2015-04-06 16:27:14 +02:00
newoption {
trigger = " OPENMP " ,
description = " OpenMP optimized code. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-06 16:27:14 +02:00
{ " 1 " , " Enabled " } ,
}
}
2015-04-08 08:52:02 +02:00
newoption {
trigger = " SEPARATE_BIN " ,
description = " Use separate bin folders. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-08 08:52:02 +02:00
{ " 1 " , " Enabled " } ,
}
}
2015-04-08 14:19:43 +02:00
newoption {
trigger = " PYTHON_EXECUTABLE " ,
description = " Python executable. " ,
}
2015-04-11 08:46:02 +02:00
newoption {
trigger = " SHADOW_CHECK " ,
description = " Shadow checks. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-11 08:46:02 +02:00
{ " 1 " , " Enabled " } ,
}
}
2015-04-19 16:21:36 +02:00
newoption {
2015-04-22 14:23:49 +02:00
trigger = " STRIP_SYMBOLS " ,
description = " Symbols stripping. " ,
2015-04-19 16:21:36 +02:00
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-22 14:23:49 +02:00
{ " 1 " , " Enabled " } ,
2015-04-19 16:21:36 +02:00
}
}
2015-04-11 08:46:02 +02:00
2015-05-31 13:20:42 +02:00
newoption {
trigger = " SHLIB " ,
description = " Generate shared libs. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Static libs " } ,
2015-05-31 13:20:42 +02:00
{ " 1 " , " Shared libs " } ,
}
}
2015-06-20 18:20:10 +02:00
newoption {
2015-10-09 14:13:35 +02:00
trigger = " SOURCES " ,
description = " List of sources to compile. " ,
2015-06-20 18:20:10 +02:00
}
2022-06-28 16:33:06 +10:00
newoption {
trigger = " SOURCEFILTER " ,
description = " Filter list specifying sources to compile. " ,
}
2015-12-27 15:35:29 +01:00
newoption {
trigger = " PLATFORM " ,
description = " Target machine platform (x86,arm,...) " ,
}
2016-04-12 15:43:15 +02:00
newoption {
trigger = " DEBUG_DIR " ,
description = " Default directory for debugger. " ,
}
newoption {
trigger = " DEBUG_ARGS " ,
description = " Arguments for running debug build. " ,
}
2016-10-29 06:00:45 +00:00
newoption {
trigger = " WEBASSEMBLY " ,
description = " Produce WebAssembly output when building with Emscripten. " ,
}
2018-01-12 01:18:12 +01:00
newoption {
trigger = " SANITIZE " ,
description = " Specifies the santizer(s) to use. "
}
2016-12-08 11:46:15 +01:00
newoption {
trigger = " PROJECT " ,
description = " Select projects to be built. Will look into project folder for files. " ,
}
2016-03-28 22:26:30 -05:00
dofile ( " extlib.lua " )
2016-03-28 12:09:19 -05:00
2015-05-31 13:20:42 +02:00
if _OPTIONS [ " SHLIB " ] == " 1 " then
LIBTYPE = " SharedLib "
else
LIBTYPE = " StaticLib "
end
2021-10-09 12:16:17 +11:00
PYTHON = " python3 "
2015-04-08 14:19:43 +02:00
if _OPTIONS [ " PYTHON_EXECUTABLE " ] ~= nil then
PYTHON = _OPTIONS [ " PYTHON_EXECUTABLE " ]
end
2015-04-02 22:22:19 +11:00
if not _OPTIONS [ " BIGENDIAN " ] then
_OPTIONS [ " BIGENDIAN " ] = " 0 "
end
2015-04-01 16:11:48 +11:00
if _OPTIONS [ " NOASM " ] == " 1 " and not _OPTIONS [ " FORCE_DRC_C_BACKEND " ] then
_OPTIONS [ " FORCE_DRC_C_BACKEND " ] = " 1 "
end
2015-11-02 21:05:34 -06:00
if ( _OPTIONS [ " TOOLCHAIN " ] == nil ) then
_OPTIONS [ ' TOOLCHAIN ' ] = " "
end
2015-03-26 09:00:39 +01:00
GEN_DIR = MAME_BUILD_DIR .. " generated/ "
2015-03-26 09:35:10 +01:00
if ( _OPTIONS [ " target " ] == nil ) then return false end
if ( _OPTIONS [ " subtarget " ] == nil ) then return false end
2015-03-26 09:00:39 +01:00
if ( _OPTIONS [ " target " ] == _OPTIONS [ " subtarget " ] ) then
solution ( _OPTIONS [ " target " ] )
else
2022-06-27 18:06:20 +10:00
solution ( _OPTIONS [ " target " ] .. _OPTIONS [ " subtarget " ] )
2015-04-01 16:11:48 +11:00
end
2015-03-26 09:00:39 +01:00
2016-02-27 16:53:15 +01:00
2015-04-01 16:11:48 +11:00
configurations {
" Debug " ,
" Release " ,
}
2015-03-26 09:00:39 +01:00
2021-10-26 10:59:28 +02:00
platforms {
" x32 " ,
" x64 " ,
" Native " , -- for targets where bitness is not specified
}
2015-03-26 09:00:39 +01:00
2015-04-01 16:11:48 +11:00
language " C++ "
flags {
" StaticRuntime " ,
2021-04-03 21:00:51 +03:00
" Cpp17 " ,
2015-04-01 16:11:48 +11:00
}
if not _OPTIONS [ " NOWERROR " ] then
flags {
" FatalWarnings " ,
}
2015-03-28 07:03:44 +01:00
end
2015-04-02 19:04:09 +02:00
2018-12-30 12:54:48 -08:00
configuration { " Debug " , " vs20* " }
2015-04-01 16:11:48 +11:00
flags {
" Symbols " ,
2018-08-27 17:00:18 +01:00
" NoMultiProcessorCompilation " ,
2015-04-01 16:11:48 +11:00
}
2015-10-05 10:28:46 -05:00
2018-12-30 12:54:48 -08:00
configuration { " Release " , " vs20* " }
2015-04-05 15:15:02 +02:00
flags {
" Optimize " ,
2018-08-27 17:00:18 +01:00
" NoEditAndContinue " ,
" NoIncrementalLink " ,
2015-04-05 15:15:02 +02:00
}
2020-05-20 13:24:22 -04:00
if _OPTIONS [ " SYMBOLS " ] then
flags {
" Symbols " ,
}
end
2015-04-01 16:11:48 +11:00
configuration { }
2015-04-02 19:04:09 +02:00
2015-03-27 08:06:15 +01:00
msgcompile ( " Compiling $(subst ../,,$<)... " )
2015-03-26 09:00:39 +01:00
2015-03-27 08:06:15 +01:00
msgcompile_objc ( " Objective-C compiling $(subst ../,,$<)... " )
2015-03-26 09:00:39 +01:00
2015-03-27 08:06:15 +01:00
msgresource ( " Compiling resources $(subst ../,,$<)... " )
2015-03-26 09:00:39 +01:00
msglinking ( " Linking $(notdir $@)... " )
msgarchiving ( " Archiving $(notdir $@)... " )
2016-01-01 07:56:20 +01:00
msgprecompile ( " Precompiling $(subst ../,,$<)... " )
2015-03-26 09:00:39 +01:00
messageskip { " SkipCreatingMessage " , " SkipBuildingMessage " , " SkipCleaningMessage " }
2024-01-01 02:41:59 +01:00
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 " )
2022-07-07 11:54:01 +10:00
end
2015-06-20 18:20:10 +02:00
end
2015-03-26 09:00:39 +01:00
end
2016-01-17 17:53:03 +01:00
2016-06-09 13:46:36 +02:00
configuration { " gmake or ninja " }
2015-03-26 09:00:39 +01:00
flags {
" SingleOutputDir " ,
}
dofile ( " toolchain.lua " )
-- Avoid error when invoking genie --help.
if ( _ACTION == nil ) then return false end
-- define MAME_DEBUG if we are a debugging build
configuration { " Debug " }
defines {
" MAME_DEBUG " ,
2015-04-06 12:37:14 +02:00
" MAME_PROFILER " ,
2021-08-20 09:43:41 +02:00
-- "BGFX_CONFIG_DEBUG=1",
2015-03-26 09:00:39 +01:00
}
2016-03-20 15:14:59 +01:00
2015-10-05 10:28:46 -05:00
configuration { }
2015-04-06 12:37:14 +02:00
if _OPTIONS [ " PROFILER " ] == " 1 " then
defines {
" MAME_PROFILER " , -- define MAME_PROFILER if we are a profiling build
}
end
2015-03-26 15:45:59 +01:00
2015-03-26 09:00:39 +01:00
configuration { " Release " }
defines {
" NDEBUG " ,
}
configuration { }
2016-02-26 13:20:43 +01:00
-- CR/LF setup: use on win32, CR only on everything else
if _OPTIONS [ " targetos " ] == " windows " then
2015-03-26 09:00:39 +01:00
defines {
2015-04-01 16:11:48 +11:00
" CRLF=3 " ,
2015-03-26 09:00:39 +01:00
}
2015-04-01 16:11:48 +11:00
else
2015-03-26 09:00:39 +01:00
defines {
2015-04-01 16:11:48 +11:00
" CRLF=2 " ,
2015-03-26 09:00:39 +01:00
}
2015-04-01 16:11:48 +11:00
end
2015-03-26 09:00:39 +01:00
2015-04-01 16:11:48 +11:00
2015-04-02 22:22:19 +11:00
if _OPTIONS [ " BIGENDIAN " ] == " 1 " then
if _OPTIONS [ " targetos " ] == " macosx " then
defines {
" OSX_PPC " ,
}
buildoptions {
" -Wno-unused-label " ,
2015-11-18 19:32:15 +11:00
" -flax-vector-conversions " ,
2015-04-02 22:22:19 +11:00
}
if _OPTIONS [ " SYMBOLS " ] then
buildoptions {
" -mlong-branch " ,
}
end
configuration { " x64 " }
buildoptions {
" -arch ppc64 " ,
}
linkoptions {
" -arch ppc64 " ,
}
configuration { " x32 " }
buildoptions {
" -arch ppc " ,
}
linkoptions {
" -arch ppc " ,
}
configuration { }
end
else
defines {
" LSB_FIRST " ,
}
if _OPTIONS [ " targetos " ] == " macosx " then
2020-12-12 20:00:04 -05:00
configuration { " arm64 " }
buildoptions {
" -arch arm64 " ,
}
linkoptions {
" -arch arm64 " ,
}
configuration { " x64 " , " not arm64 " }
2015-04-02 22:22:19 +11:00
buildoptions {
" -arch x86_64 " ,
}
linkoptions {
" -arch x86_64 " ,
}
2020-12-12 20:00:04 -05:00
configuration { " x32 " , " not arm64 " }
2015-04-02 22:22:19 +11:00
buildoptions {
" -arch i386 " ,
}
linkoptions {
" -arch i386 " ,
}
2015-04-06 10:46:21 +02:00
configuration { }
2015-04-02 22:22:19 +11:00
end
end
2015-04-01 16:11:48 +11:00
2016-03-28 22:26:30 -05:00
if _OPTIONS [ " with-system-jpeg " ] ~= nil then
defines {
" XMD_H " ,
}
end
2016-03-30 11:03:03 +02:00
if not _OPTIONS [ " with-system-flac " ] ~= nil then
2015-06-06 23:39:24 +02:00
defines {
" FLAC__NO_DLL " ,
}
2016-03-28 22:26:30 -05:00
end
2015-04-01 16:11:48 +11:00
2018-03-18 15:30:55 +01:00
if not _OPTIONS [ " with-system-pugixml " ] then
defines {
" PUGIXML_HEADER_ONLY " ,
}
else
links {
ext_lib ( " pugixml " ) ,
}
end
2025-04-20 02:36:58 +10:00
if _OPTIONS [ " NOASM " ] == " 1 " then
2015-04-01 16:11:48 +11:00
defines {
" MAME_NOASM "
}
end
2025-04-20 02:36:58 +10:00
if _OPTIONS [ " FORCE_DRC_C_BACKEND " ] then
configuration { }
defines {
" NATIVE_DRC=drcbe_c " ,
}
elseif ( _OPTIONS [ " PLATFORM " ] == " x86 " ) or ( _OPTIONS [ " PLATFORM " ] == " arm64 " ) then
2025-01-14 00:44:16 +09:00
configuration { }
defines {
" ASMJIT_STATIC " ,
}
2015-04-01 16:11:48 +11:00
end
2015-04-02 19:04:09 +02:00
2015-03-26 09:00:39 +01:00
defines {
2016-02-14 08:16:35 +01:00
" LUA_COMPAT_ALL " ,
" LUA_COMPAT_5_1 " ,
" LUA_COMPAT_5_2 " ,
2015-03-26 09:00:39 +01:00
}
2016-06-09 13:46:36 +02:00
if _ACTION == " gmake " or _ACTION == " ninja " then
2015-03-26 09:00:39 +01:00
2016-01-04 15:29:19 +01:00
--we compile C-only to C99 standard with GNU extensions
2015-04-10 13:56:33 +02:00
buildoptions_c {
" -std=gnu99 " ,
}
2015-10-05 10:28:46 -05:00
2015-12-03 13:33:40 +01:00
local version = str_to_version ( _OPTIONS [ " gcc_version " ] )
buildoptions_cpp {
2020-11-15 03:53:47 +11:00
" -std=c++17 " ,
2015-12-03 13:33:40 +01:00
}
2015-04-10 13:56:33 +02:00
2016-11-02 17:19:29 +01:00
buildoptions_objcpp {
2020-11-15 03:53:47 +11:00
" -std=c++17 " ,
2015-12-03 13:33:40 +01:00
}
2015-03-26 09:00:39 +01:00
-- this speeds it up a bit by piping between the preprocessor/compiler/assembler
2021-10-26 10:32:43 +02:00
buildoptions {
" -pipe " ,
}
2015-03-26 09:00:39 +01:00
-- add -g if we need symbols, and ensure we have frame pointers
2015-06-03 08:02:20 +02:00
if _OPTIONS [ " SYMBOLS " ] ~= nil and _OPTIONS [ " SYMBOLS " ] ~= " 0 " then
2015-03-26 15:45:59 +01:00
buildoptions {
" -g " .. _OPTIONS [ " SYMLEVEL " ] ,
" -fno-omit-frame-pointer " ,
" -fno-optimize-sibling-calls " ,
}
end
2015-03-26 09:00:39 +01:00
--# we need to disable some additional implicit optimizations for profiling
2015-03-26 15:45:59 +01:00
if _OPTIONS [ " PROFILE " ] then
buildoptions {
" -mno-omit-leaf-frame-pointer " ,
}
end
2015-03-26 09:00:39 +01:00
-- add -v if we need verbose build information
2015-03-26 15:45:59 +01:00
if _OPTIONS [ " VERBOSE " ] then
buildoptions {
" -v " ,
}
end
2015-03-26 09:00:39 +01:00
2015-05-15 22:05:55 -04:00
-- only show shadow warnings when enabled
if ( _OPTIONS [ " SHADOW_CHECK " ] == " 1 " ) then
buildoptions {
" -Wshadow "
}
2015-05-16 11:01:19 +02:00
end
2015-05-15 22:05:55 -04:00
2015-03-26 09:00:39 +01:00
-- only show deprecation warnings when enabled
2018-02-28 21:19:37 +11:00
if _OPTIONS [ " DEPRECATED " ] == " 0 " then
2015-03-26 09:00:39 +01:00
buildoptions {
" -Wno-deprecated-declarations "
}
2015-04-06 16:27:14 +02:00
end
2015-03-26 09:00:39 +01:00
-- add profiling information for the compiler
2015-03-26 15:45:59 +01:00
if _OPTIONS [ " PROFILE " ] then
buildoptions {
" -pg " ,
}
linkoptions {
" -pg " ,
}
end
2015-03-26 16:57:32 +01:00
2015-06-03 08:02:20 +02:00
if _OPTIONS [ " SYMBOLS " ] ~= nil and _OPTIONS [ " SYMBOLS " ] ~= " 0 " then
2015-03-26 16:57:32 +01:00
flags {
" Symbols " ,
2015-04-02 19:04:09 +02:00
}
2015-03-26 15:45:59 +01:00
end
2015-03-26 09:00:39 +01:00
2016-03-14 19:31:41 +11:00
-- add the error warning flag
2015-03-28 07:03:44 +01:00
if _OPTIONS [ " NOWERROR " ] == nil then
2015-03-26 09:00:39 +01:00
buildoptions {
" -Werror " ,
}
2015-03-28 07:03:44 +01:00
end
2015-03-26 09:00:39 +01:00
-- if we are optimizing, include optimization options
2015-03-26 15:45:59 +01:00
if _OPTIONS [ " OPTIMIZE " ] then
buildoptions {
2016-03-30 21:56:03 +00:00
" -O " .. _OPTIONS [ " OPTIMIZE " ] ,
2015-04-02 19:04:09 +02:00
" -fno-strict-aliasing "
2015-03-26 15:45:59 +01:00
}
2015-06-06 13:38:19 +02:00
if _OPTIONS [ " OPT_FLAGS " ] then
buildoptions {
_OPTIONS [ " OPT_FLAGS " ]
}
end
2015-04-06 16:27:14 +02:00
if _OPTIONS [ " LTO " ] == " 1 " then
buildoptions {
2015-12-09 12:58:08 -06:00
-- windows native mingw GCC 5.2 fails with -flto=x with x > 1. bug unfixed as of this commit
2015-10-05 10:28:46 -05:00
" -flto=1 " ,
2015-12-09 12:58:08 -06:00
-- if ld fails, just buy more RAM or uncomment this!
2016-03-29 08:49:47 +02:00
-- "-Wl,-no-keep-memory",
2015-12-09 12:58:08 -06:00
" -Wl,-v " ,
-- silence redefine warnings from discrete.c.
" -Wl,-allow-multiple-definition " ,
2015-10-05 10:28:46 -05:00
" -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...
2015-12-09 12:58:08 -06:00
-- no-fat-lto-objects is faster to compile and uses less memory, but you can't mix with a non-lto .o/.a without rebuilding
" -fno-fat-lto-objects " ,
2015-07-23 10:33:55 -05:00
" -flto-odr-type-merging " ,
2015-10-05 10:28:46 -05:00
" -Wodr " ,
2015-12-09 12:58:08 -06:00
" -flto-compression-level=0 " , -- lto doesn't work with anything <9 on linux with < 12G RAM, much slower if <> 0
2016-03-29 08:49:47 +02:00
-- "-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",
2015-12-09 12:58:08 -06:00
-- 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
-- if you are going to wait on lto, you might as well enable these for GCC
2016-03-29 08:49:47 +02:00
-- "-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
-- "-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
2015-04-06 16:27:14 +02:00
}
2015-07-23 10:33:55 -05:00
-- same flags are needed by linker
2015-04-06 16:27:14 +02:00
linkoptions {
2015-10-05 10:28:46 -05:00
" -flto=1 " ,
2016-03-29 08:49:47 +02:00
-- "-Wl,-no-keep-memory",
2015-12-09 12:58:08 -06:00
" -Wl,-v " ,
" -Wl,-allow-multiple-definition " ,
2015-10-05 10:28:46 -05:00
" -fuse-linker-plugin " ,
2015-12-09 12:58:08 -06:00
" -fno-fat-lto-objects " ,
2015-07-23 10:33:55 -05:00
" -flto-odr-type-merging " ,
2015-10-05 10:28:46 -05:00
" -Wodr " ,
2015-12-09 12:58:08 -06:00
" -flto-compression-level=0 " , -- lto doesn't work with anything <9 on linux with < 12G RAM, much slower if <> 0
2016-03-29 08:49:47 +02:00
-- "-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",
2015-12-09 12:58:08 -06:00
-- 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
-- if you are going to wait on lto, you might as well enable these for GCC
2016-03-29 08:49:47 +02:00
-- "-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
-- "-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
2015-12-09 12:58:08 -06:00
2015-04-06 16:27:14 +02:00
}
2015-10-05 10:28:46 -05:00
2015-04-06 16:27:14 +02:00
end
2015-03-26 15:45:59 +01:00
end
2015-03-26 09:00:39 +01:00
2016-03-30 21:56:03 +00:00
configuration { " mingw-clang " }
buildoptions {
2017-12-25 18:13:15 +00:00
" -Xclang -flto-visibility-public-std " , -- workround for __imp___ link errors
2019-10-13 19:56:15 +01:00
" -Wno-nonportable-include-path " , -- workround for clang 9.0.0 case sensitivity bug when including GL/glext.h
2016-03-30 21:56:03 +00:00
}
configuration { }
if _OPTIONS [ " ARCHOPTS " ] then
buildoptions {
_OPTIONS [ " ARCHOPTS " ]
}
linkoptions {
_OPTIONS [ " ARCHOPTS " ]
}
end
2018-11-29 14:10:27 +11:00
if _OPTIONS [ " ARCHOPTS_C " ] then
buildoptions_c {
_OPTIONS [ " ARCHOPTS_C " ]
}
end
if _OPTIONS [ " ARCHOPTS_CXX " ] then
buildoptions_cpp {
_OPTIONS [ " ARCHOPTS_CXX " ]
}
end
if _OPTIONS [ " ARCHOPTS_OBJC " ] then
buildoptions_objc {
_OPTIONS [ " ARCHOPTS_OBJC " ]
}
end
if _OPTIONS [ " ARCHOPTS_OBJCXX " ] then
buildoptions_objcpp {
_OPTIONS [ " ARCHOPTS_OBJCXX " ]
}
end
2015-05-31 13:20:42 +02:00
if _OPTIONS [ " SHLIB " ] then
buildoptions {
" -fPIC "
}
end
2015-04-06 16:27:14 +02:00
if _OPTIONS [ " SSE2 " ] == " 1 " then
buildoptions {
2015-06-19 14:29:35 -05:00
" -msse " ,
2015-06-19 20:45:13 -05:00
" -msse2 "
2015-04-06 16:27:14 +02:00
}
end
2015-03-26 09:00:39 +01:00
2015-07-23 10:33:55 -05:00
if _OPTIONS [ " SSE3 " ] == " 1 " then
buildoptions {
" -msse " ,
" -msse2 " ,
" -msse3 "
}
end
2015-04-06 16:27:14 +02:00
if _OPTIONS [ " OPENMP " ] == " 1 " then
buildoptions {
" -fopenmp " ,
}
2015-04-16 23:44:30 +02:00
linkoptions {
" -fopenmp "
}
2015-04-17 18:05:01 +02:00
defines {
" USE_OPENMP=1 " ,
}
2015-10-05 10:28:46 -05:00
2015-04-06 16:27:14 +02:00
else
buildoptions {
" -Wno-unknown-pragmas " ,
}
end
2015-03-26 15:45:59 +01:00
2015-03-29 18:58:39 +02:00
if _OPTIONS [ " LDOPTS " ] then
2015-04-16 23:44:30 +02:00
linkoptions {
_OPTIONS [ " LDOPTS " ]
}
2015-03-29 18:58:39 +02:00
end
2015-03-26 15:45:59 +01:00
if _OPTIONS [ " MAP " ] then
if ( _OPTIONS [ " target " ] == _OPTIONS [ " subtarget " ] ) then
linkoptions {
2015-03-27 08:06:15 +01:00
" -Wl,-Map, " .. " ../../../../ " .. _OPTIONS [ " target " ] .. " .map "
2015-03-26 15:45:59 +01:00
}
else
linkoptions {
2015-03-27 08:06:15 +01:00
" -Wl,-Map, " .. " ../../../../ " .. _OPTIONS [ " target " ] .. _OPTIONS [ " subtarget " ] .. " .map "
2015-03-26 15:45:59 +01:00
}
2015-04-02 19:04:09 +02:00
end
2015-03-26 16:37:53 +01:00
end
2015-04-06 16:27:14 +02:00
2015-03-26 09:00:39 +01:00
-- add a basic set of warnings
buildoptions {
" -Wall " ,
" -Wcast-align " ,
" -Wformat-security " ,
2020-11-17 03:51:20 +11:00
" -Wundef " ,
2015-03-26 09:00:39 +01:00
" -Wwrite-strings " ,
" -Wno-conversion " ,
2020-11-17 03:51:20 +11:00
" -Wno-sign-compare " ,
2018-02-28 21:19:37 +11:00
" -Wno-error=deprecated-declarations " ,
2015-03-26 09:00:39 +01:00
}
-- warnings only applicable to C compiles
buildoptions_c {
" -Wpointer-arith " ,
" -Wstrict-prototypes " ,
}
2015-10-05 10:28:46 -05:00
2015-04-10 12:37:34 +02:00
if _OPTIONS [ " targetos " ] ~= " freebsd " then
buildoptions_c {
" -Wbad-function-cast " ,
}
end
2015-03-26 09:00:39 +01:00
-- warnings only applicable to OBJ-C compiles
2016-11-02 17:19:29 +01:00
buildoptions_objcpp {
2015-03-26 09:00:39 +01:00
" -Wpointer-arith " ,
}
-- warnings only applicable to C++ compiles
buildoptions_cpp {
" -Woverloaded-virtual " ,
2023-02-01 16:12:58 +11:00
" -Wvla " ,
2015-03-26 09:00:39 +01:00
}
2018-01-28 14:25:52 +11:00
2018-01-12 01:18:12 +01:00
if _OPTIONS [ " SANITIZE " ] then
buildoptions {
" -fsanitize= " .. _OPTIONS [ " SANITIZE " ]
}
linkoptions {
" -fsanitize= " .. _OPTIONS [ " SANITIZE " ]
}
if string.find ( _OPTIONS [ " SANITIZE " ] , " address " ) then
buildoptions {
" -fsanitize-address-use-after-scope "
}
linkoptions {
" -fsanitize-address-use-after-scope "
}
end
if string.find ( _OPTIONS [ " SANITIZE " ] , " undefined " ) then
-- 'function' produces errors without delegates by design
-- 'alignment' produces a lot of errors which we are not interested in
buildoptions {
" -fno-sanitize=function " ,
2018-01-14 01:46:49 +01:00
" -fno-sanitize=alignment "
2018-01-12 01:18:12 +01:00
}
linkoptions {
" -fno-sanitize=function " ,
2018-01-14 01:46:49 +01:00
" -fno-sanitize=alignment "
2018-01-12 01:18:12 +01:00
}
end
end
2015-03-26 09:00:39 +01:00
--ifneq (,$(findstring thread,$(SANITIZE)))
--CCOMFLAGS += -fPIE
--endif
2015-04-02 19:04:09 +02:00
2015-03-26 09:00:39 +01:00
local version = str_to_version ( _OPTIONS [ " gcc_version " ] )
2021-10-26 10:32:43 +02:00
if string.find ( _OPTIONS [ " gcc " ] , " clang " ) or string.find ( _OPTIONS [ " gcc " ] , " asmjs " ) or string.find ( _OPTIONS [ " gcc " ] , " android " ) then
2024-03-28 00:11:18 +11:00
if version < 70000 then
print ( " Clang version 7.0 or later needed " )
2015-12-03 11:40:45 +01:00
os.exit ( - 1 )
end
2015-03-26 09:00:39 +01:00
buildoptions {
2016-04-09 22:26:27 +00:00
" -fdiagnostics-show-note-include-stack " ,
2024-11-27 06:15:56 +11:00
" -Wno-error=tautological-compare " ,
2020-11-17 03:51:20 +11:00
" -Wno-cast-align " ,
" -Wno-constant-logical-operand " ,
2022-02-24 16:42:30 +11:00
" -Wno-extern-c-compat " ,
" -Wno-ignored-qualifiers " ,
2020-11-17 03:51:20 +11:00
" -Wno-pragma-pack " , -- clang 6.0 complains when the packing change lifetime is not contained within a header file.
" -Wno-unknown-attributes " ,
" -Wno-unknown-warning-option " ,
" -Wno-unused-value " ,
2021-05-26 22:35:19 +02:00
" -Wno-unused-const-variable " ,
2015-03-26 09:00:39 +01:00
}
2020-10-29 12:40:25 +11:00
if ( ( version >= 100000 ) and ( _OPTIONS [ " targetos " ] ~= ' macosx ' ) ) or ( version >= 120000 ) then
2020-06-18 11:17:03 -04:00
buildoptions {
2020-11-17 03:51:20 +11:00
" -Wno-xor-used-as-pow " , -- clang 10.0 complains that expressions like 10 ^ 7 look like exponention
2020-06-18 11:17:03 -04:00
}
end
2022-05-18 18:39:43 +01:00
if version >= 140000 then
buildoptions {
" -Wno-bitwise-instead-of-logical " , -- clang 14.0 complains about &, | on bools in asmjit
}
end
2015-03-26 09:00:39 +01:00
else
2024-03-28 00:11:18 +11:00
if version < 100300 then
print ( " GCC version 10.3 or later needed " )
2015-12-03 11:40:45 +01:00
os.exit ( - 1 )
end
2022-04-06 04:15:25 +10:00
buildoptions_cpp {
" -Wimplicit-fallthrough " ,
}
buildoptions_objcpp {
" -Wimplicit-fallthrough " ,
}
buildoptions {
2023-03-25 05:53:58 +11:00
" -Wno-error=unused-result " , -- needed for fgets,fread on linux
2022-04-06 04:15:25 +10:00
-- 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)
2024-03-28 00:11:18 +11:00
" -Wno-error=array-bounds " ,
2022-04-06 04:15:25 +10:00
" -Wno-error=attributes " , -- GCC fails to recognize some uses of [[maybe_unused]]
2024-03-28 00:11:18 +11:00
" -Wno-error=stringop-truncation " , -- ImGui again
2024-03-31 02:37:24 +11:00
" -Wno-stringop-overflow " , -- generates false positives when assigning an int rvalue to a u8 variable without an explicit cast
2024-03-28 00:11:18 +11:00
}
2022-04-06 04:15:25 +10:00
if version >= 110000 then
2021-05-20 13:04:46 -04:00
buildoptions {
2021-05-23 17:33:52 +10:00
" -Wno-nonnull " , -- luaengine.cpp lambdas do not need "this" captured but GCC 11.1 erroneously insists
" -Wno-stringop-overread " , -- machine/bbc.cpp in GCC 11.1
2021-05-20 13:04:46 -04:00
}
end
2022-05-11 17:26:57 -04:00
if version >= 120000 then
buildoptions {
2022-05-17 03:16:54 +10:00
" -Wno-error=maybe-uninitialized " ,
" -Wno-error=uninitialized " , -- netlist
2022-05-11 17:26:57 -04:00
}
end
2023-04-29 21:46:16 -04:00
if version >= 130000 then
buildoptions_cpp {
2023-04-29 22:33:00 -04:00
" -Wno-xor-used-as-pow " ,
2023-04-29 21:46:16 -04:00
}
end
2015-03-26 09:00:39 +01:00
end
end
2016-03-29 08:49:47 +02:00
2015-12-27 15:35:29 +01:00
if ( _OPTIONS [ " PLATFORM " ] == " arm " ) then
buildoptions {
" -Wno-cast-align " ,
}
end
2015-03-26 09:00:39 +01:00
2016-03-11 13:09:47 +01:00
if ( _OPTIONS [ " PLATFORM " ] == " arm64 " ) then
buildoptions {
" -Wno-cast-align " ,
}
2016-07-14 01:01:04 +02:00
end
2015-03-27 08:06:15 +01:00
local subdir
if ( _OPTIONS [ " target " ] == _OPTIONS [ " subtarget " ] ) then
2015-03-28 15:38:12 +11:00
subdir = _OPTIONS [ " osd " ] .. " / " .. _OPTIONS [ " target " ]
2015-03-27 08:06:15 +01:00
else
2015-04-02 19:04:09 +02:00
subdir = _OPTIONS [ " osd " ] .. " / " .. _OPTIONS [ " target " ] .. _OPTIONS [ " subtarget " ]
end
2015-03-27 08:06:15 +01:00
2015-03-29 14:48:29 +11:00
if not toolchain ( MAME_BUILD_DIR , subdir ) then
2015-03-26 09:00:39 +01:00
return -- no action specified
end
2015-04-02 19:04:09 +02:00
2015-03-26 09:00:39 +01:00
configuration { " asmjs " }
buildoptions {
" -std=gnu89 " ,
" -Wno-implicit-function-declaration " ,
2016-03-17 01:42:48 +00:00
" -s USE_SDL_TTF=2 " ,
2015-03-26 09:00:39 +01:00
}
buildoptions_cpp {
2020-11-15 03:53:47 +11:00
" -std=c++17 " ,
2021-12-22 20:16:57 +00:00
" -s EXCEPTION_CATCHING_ALLOWED= \" ['_ZN15running_machine17start_all_devicesEv','_ZN12cli_frontend7executeEiPPc','_ZN8chd_file11open_commonEb','_ZN8chd_file13read_metadataEjjRNSt3__212basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE','_ZN8chd_file13read_metadataEjjRNSt3__26vectorIhNS0_9allocatorIhEEEE','_ZNK19netlist_mame_device19base_validity_checkER16validity_checker'] \" " ,
2015-03-26 09:00:39 +01:00
}
2024-03-13 11:04:01 -07:00
defines {
2024-03-13 23:03:49 -07:00
" ASIO_HAS_PTHREADS " ,
2025-06-05 17:48:32 -07:00
" SOUND_DISABLE_THREADING " ,
2024-03-13 11:04:01 -07:00
}
2018-01-31 02:26:32 +00:00
linkoptions {
" -Wl,--start-group " ,
2021-12-22 20:16:57 +00:00
" -s USE_SDL=2 " ,
" -s USE_SDL_TTF=2 " ,
2021-12-30 23:39:00 +00:00
" -s DEFAULT_LIBRARY_FUNCS_TO_INCLUDE= \" [' \\ $$ERRNO_CODES'] \" " ,
2021-12-22 20:16:57 +00:00
" -s EXPORTED_FUNCTIONS= \" ['_main', '_malloc', '__ZN15running_machine30emscripten_get_running_machineEv', '__ZN15running_machine17emscripten_get_uiEv', '__ZN15running_machine20emscripten_get_soundEv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey', '__ZN15running_machine15emscripten_saveEPKc', '__ZN15running_machine15emscripten_loadEPKc', '__ZN15running_machine21emscripten_hard_resetEv', '__ZN15running_machine21emscripten_soft_resetEv', '__ZN15running_machine15emscripten_exitEv'] \" " ,
" -s EXPORTED_RUNTIME_METHODS= \" ['cwrap'] \" " ,
" -s ERROR_ON_UNDEFINED_SYMBOLS=0 " ,
2025-02-06 08:45:34 +01:00
" -s STACK_SIZE=5MB " ,
" -s MAX_WEBGL_VERSION=2 " ,
2021-12-22 20:16:57 +00:00
" --pre-js " .. _MAKE.esc ( MAME_DIR ) .. " src/osd/modules/sound/js_sound.js " ,
" --post-js " .. _MAKE.esc ( MAME_DIR ) .. " scripts/resources/emscripten/emscripten_post.js " ,
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " bgfx/chains@bgfx/chains " ,
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " bgfx/effects@bgfx/effects " ,
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " bgfx/shaders/essl@bgfx/shaders/essl " ,
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " artwork/bgfx@artwork/bgfx " ,
2025-02-06 08:45:34 +01:00
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " artwork/lut-default.png@artwork/lut-default.png " ,
2021-12-22 20:16:57 +00:00
" --embed-file " .. _MAKE.esc ( MAME_DIR ) .. " artwork/slot-mask.png@artwork/slot-mask.png " ,
2018-01-31 02:26:32 +00:00
}
2025-07-05 18:18:11 -07:00
if _OPTIONS [ " OPTIMIZE " ] ~= nil then
if _OPTIONS [ " OPTIMIZE " ] == " 3 " then
-- emcc's link-time -O3 is very slow, max out at -O2 for now
-- we should still be getting the benefit of -O3 on the individual object files
linkoptions {
" -O2 " ,
}
else
linkoptions {
" -O " .. _OPTIONS [ " OPTIMIZE " ] ,
}
end
end
2021-12-22 20:16:57 +00:00
if _OPTIONS [ " SYMBOLS " ] ~= nil and _OPTIONS [ " SYMBOLS " ] ~= " 0 " then
linkoptions {
" -g " .. _OPTIONS [ " SYMLEVEL " ] ,
}
end
if _OPTIONS [ " WEBASSEMBLY " ] then
linkoptions {
" -s WASM= " .. _OPTIONS [ " WEBASSEMBLY " ] ,
}
else
linkoptions {
" -s WASM=1 " ,
}
end
if _OPTIONS [ " WEBASSEMBLY " ] ~= nil and _OPTIONS [ " WEBASSEMBLY " ] == " 0 " then
-- define a fixed memory size because allowing memory growth disables asm.js optimizations
linkoptions {
" -s ALLOW_MEMORY_GROWTH=0 " ,
2025-02-06 08:45:34 +01:00
" -s INITIAL_MEMORY=256MB " ,
2021-12-22 20:16:57 +00:00
}
else
linkoptions {
" -s ALLOW_MEMORY_GROWTH=1 " ,
2025-02-06 08:45:34 +01:00
" -s INITIAL_MEMORY=24MB "
2021-12-22 20:16:57 +00:00
}
end
2015-03-26 09:00:39 +01:00
archivesplit_size " 20 "
configuration { " android* " }
2015-04-18 12:51:33 +02:00
buildoptions {
2023-02-26 19:40:37 +01:00
" -Wno-error=undef " , -- in ASIO
" -Wno-error=macro-redefined " , -- PAGE_SIZE,PAGE_MASK in fairlight/cmi.cpp
2015-03-26 09:00:39 +01:00
}
archivesplit_size " 20 "
2022-04-03 14:34:38 +10:00
configuration { " linux-* " }
2015-03-26 09:00:39 +01:00
links {
" dl " ,
2016-02-15 11:20:54 +01:00
" rt " ,
2015-03-26 09:00:39 +01:00
}
2022-06-17 23:51:57 +10:00
flags {
" LinkSupportCircularDependencies " ,
}
2015-03-26 14:01:14 +01:00
2015-03-26 09:00:39 +01:00
2023-05-28 03:39:39 +10:00
configuration { " freebsd or netbsd " }
2022-07-03 17:51:04 +00:00
flags {
" LinkSupportCircularDependencies " ,
}
2016-01-25 20:01:40 +01:00
2021-10-26 10:59:28 +02:00
configuration { " osx* " }
2015-03-26 09:00:39 +01:00
links {
" pthread " ,
}
2016-01-04 15:29:19 +01:00
configuration { " mingw* " }
2020-06-21 16:28:33 +02:00
if _OPTIONS [ " osd " ] == " sdl " then
linkoptions {
" -Wl,--start-group " ,
}
else
2017-12-26 11:10:56 +00:00
linkoptions {
" -static " ,
}
2020-06-21 16:28:33 +02:00
flags {
" LinkSupportCircularDependencies " ,
}
2017-12-26 11:10:56 +00:00
end
2016-01-04 13:28:40 +01:00
links {
" user32 " ,
" winmm " ,
" advapi32 " ,
" shlwapi " ,
" wsock32 " ,
2016-01-31 15:38:51 +01:00
" ws2_32 " ,
" psapi " ,
" iphlpapi " ,
" shell32 " ,
" userenv " ,
2016-01-04 13:28:40 +01:00
}
2016-11-16 10:27:15 +01:00
2018-12-30 12:54:48 -08:00
configuration { " vs20* " }
2015-03-26 09:00:39 +01:00
defines {
" XML_STATIC " ,
" WIN32 " ,
" _WIN32 " ,
" _CRT_NONSTDC_NO_DEPRECATE " ,
" _CRT_SECURE_NO_DEPRECATE " ,
2016-08-28 11:58:12 +02:00
" _CRT_STDIO_LEGACY_WIDE_SPECIFIERS " ,
2015-03-26 09:00:39 +01:00
}
2019-05-26 13:10:03 +10:00
2015-03-26 09:00:39 +01:00
links {
" user32 " ,
" winmm " ,
" advapi32 " ,
" shlwapi " ,
" wsock32 " ,
2016-01-31 15:38:51 +01:00
" ws2_32 " ,
" psapi " ,
" iphlpapi " ,
" shell32 " ,
" userenv " ,
2015-03-26 09:00:39 +01:00
}
2025-05-13 11:38:55 +07:00
if _OPTIONS [ " vs " ] == nil then
2015-03-26 09:00:39 +01:00
buildoptions {
2025-05-13 11:38:55 +07:00
" /bigobj " ,
2024-11-27 00:39:05 +07:00
" /permissive- " ,
2025-05-13 11:38:55 +07:00
" /utf-8 " ,
" /Zc:enumTypes " ,
" /Zc:preprocessor " ,
" /Zc:templateScope " ,
2020-01-02 12:29:41 +01:00
}
buildoptions {
2025-05-13 11:38:55 +07:00
" /w45038 " , -- warning C5038: data member 'member1' will be initialized after data member 'member2'
2020-01-02 12:29:41 +01:00
" /wd4018 " , -- warning C4018: 'x' : signed/unsigned mismatch
2015-04-09 13:05:10 +02:00
" /wd4060 " , -- warning C4060: switch statement contains no 'case' or 'default' labels
" /wd4065 " , -- warning C4065: switch statement contains 'default' but no 'case' labels
2020-01-02 12:29:41 +01:00
" /wd4100 " , -- warning C4100: 'xxx' : unreferenced formal parameter
" /wd4127 " , -- warning C4127: conditional expression is constant
" /wd4146 " , -- warning C4146: unary minus operator applied to unsigned type, result still unsigned
" /wd4201 " , -- warning C4201: nonstandard extension used : nameless struct/union
" /wd4244 " , -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data
" /wd4245 " , -- warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
" /wd4250 " , -- warning C4250: 'xxx' : inherits 'xxx' via dominance
" /wd4267 " , -- warning C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data
2025-01-03 16:03:35 +07:00
" /wd4305 " , -- warning C4305: 'conversion': truncation from 'type1' to 'type2'
2020-01-02 12:29:41 +01:00
" /wd4310 " , -- warning C4310: cast truncates constant value
" /wd4319 " , -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size
" /wd4324 " , -- warning C4324: 'xxx' : structure was padded due to __declspec(align())
2019-12-19 00:06:44 +01:00
" /wd4334 " , -- warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
2020-01-02 12:29:41 +01:00
" /wd4389 " , -- warning C4389: 'operator' : signed/unsigned mismatch
2019-12-19 00:06:44 +01:00
" /wd4456 " , -- warning C4456: declaration of 'xxx' hides previous local declaration
" /wd4457 " , -- warning C4457: declaration of 'xxx' hides function parameter
" /wd4458 " , -- warning C4458: declaration of 'xxx' hides class member
" /wd4459 " , -- warning C4459: declaration of 'xxx' hides global declaration
2021-07-09 09:14:42 -07:00
" /wd4611 " , -- warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable
2025-01-03 16:03:35 +07:00
" /wd4646 " , -- warning C4646: function declared with 'noreturn' has non-void return type
" /wd4701 " , -- warning C4701: potentially uninitialized local variable 'name' used
2020-01-02 12:29:41 +01:00
" /wd4702 " , -- warning C4702: unreachable code
" /wd4805 " , -- warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation
2025-01-03 16:03:35 +07:00
" /wd4806 " , -- warning C4806: 'operation': unsafe operation: no value of type 'type' promoted to type 'type' can equal the given constant
2020-01-02 12:29:41 +01:00
" /wd4996 " , -- warning C4996: 'function': was declared deprecated
2015-03-26 09:00:39 +01:00
}
2020-01-02 12:29:41 +01:00
2025-05-13 11:38:55 +07:00
buildoptions_cpp {
" /Zc:__cplusplus " ,
}
flags {
" ExtraWarnings " ,
}
elseif _OPTIONS [ " vs " ] == " intel-15 " then
buildoptions {
" /bigobj " ,
}
2015-03-27 16:36:13 +00:00
buildoptions {
2016-03-29 08:49:47 +02:00
" /Qwd9 " , -- remark #9: nested comment is not allowed
" /Qwd82 " , -- remark #82: storage class is not first
" /Qwd111 " , -- remark #111: statement is unreachable
" /Qwd128 " , -- remark #128: loop is not reachable
" /Qwd177 " , -- remark #177: function "xxx" was declared but never referenced
" /Qwd181 " , -- remark #181: argument of type "UINT32={unsigned int}" is incompatible with format "%d", expecting argument of type "int"
" /Qwd185 " , -- remark #185: dynamic initialization in unreachable code
" /Qwd280 " , -- remark #280: selector expression is constant
" /Qwd344 " , -- remark #344: typedef name has already been declared (with same type)
" /Qwd411 " , -- remark #411: class "xxx" defines no constructor to initialize the following
" /Qwd869 " , -- remark #869: parameter "xxx" was never referenced
" /Qwd2545 " , -- remark #2545: empty dependent statement in "else" clause of if - statement
" /Qwd2553 " , -- remark #2553: nonstandard second parameter "TCHAR={WCHAR = { __wchar_t } } **" of "main", expected "char *[]" or "char **" extern "C" int _tmain(int argc, TCHAR **argv)
" /Qwd2557 " , -- remark #2557: comparison between signed and unsigned operands
" /Qwd3280 " , -- remark #3280: declaration hides member "attotime::seconds" (declared at line 126) static attotime from_seconds(INT32 seconds) { return attotime(seconds, 0); }
2015-03-27 16:36:13 +00:00
2016-03-29 08:49:47 +02:00
" /Qwd170 " , -- error #170: pointer points outside of underlying object
" /Qwd188 " , -- error #188: enumerated type mixed with another type
2015-03-27 16:36:13 +00:00
2016-03-29 08:49:47 +02:00
" /Qwd63 " , -- warning #63: shift count is too large
" /Qwd177 " , -- warning #177: label "xxx" was declared but never referenced
" /Qwd186 " , -- warning #186: pointless comparison of unsigned integer with zero
" /Qwd488 " , -- warning #488: template parameter "_FunctionClass" is not used in declaring the parameter types of function template "device_delegate<_Signature>::device_delegate<_FunctionClass>(delegate<_Signature>:
" /Qwd1478 " , -- warning #1478: function "xxx" (declared at line yyy of "zzz") was declared deprecated
" /Qwd1879 " , -- warning #1879: unimplemented pragma ignored
" /Qwd3291 " , -- warning #3291: invalid narrowing conversion from "double" to "int"
" /Qwd1195 " , -- error #1195: conversion from integer to smaller pointer
" /Qwd47 " , -- error #47: incompatible redefinition of macro "xxx"
" /Qwd265 " , -- error #265: floating-point operation result is out of range
2015-11-14 19:15:12 +00:00
-- these occur on a release build, while we can increase the size limits instead some of the files do require extreme amounts
2016-03-29 08:49:47 +02:00
" /Qwd11074 " , -- remark #11074: Inlining inhibited by limit max-size / remark #11074: Inlining inhibited by limit max-total-size
" /Qwd11075 " , -- remark #11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
2015-03-27 16:36:13 +00:00
}
2025-05-13 11:38:55 +07:00
flags {
" ExtraWarnings " ,
}
elseif _OPTIONS [ " vs " ] == " clangcl " then
2019-10-02 06:30:05 +02:00
buildoptions {
" -Wno-ignored-qualifiers " ,
" -Wno-new-returns-null " ,
" -Wno-unused-const-variable " ,
" -Wno-unused-label " ,
" -Wno-unused-private-field " ,
2021-05-14 18:33:49 -07:00
" -Wno-xor-used-as-pow " ,
2025-05-13 11:38:55 +07:00
" -Wno-error=deprecated-declarations " ,
" -Wno-error=tautological-compare " ,
}
if _OPTIONS [ " DEPRECATED " ] == " 0 " then
buildoptions {
" -Wno-deprecated-declarations "
}
end
flags {
-- don't set ExtraWarnings flag (/W4 == -Wall -Wextra); use default (/W3 == -Wall) instead
2019-10-02 06:30:05 +02:00
}
end
2015-03-26 09:00:39 +01:00
includedirs {
MAME_DIR .. " 3rdparty/dxsdk/Include "
}
2015-05-28 20:06:33 +02:00
2015-03-26 09:00:39 +01:00
configuration { }
2022-06-28 16:33:06 +10:00
if _OPTIONS [ " SOURCES " ] ~= nil then
if _OPTIONS [ " SOURCEFILTER " ] ~= nil then
error ( " SOURCES and SOURCEFILTER cannot be combined " )
end
local makedep = path.join ( MAME_DIR , " scripts " , " build " , " makedep.py " )
2016-12-09 13:00:51 +01:00
local str = _OPTIONS [ " SOURCES " ]
2019-10-04 22:55:01 +10:00
local sourceargs = " "
2016-12-09 13:00:51 +01:00
for word in string.gmatch ( str , ' ([^,]+) ' ) do
2022-06-30 00:37:49 +10:00
local fullpath = path.join ( MAME_DIR , word )
if ( not os.isfile ( fullpath ) ) and ( not os.isdir ( fullpath ) ) then
2022-07-01 23:19:10 +10:00
word = path.join ( " src " , _OPTIONS [ " target " ] , word )
fullpath = path.join ( MAME_DIR , word )
if ( not os.isfile ( fullpath ) ) and ( not os.isdir ( fullpath ) ) then
error ( " File/directory " .. word .. " does not exist " )
end
2016-12-09 13:00:51 +01:00
end
2019-10-04 22:55:01 +10:00
sourceargs = sourceargs .. " " .. word
2016-12-09 13:00:51 +01:00
end
2022-06-28 16:33:06 +10:00
2022-07-07 11:54:01 +10:00
local driverlist = path.join ( MAME_DIR , " src " , _OPTIONS [ " target " ] , _OPTIONS [ " target " ] .. " .lst " )
2022-06-28 16:33:06 +10:00
local OUT_STR = os.outputof (
string.format (
2022-07-07 11:54:01 +10:00
" %s %s -r %s sourcesproject -t %s -l %s %s " ,
PYTHON , makedep , MAME_DIR , _OPTIONS [ " subtarget " ] , driverlist , sourceargs ) )
if # OUT_STR == 0 then
error ( " Error creating projects from specified source files " )
end
2022-06-28 16:33:06 +10:00
load ( OUT_STR ) ( )
local driverlist = path.join ( MAME_DIR , " src " , _OPTIONS [ " target " ] , _OPTIONS [ " target " ] .. " .lst " )
local driverfilter = path.join ( GEN_DIR , _OPTIONS [ " target " ] , _OPTIONS [ " subtarget " ] .. " .flt " )
os.outputof (
string.format (
2022-06-29 01:29:04 +10:00
" %s %s -r %s sourcesfilter -l %s %s > %s " ,
PYTHON , makedep , MAME_DIR , driverlist , sourceargs , driverfilter ) )
2022-06-28 16:33:06 +10:00
elseif _OPTIONS [ " SOURCEFILTER " ] ~= nil then
local driverfilter = path.join ( MAME_DIR , _OPTIONS [ " SOURCEFILTER " ] )
if not os.isfile ( driverfilter ) then
error ( " File " .. _OPTIONS [ " SOURCEFILTER " ] .. " does not exist " )
end
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 (
2022-06-29 01:29:04 +10:00
" %s %s -r %s filterproject -t %s -f %s %s " ,
2022-06-28 16:33:06 +10:00
PYTHON , makedep , MAME_DIR , _OPTIONS [ " subtarget " ] , driverfilter , driverlist ) )
2022-07-07 11:54:01 +10:00
if # OUT_STR == 0 then
error ( " Error creating projects from specified driver filter file " )
end
2016-01-17 17:53:03 +01:00
load ( OUT_STR ) ( )
end
2015-03-28 15:09:22 +11:00
2015-03-26 09:00:39 +01:00
group " libs "
2015-03-28 15:09:22 +11:00
if ( not os.isfile ( path.join ( " src " , " osd " , _OPTIONS [ " osd " ] .. " .lua " ) ) ) then
error ( " Unsupported value ' " .. _OPTIONS [ " osd " ] .. " ' for OSD " )
end
dofile ( path.join ( " src " , " osd " , _OPTIONS [ " osd " ] .. " .lua " ) )
2015-03-26 09:00:39 +01:00
dofile ( path.join ( " src " , " lib.lua " ) )
2021-03-04 09:36:22 +01:00
if opt_tool ( MACHINES , " NETLIST " ) then
dofile ( path.join ( " src " , " netlist.lua " ) )
2016-08-12 18:27:54 +02:00
end
--if (STANDALONE~=true) then
dofile ( path.join ( " src " , " formats.lua " ) )
formatsProject ( _OPTIONS [ " target " ] , _OPTIONS [ " subtarget " ] )
--end
2015-03-26 09:00:39 +01:00
2015-03-31 16:19:30 +02:00
group " 3rdparty "
dofile ( path.join ( " src " , " 3rdparty.lua " ) )
2015-03-26 09:00:39 +01:00
group " core "
dofile ( path.join ( " src " , " emu.lua " ) )
2015-09-13 10:17:58 +02:00
group " devices "
dofile ( path.join ( " src " , " devices.lua " ) )
devicesProject ( _OPTIONS [ " target " ] , _OPTIONS [ " subtarget " ] )
2015-03-26 09:00:39 +01:00
2024-01-01 02:41:59 +01:00
if _OPTIONS [ " with-emulator " ] then
if ( STANDALONE ~= true ) then
dofile ( path.join ( " src " , " mame " , " frontend.lua " ) )
2016-01-20 21:42:13 +01:00
end
2024-01-01 02:41:59 +01:00
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 ( )
2016-03-29 08:49:47 +02:00
end
2015-04-19 16:21:36 +02:00
2015-03-26 09:00:39 +01:00
if _OPTIONS [ " with-tools " ] then
group " tools "
dofile ( path.join ( " src " , " tools.lua " ) )
end
2015-05-27 15:02:33 +02:00
if _OPTIONS [ " with-tests " ] then
group " tests "
dofile ( path.join ( " src " , " tests.lua " ) )
end
2016-01-29 11:47:40 +01:00
if _OPTIONS [ " with-benchmarks " ] then
group " benchmarks "
dofile ( path.join ( " src " , " benchmarks.lua " ) )
end
2021-03-04 09:36:22 +01:00
function generate_has_header ( hashname , hash )
fname = GEN_DIR .. " has_ " .. hashname : lower ( ) .. " .h "
file = io.open ( fname , " w " )
file : write ( " // Generated file, edition is futile \n " )
file : write ( " \n " )
file : write ( string.format ( " #ifndef GENERATED_HAS_%s_H \n " , hashname ) )
file : write ( string.format ( " #define GENERATED_HAS_%s_H \n " , hashname ) )
file : write ( " \n " )
2023-12-09 23:37:14 +01:00
active = { }
for k , v in pairs ( hash ) do
2021-03-04 09:36:22 +01:00
if v then
2023-12-09 23:37:14 +01:00
active [ # active + 1 ] = k
2021-03-04 09:36:22 +01:00
end
end
2023-12-09 23:37:14 +01:00
table.sort ( active )
for _ , k in ipairs ( active ) do
file : write ( string.format ( " #define HAS_%s_%s \n " , hashname , k ) )
end
2021-03-04 09:36:22 +01:00
file : write ( " \n " )
file : write ( " #endif \n " )
file : close ( )
end
generate_has_header ( " CPUS " , CPUS )
generate_has_header ( " SOUNDS " , SOUNDS )
generate_has_header ( " MACHINES " , MACHINES )
generate_has_header ( " VIDEOS " , VIDEOS )
generate_has_header ( " BUSES " , BUSES )
generate_has_header ( " FORMATS " , FORMATS )