Enable precompiled header usage in the Visual Studio compiler (#5473)

* Enable precompiled header usage in the Visual Studio compiler
But only for libraries emu frontend precompile dasm optional
Also add emu.h include to hpcdasm.cpp

* Include emu.h in some disassembler sources to use precompiled headers

* Remove debug message
This commit is contained in:
S.Z 2019-08-13 19:20:53 +02:00 committed by R. Belmont
parent 5384701b76
commit a3588c18bf
15 changed files with 43 additions and 7 deletions

View File

@ -77,6 +77,16 @@ function precompiledheaders()
end
end
function precompiledheaders_novs()
precompiledheaders()
if string.sub(_ACTION,1,4) == "vs20" then
--print("Disabling pch for Visual Studio")
flags {
"NoPCH"
}
end
end
function addprojectflags()
local version = str_to_version(_OPTIONS["gcc_version"])
if _OPTIONS["gcc"]~=nil and string.find(_OPTIONS["gcc"], "gcc") then
@ -486,7 +496,6 @@ configuration { "vs20*" }
"/bigobj",
}
flags {
"NoPCH",
"ExtraWarnings",
}
if not _OPTIONS["NOWERROR"] then

View File

@ -54,6 +54,8 @@ function devicesProject(_target, _subtarget)
dofile(path.join("src", "bus.lua"))
pchsource(MAME_DIR .. "src/devices/machine/timer.cpp")
if #disasm_files > 0 then
project ("dasm")
uuid ("f2d28b0a-6da5-4f78-b629-d834aa00429d")
@ -78,6 +80,14 @@ if #disasm_files > 0 then
disasm_files
}
for key,value in pairs(disasm_files) do
if string.endswith(value, ".cpp") then
--print("calling pchsource with " .. value)
pchsource(value)
break
end
end
if #disasm_dependency > 0 then
dependency(disasm_dependency)
end

View File

@ -259,6 +259,12 @@ files {
MAME_DIR .. "src/emu/video/rgbvmx.h",
}
pchsource(MAME_DIR .. "src/emu/main.cpp")
-- 3 files do not inlcude emu.h
nopch(MAME_DIR .. "src/emu/emualloc.cpp")
nopch(MAME_DIR .. "src/emu/attotime.cpp")
nopch(MAME_DIR .. "src/emu/debug/textbuf.cpp")
dependency {
--------------------------------------------------
-- additional dependencies
@ -306,6 +312,9 @@ includedirs {
files {
MAME_DIR .. "src/emu/drivers/empty.cpp",
}
pchsource(MAME_DIR .. "src/emu/drivers/empty.cpp")
dependency {
{ "$(OBJDIR)/src/emu/drivers/empty.o", "$(GCH)", true },
}

View File

@ -166,3 +166,5 @@ files {
MAME_DIR .. "src/frontend/mame/ui/widgets.cpp",
MAME_DIR .. "src/frontend/mame/ui/widgets.h",
}
pchsource(MAME_DIR .. "src/frontend/mame/audit.cpp")

View File

@ -913,7 +913,7 @@ function createMAMEProjects(_target, _subtarget, _name)
kind (LIBTYPE)
uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -18,7 +18,7 @@ function createProjects_mame_dummy(_target, _subtarget)
kind (LIBTYPE)
uuid (os.uuid("drv-mame_dummy"))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -1288,7 +1288,7 @@ function createMESSProjects(_target, _subtarget, _name)
kind (LIBTYPE)
uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -108,7 +108,7 @@ function createProjects_mame_nl(_target, _subtarget)
kind (LIBTYPE)
uuid (os.uuid("drv-mame-nl"))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -93,7 +93,7 @@ function createProjects_mame_tiny(_target, _subtarget)
kind (LIBTYPE)
uuid (os.uuid("drv-mame-tiny"))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -101,7 +101,7 @@ function createVirtualProjects(_target, _subtarget, _name)
kind (LIBTYPE)
uuid (os.uuid("drv-" .. _target .."_" .. _subtarget .. "_" .._name))
addprojectflags()
precompiledheaders()
precompiledheaders_novs()
includedirs {
MAME_DIR .. "src/osd",

View File

@ -6,6 +6,7 @@
***************************************************************************/
#include "emu.h"
#include "util/disasmintf.h"
#include "bcpdasm.h"

View File

@ -19,6 +19,7 @@
***************************************************************************/
#include "emu.h"
#include "util/disasmintf.h"
#include "cr16bdasm.h"

View File

@ -6,6 +6,7 @@
***************************************************************************/
#include "emu.h"
#include "util/disasmintf.h"
#include "f2mc16dasm.h"

View File

@ -10,6 +10,7 @@
***************************************************************************/
#include "emu.h"
#include "util/disasmintf.h"
#include "hpcdasm.h"

View File

@ -4,8 +4,10 @@
ELAN Microelectronics RISC II (RII) Series disassembler
***************************************************************************/
#include "emu.h"
#include "util/disasmintf.h"
#include "riidasm.h"