2015-05-09 16:05:30 +02:00
-- license:BSD-3-Clause
-- copyright-holders:MAMEdev Team
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
premake.xcode . parameters = { ' CLANG_CXX_LANGUAGE_STANDARD = "c++14" ' , ' CLANG_CXX_LIBRARY = "libc++" ' }
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 = " "
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
if ( str == nil or str == ' ' ) then
return val
end
local cnt = 10000
for word in string.gmatch ( str , ' ([^.]+) ' ) do
val = val + tonumber ( word ) * cnt
cnt = cnt / 100
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 " )
local f = _G
for v in x : gmatch ( " [^%.]+ " ) do
if type ( f ) ~= " table " then
return nil , " looking for ' " .. v .. " ' expected table, not " .. type ( f )
end
f = f [ v ]
end
if type ( f ) == " function " then
return f
else
return nil , " expected function, not " .. type ( f )
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 " ,
2015-10-07 12:01:21 +02:00
{ MAME_DIR .. " scripts/build/file2str.py " } , { " @echo Converting 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-03-29 08:49:47 +02:00
configuration { " not xcode4 " }
pchheader ( " emu.h " )
configuration { }
2016-01-01 07:56:20 +01:00
end
2015-12-06 17:07:50 +01:00
function addprojectflags ( )
local version = str_to_version ( _OPTIONS [ " gcc_version " ] )
if _OPTIONS [ " gcc " ] ~= nil and string.find ( _OPTIONS [ " gcc " ] , " gcc " ) and ( version >= 50100 ) then
buildoptions_cpp {
" -Wsuggest-override " ,
}
end
end
2015-03-26 09:00:39 +01:00
CPUS = { }
SOUNDS = { }
MACHINES = { }
VIDEOS = { }
BUSES = { }
newoption {
trigger = " with-tools " ,
description = " Enable building tools. " ,
2015-03-31 18:34:57 +11:00
}
2015-03-26 09:00:39 +01:00
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 " } ,
2015-03-29 15:17:21 +02:00
{ " pnacl " , " Native Client - PNaCl " } ,
2016-03-29 08:49:47 +02:00
{ " linux " , " Linux " } ,
2015-04-04 15:13:48 +11:00
{ " ios " , " iOS " } ,
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 " } ,
2016-01-25 20:01:40 +01:00
{ " steamlink " , " Steam Link " } ,
2016-03-19 14:47:10 +01:00
{ " rpi " , " Raspberry Pi " } ,
2016-03-23 21:23:14 +01:00
{ " ci20 " , " Creator-Ci20 " } ,
2015-03-26 09:00:39 +01:00
} ,
}
2016-02-27 16:53:15 +01:00
newoption {
2016-03-29 08:49:47 +02:00
trigger = ' with-bundled-sdl2 ' ,
description = ' Build bundled SDL2 library ' ,
2016-02-27 16:53:15 +01:00
}
2015-03-26 14:01:14 +01:00
newoption {
trigger = " distro " ,
description = " Choose distribution " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " generic " , " generic " } ,
2015-03-26 14:01:14 +01:00
{ " debian-stable " , " debian-stable " } ,
{ " ubuntu-intrepid " , " ubuntu-intrepid " } ,
} ,
}
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 " ,
}
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 " ,
description = " ARCHOPTS. " ,
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-06 16:33:21 +02:00
newoption {
trigger = " FASTDEBUG " ,
description = " Fast DEBUG. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-04-06 16:33:21 +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
}
2015-09-05 11:53:19 +02:00
newoption {
trigger = " FORCE_VERSION_COMPILE " ,
description = " Force compiling of version.c file. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2015-09-05 11:53:19 +02:00
{ " 1 " , " Enabled " } ,
}
}
2015-12-27 15:35:29 +01:00
newoption {
trigger = " PLATFORM " ,
description = " Target machine platform (x86,arm,...) " ,
}
2016-02-26 14:50:09 +01:00
newoption {
trigger = " USE_LIBUV " ,
description = " Use libuv. " ,
allowed = {
2016-03-29 08:49:47 +02:00
{ " 0 " , " Disabled " } ,
2016-02-26 14:50:09 +01:00
{ " 1 " , " Enabled " } ,
}
}
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
2015-04-08 14:19:43 +02:00
PYTHON = " python "
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 not _OPTIONS [ " NOASM " ] then
if _OPTIONS [ " targetos " ] == " emscripten " then
_OPTIONS [ " NOASM " ] = " 1 "
else
_OPTIONS [ " NOASM " ] = " 0 "
end
end
2016-02-26 14:50:09 +01:00
if not _OPTIONS [ " USE_LIBUV " ] then
_OPTIONS [ " USE_LIBUV " ] = " 1 "
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
2015-05-09 15:10:29 +02:00
if ( _OPTIONS [ " subtarget " ] == " mess " ) then
solution ( _OPTIONS [ " subtarget " ] )
else
solution ( _OPTIONS [ " target " ] .. _OPTIONS [ " subtarget " ] )
2015-10-05 10:28:46 -05:00
end
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
2016-02-21 21:03:22 +01:00
if _ACTION == " xcode4 " then
2016-03-29 08:49:47 +02:00
platforms {
" x64 " ,
}
2016-02-21 21:03:22 +01:00
else
2016-03-29 08:49:47 +02:00
platforms {
" x32 " ,
" x64 " ,
" Native " , -- for targets where bitness is not specified
}
2016-02-21 21:03:22 +01:00
end
2015-03-26 09:00:39 +01:00
2015-04-01 16:11:48 +11:00
language " C++ "
flags {
" StaticRuntime " ,
}
configuration { " vs* " }
2015-03-26 09:00:39 +01:00
flags {
2016-01-01 07:56:20 +01:00
" NoPCH " ,
2015-03-26 09:00:39 +01:00
" ExtraWarnings " ,
2015-05-15 18:45:23 +02:00
" NoEditAndContinue " ,
2015-03-28 07:03:44 +01:00
}
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
2015-04-01 16:11:48 +11:00
configuration { " Debug " , " vs* " }
flags {
" Symbols " ,
}
2015-10-05 10:28:46 -05:00
2015-04-05 15:15:02 +02:00
configuration { " Release " , " vs* " }
flags {
" Optimize " ,
}
2015-04-01 16:11:48 +11:00
2016-02-27 16:53:15 +01:00
-- Force VS2013/15 targets to use bundled SDL2
if string.sub ( _ACTION , 1 , 4 ) == " vs20 " and _OPTIONS [ " osd " ] == " sdl " then
if _OPTIONS [ " with-bundled-sdl2 " ] == nil then
_OPTIONS [ " with-bundled-sdl2 " ] = " 1 "
end
end
2016-02-29 16:20:51 +01:00
-- Build SDL2 for Android
if _OPTIONS [ " targetos " ] == " android " then
_OPTIONS [ " with-bundled-sdl2 " ] = " 1 "
end
2016-03-29 08:49:47 +02:00
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 " }
2015-10-09 14:13:35 +02:00
if ( _OPTIONS [ " SOURCES " ] == nil ) then
2015-06-20 18:20:10 +02:00
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 " ) )
2015-03-26 09:00:39 +01:00
end
2016-01-17 17:53:03 +01:00
2015-03-26 09:00:39 +01:00
configuration { " gmake " }
flags {
" SingleOutputDir " ,
}
dofile ( " toolchain.lua " )
2016-02-26 14:50:09 +01:00
if _OPTIONS [ " USE_LIBUV " ] == " 0 " then
defines {
" NO_LIBUV " ,
}
end
2015-03-26 09:00:39 +01:00
2015-03-27 16:43:54 +01:00
if _OPTIONS [ " targetos " ] == " windows " then
2015-04-01 16:11:48 +11:00
configuration { " x64 " }
defines {
" X64_WINDOWS_ABI " ,
}
configuration { }
2015-03-27 16:43:54 +01:00
end
2015-03-26 09:00:39 +01:00
-- Avoid error when invoking genie --help.
if ( _ACTION == nil ) then return false end
-- define PTR64 if we are a 64-bit target
2016-02-26 15:59:38 +01:00
configuration { " x64 or android-*64 " }
2015-03-26 09:00:39 +01:00
defines { " PTR64=1 " }
-- define MAME_DEBUG if we are a debugging build
configuration { " Debug " }
defines {
" MAME_DEBUG " ,
2015-04-06 12:37:14 +02:00
" MAME_PROFILER " ,
2016-03-20 15:14:59 +01:00
" BGFX_CONFIG_DEBUG=1 " ,
2015-03-26 09:00:39 +01:00
}
2016-03-20 15:14:59 +01:00
2015-04-06 16:33:21 +02:00
if _OPTIONS [ " FASTDEBUG " ] == " 1 " then
defines {
" MAME_DEBUG_FAST "
}
end
2015-04-06 12:37:14 +02: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
configuration { " x64 " }
buildoptions {
" -arch x86_64 " ,
}
linkoptions {
" -arch x86_64 " ,
}
configuration { " x32 " }
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
if _OPTIONS [ " NOASM " ] == " 1 " then
defines {
" MAME_NOASM "
}
end
if not _OPTIONS [ " FORCE_DRC_C_BACKEND " ] then
2015-04-02 22:22:19 +11:00
if _OPTIONS [ " BIGENDIAN " ] ~= " 1 " then
configuration { " x64 " }
defines {
" NATIVE_DRC=drcbe_x64 " ,
}
configuration { " x32 " }
defines {
" NATIVE_DRC=drcbe_x86 " ,
}
configuration { }
end
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-02-23 14:33:30 +01:00
if _ACTION == " gmake " 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 " ] )
2015-12-03 14:50:04 +01:00
if string.find ( _OPTIONS [ " gcc " ] , " clang " ) and ( ( version < 30500 ) or ( _OPTIONS [ " targetos " ] == " macosx " and ( version <= 60000 ) ) ) then
2015-12-03 13:33:40 +01:00
buildoptions_cpp {
" -x c++ " ,
" -std=c++1y " ,
}
2015-04-10 13:56:33 +02:00
2015-12-03 13:33:40 +01:00
buildoptions_objc {
" -x objective-c++ " ,
" -std=c++1y " ,
}
else
2016-02-26 13:20:43 +01:00
buildoptions_cpp {
" -x c++ " ,
" -std=c++14 " ,
}
2015-03-26 09:00:39 +01:00
buildoptions_objc {
" -x objective-c++ " ,
2015-12-03 11:40:45 +01:00
" -std=c++14 " ,
2015-03-26 09:00:39 +01:00
}
2015-12-03 13:33:40 +01:00
end
2015-03-26 09:00:39 +01:00
-- this speeds it up a bit by piping between the preprocessor/compiler/assembler
if not ( " pnacl " == _OPTIONS [ " gcc " ] ) then
buildoptions {
" --pipe " ,
}
end
-- 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
2015-04-06 18:52:40 +02:00
if _OPTIONS [ " DEPRECATED " ] ~= " 1 " 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
--# add the optimization flag
buildoptions {
2015-03-26 15:45:59 +01:00
" -O " .. _OPTIONS [ " OPTIMIZE " ] ,
2015-03-26 09:00:39 +01:00
" -fno-strict-aliasing "
}
2016-03-11 19:30:37 +01:00
configuration { " mingw-clang " }
buildoptions {
" -O1 " , -- without this executable crash often
}
2016-03-13 08:25:47 +01:00
configuration { }
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 {
2015-04-02 19:04:09 +02:00
" -fno-strict-aliasing "
2015-03-26 15:45:59 +01:00
}
2015-04-02 19:04:09 +02:00
if _OPTIONS [ " ARCHOPTS " ] then
2015-03-26 15:45:59 +01:00
buildoptions {
_OPTIONS [ " ARCHOPTS " ]
}
2015-12-07 22:07:29 +11:00
linkoptions {
_OPTIONS [ " ARCHOPTS " ]
}
2015-03-26 15:45:59 +01:00
end
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
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 " ,
" -Wundef " ,
" -Wformat-security " ,
" -Wwrite-strings " ,
" -Wno-sign-compare " ,
" -Wno-conversion " ,
}
-- 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
buildoptions_objc {
" -Wpointer-arith " ,
}
-- warnings only applicable to C++ compiles
buildoptions_cpp {
" -Woverloaded-virtual " ,
}
--ifdef SANITIZE
--CCOMFLAGS += -fsanitize=$(SANITIZE)
--ifneq (,$(findstring thread,$(SANITIZE)))
--CCOMFLAGS += -fPIE
--endif
--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 " ] )
2016-02-26 14:16:50 +01:00
if string.find ( _OPTIONS [ " gcc " ] , " clang " ) or string.find ( _OPTIONS [ " gcc " ] , " pnacl " ) or string.find ( _OPTIONS [ " gcc " ] , " asmjs " ) or string.find ( _OPTIONS [ " gcc " ] , " android " ) then
2015-12-03 11:40:45 +01:00
if ( version < 30400 ) then
2015-12-03 14:02:36 +01:00
print ( " Clang version 3.4 or later needed " )
2015-12-03 11:40:45 +01:00
os.exit ( - 1 )
end
2015-03-26 09:00:39 +01:00
buildoptions {
" -Wno-cast-align " ,
" -Wno-tautological-compare " ,
" -Wno-dynamic-class-memaccess " ,
2015-12-03 11:40:45 +01:00
" -Wno-unused-value " ,
" -Wno-inline-new-delete " ,
" -Wno-constant-logical-operand " ,
2015-12-03 14:32:20 +01:00
" -Wno-deprecated-register " ,
2015-03-26 09:00:39 +01:00
}
if ( version >= 30500 ) then
buildoptions {
" -Wno-absolute-value " ,
" -Wno-unknown-warning-option " ,
" -Wno-extern-c-compat " ,
}
end
2015-12-03 14:32:20 +01:00
if ( version >= 70000 ) then
2015-10-05 10:28:46 -05:00
buildoptions {
" -Wno-tautological-undefined-compare " ,
}
end
2015-03-26 09:00:39 +01:00
else
2015-12-03 11:40:45 +01:00
if ( version < 40900 ) then
print ( " GCC version 4.9 or later needed " )
os.exit ( - 1 )
end
2015-03-26 13:19:28 +01:00
buildoptions {
2015-12-04 20:36:05 +01:00
" -Wno-unused-result " , -- needed for fgets,fread on linux
2015-12-03 11:54:51 +01: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)
" -Wno-array-bounds " ,
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-03-29 08:49:47 +02:00
defines {
2016-03-11 13:09:47 +01:00
" PTR64=1 " ,
}
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 {
" -x c++ " ,
2015-12-03 11:54:51 +01:00
" -std=c++14 " ,
2015-03-26 09:00:39 +01:00
}
archivesplit_size " 20 "
configuration { " android* " }
2015-04-18 12:51:33 +02:00
buildoptions {
" -Wno-undef " ,
2016-02-25 20:43:40 +01:00
" -Wno-typedef-redefinition " ,
" -Wno-unknown-warning-option " ,
2015-04-18 12:51:33 +02:00
}
2015-03-26 09:00:39 +01:00
buildoptions_cpp {
" -x c++ " ,
2015-12-03 11:54:51 +01:00
" -std=c++14 " ,
2016-02-25 20:43:40 +01:00
" -Wno-extern-c-compat " ,
" -Wno-tautological-constant-out-of-range-compare " ,
" -Wno-tautological-pointer-compare " ,
2015-03-26 09:00:39 +01:00
}
archivesplit_size " 20 "
2016-02-26 15:59:38 +01:00
configuration { " android-arm64 " }
buildoptions {
" -Wno-asm-operand-widths " ,
}
2016-03-29 08:49:47 +02:00
2015-03-26 09:00:39 +01:00
configuration { " pnacl " }
buildoptions {
" -std=gnu89 " ,
" -Wno-inline-new-delete " ,
}
buildoptions_cpp {
" -x c++ " ,
2015-12-03 11:54:51 +01:00
" -std=c++14 " ,
2015-03-26 09:00:39 +01:00
}
archivesplit_size " 20 "
2016-03-23 21:23:14 +01:00
configuration { " linux-* or rpi or ci20 " }
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
}
2015-03-26 14:01:14 +01:00
if _OPTIONS [ " distro " ] == " debian-stable " then
2015-04-02 19:04:09 +02:00
defines
2015-03-26 14:01:14 +01:00
{
" NO_AFFINITY_NP " ,
}
end
2015-03-26 09:00:39 +01:00
2016-01-25 20:01:40 +01:00
configuration { " steamlink " }
links {
" dl " ,
2016-03-29 08:49:47 +02:00
" EGL " ,
2016-02-16 11:36:13 +01:00
" GLESv2 " ,
2016-03-29 08:49:47 +02:00
" SDL2 " ,
}
2016-01-25 20:01:40 +01:00
defines {
" EGL_API_FB " ,
}
2016-03-19 14:47:10 +01:00
configuration { " rpi " }
links {
2016-03-29 08:49:47 +02:00
" SDL2 " ,
2016-03-19 14:47:10 +01:00
" fontconfig " ,
2016-03-19 16:09:00 +01:00
" X11 " ,
" GLESv2 " ,
" EGL " ,
" bcm_host " ,
" vcos " ,
" vchiq_arm " ,
" pthread " ,
2016-03-29 08:49:47 +02:00
}
2016-03-19 14:47:10 +01:00
2016-03-23 21:23:14 +01:00
configuration { " ci20 " }
links {
2016-03-29 08:49:47 +02:00
" SDL2 " ,
2016-03-23 21:23:14 +01:00
" asound " ,
" fontconfig " ,
" freetype " ,
" pthread " ,
2016-03-29 08:49:47 +02:00
}
2016-03-23 21:23:14 +01:00
2016-02-21 19:48:16 +01:00
configuration { " osx* or xcode4 " }
2015-03-26 09:00:39 +01:00
links {
" pthread " ,
}
2016-01-04 15:29:19 +01:00
configuration { " mingw* " }
linkoptions {
" -static-libgcc " ,
" -static-libstdc++ " ,
" -static " ,
}
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-01-04 16:33:23 +01:00
configuration { " mingw-clang " }
linkoptions {
" -pthread " ,
}
2016-03-29 08:49:47 +02:00
2016-01-04 13:28:40 +01:00
2015-03-26 09:00:39 +01:00
configuration { " vs* " }
defines {
" XML_STATIC " ,
" WIN32 " ,
" _WIN32 " ,
" _CRT_NONSTDC_NO_DEPRECATE " ,
" _CRT_SECURE_NO_DEPRECATE " ,
}
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
}
buildoptions {
2016-03-29 08:49:47 +02:00
" /WX " , -- Treats all compiler warnings as errors.
2015-04-09 13:05:10 +02:00
" /wd4025 " , -- warning C4025: 'number' : based pointer passed to function with variable arguments: parameter number
" /wd4003 " , -- warning C4003: not enough actual parameters for macro 'xxx'
2015-10-05 10:28:46 -05:00
" /wd4018 " , -- warning C4018: 'x' : signed/unsigned mismatch
2015-04-09 13:05:10 +02:00
" /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
" /wd4131 " , -- warning C4131: 'xxx' : uses old-style declarator
" /wd4141 " , -- warning C4141: 'xxx' : used more than once
" /wd4146 " , -- warning C4146: unary minus operator applied to unsigned type, result still unsigned
" /wd4150 " , -- warning C4150: deletion of pointer to incomplete type 'xxx'; no destructor called
" /wd4189 " , -- warning C4189: 'xxx' : local variable is initialized but not referenced
" /wd4191 " , -- warning C4191: 'type cast' : unsafe conversion from 'xxx' to 'xxx' // 64-bit only
" /wd4201 " , -- warning C4201: nonstandard extension used : nameless struct/union
" /wd4232 " , -- warning C4232: nonstandard extension used : 'xxx' : address of dllimport 'xxx' is not static, identity not guaranteed
" /wd4242 " , -- warning C4242: 'x' : conversion from 'xxx' to 'xxx', possible loss of data
" /wd4244 " , -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data
" /wd4250 " , -- warning C4250: 'xxx' : inherits 'xxx' via dominance
" /wd4255 " , -- warning C4255: 'xxx' : no function prototype given: converting '()' to '(void)'
" /wd4296 " , -- warning C4296: 'x' : expression is always false
" /wd4306 " , -- warning C4306: 'xxx': conversion from 'type1' to 'type2' of greater size // 64-bit only
" /wd4310 " , -- warning C4310: cast truncates constant value
" /wd4312 " , -- warning C4312: 'type cast' : conversion from 'xxx' to 'xxx' of greater size
" /wd4324 " , -- warning C4324: 'xxx' : structure was padded due to __declspec(align())
" /wd4347 " , -- warning C4347: behavior change: 'xxx' is called instead of 'xxx' // obsolete VS2005 - VS2010 only
" /wd4435 " , -- warning C4435: 'xxx' : Object layout under /vd2 will change due to virtual base 'xxx'
" /wd4510 " , -- warning C4510: 'xxx' : default constructor could not be generated
" /wd4512 " , -- warning C4512: 'xxx' : assignment operator could not be generated
" /wd4514 " , -- warning C4514: 'xxx' : unreferenced inline function has been removed
" /wd4571 " , -- warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable
" /wd4610 " , -- warning C4619: #pragma warning : there is no warning number 'xxx'
" /wd4611 " , -- warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught
" /wd4619 " , -- warning C4610: struct 'xxx' can never be instantiated - user defined constructor required
" /wd4625 " , -- warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted
" /wd4626 " , -- warning C4626: 'xxx' : assignment operator could not be generated because a base class assignment operator is inaccessible or deleted
" /wd4640 " , -- warning C4640: 'xxx' : construction of local static object is not thread-safe
" /wd4668 " , -- warning C4668: 'xxx' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
" /wd4702 " , -- warning C4702: unreachable code
" /wd4706 " , -- warning C4706: assignment within conditional expression
" /wd4710 " , -- warning C4710: 'xxx' : function not inlined
" /wd4711 " , -- warning C4711: function 'xxx' selected for automatic inline expansion // optimized only
" /wd4805 " , -- warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation
" /wd4820 " , -- warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx'
" /wd4826 " , -- warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only
" /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
2015-12-09 12:58:08 -06:00
" /wd4388 " , -- warning C4388: signed/unsigned mismatch
2015-04-09 13:05:10 +02:00
" /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'
" /wd4996 " , -- warning C4996: 'function': was declared deprecated
" /wd4191 " , -- warning C4191: 'operator/operation' : unsafe conversion from 'type of expression' to 'type required'
" /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
2015-12-09 12:58:08 -06:00
" /wd4290 " , -- warning C4290: C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
2015-04-09 13:05:10 +02:00
" /wd4355 " , -- warning C4355: 'this' : used in base member initializer list
" /wd4800 " , -- warning C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
2015-12-09 12:58:08 -06:00
" /wd4371 " , -- warning C4371: layout of class may have changed from a previous version of the compiler due to better packing of member 'member'
2015-04-09 13:05:10 +02:00
" /wd4548 " , -- warning C4548: expression before comma has no effect; expected expression with side-effect
2015-03-26 09:00:39 +01:00
}
2015-03-27 16:36:13 +00:00
if _OPTIONS [ " vs " ] == " intel-15 " then
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
}
end
2015-03-26 09:00:39 +01:00
linkoptions {
" /ignore:4221 " , -- LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
}
includedirs {
MAME_DIR .. " 3rdparty/dxsdk/Include "
}
2015-04-10 15:34:16 +02:00
configuration { " vs2015 " }
buildoptions {
2016-03-29 08:49:47 +02:00
" /wd4334 " , -- warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
2015-04-10 15:34:16 +02: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
" /wd4838 " , -- warning C4838: conversion from 'xxx' to 'yyy' requires a narrowing conversion
" /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
2015-08-09 15:06:20 +02:00
" /wd4319 " , -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size
2016-02-08 01:53:08 +01:00
" /wd4592 " , -- warning C4592: symbol will be dynamically initialized (implementation limitation)
2015-04-10 15:34:16 +02:00
}
2015-05-28 20:06:33 +02:00
configuration { " winphone8* or winstore8* " }
removelinks {
" DelayImp " ,
" gdi32 " ,
" psapi "
}
links {
" d3d11 " ,
" dxgi "
}
linkoptions {
" /ignore:4264 " -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
}
2015-03-26 09:00:39 +01:00
configuration { }
2016-01-17 17:53:03 +01:00
if ( _OPTIONS [ " SOURCES " ] ~= nil ) then
OUT_STR = os.outputof ( PYTHON .. " " .. MAME_DIR .. " scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS [ " SOURCES " ] .. " target " .. _OPTIONS [ " subtarget " ] )
load ( OUT_STR ) ( )
2016-03-02 14:21:26 +01:00
os.outputof ( PYTHON .. " " .. MAME_DIR .. " scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS [ " SOURCES " ] .. " drivers " .. _OPTIONS [ " subtarget " ] .. " > " .. GEN_DIR .. _OPTIONS [ " target " ] .. " / " .. _OPTIONS [ " subtarget " ] .. " .flt " )
2016-01-17 17:53:03 +01:00
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 " ) )
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
group " drivers "
2015-03-28 15:19:21 +01:00
findfunction ( " createProjects_ " .. _OPTIONS [ " target " ] .. " _ " .. _OPTIONS [ " subtarget " ] ) ( _OPTIONS [ " target " ] , _OPTIONS [ " subtarget " ] )
2015-03-26 09:00:39 +01:00
group " emulator "
dofile ( path.join ( " src " , " main.lua " ) )
2016-03-29 08:49:47 +02:00
if ( _OPTIONS [ " SOURCES " ] == nil ) then
2016-01-21 08:41:13 +01:00
if ( _OPTIONS [ " target " ] == _OPTIONS [ " subtarget " ] ) then
startproject ( _OPTIONS [ " target " ] )
2016-01-20 21:42:13 +01:00
else
2016-01-21 08:41:13 +01:00
if ( _OPTIONS [ " subtarget " ] == " mess " ) then
startproject ( _OPTIONS [ " subtarget " ] )
else
startproject ( _OPTIONS [ " target " ] .. _OPTIONS [ " subtarget " ] )
end
2016-01-20 21:42:13 +01:00
end
2016-01-21 08:41:13 +01:00
else
startproject ( _OPTIONS [ " subtarget " ] )
2016-03-29 08:49:47 +02:00
end
2015-03-26 09:00:39 +01:00
mainProject ( _OPTIONS [ " target " ] , _OPTIONS [ " subtarget " ] )
2015-11-02 21:08:15 -06:00
strip ( )
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