Skip to content

Commit

Permalink
Minimize tools-only build
Browse files Browse the repository at this point in the history
Avoid unnecessary work and dependencies when building tools and no
emulator.
* makefile: Skip compressing layouts and converting translations if the
  emulator isn't being built.
* scripts/src/3rdparty.lua: Make libraries not needed by tools
  conditional on the 'with-emulator' genie option.
* scripts/src/osd/modules.lua: Refactor module file inclusion to
  optionally omit implementations other than 'none', as tools don't
  depend on modules.
* scripts/src/{cpu,devices}.lua: Refactor CPU core file inclusion to
  collect these similarly to the disassembler files and only build the
  'optional' project including them if the emulator is being built.
* Make 'qtdbg' projects conditional on USE_QTDEBUG to avoid warnings
  when Qt libraries aren't present, as tools don't need them.
  • Loading branch information
skrinakron committed Jan 26, 2025
1 parent 993d404 commit 4f87ad9
Show file tree
Hide file tree
Showing 9 changed files with 310 additions and 206 deletions.
26 changes: 26 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
# NO_USE_XINPUT = 1
# NO_USE_XINPUT_WII_LIGHTGUN_HACK = 1
# FORCE_DRC_C_BACKEND = 1
# NO_MODULE_IMPLS = 1

# DEBUG = 1
# PROFILER = 1
Expand Down Expand Up @@ -496,6 +497,23 @@ OSD := sdl
endif
endif

#-------------------------------------------------
# auto-disable unnecessary features if the
# emulator isn't going to be built
#-------------------------------------------------
ifdef EMULATOR
ifeq '$(EMULATOR)' '0'
NO_X11 = 1
NO_OPENGL = 1
USE_WAYLAND = 0
USE_QTDEBUG = 0
NO_USE_MIDI = 1
NO_USE_PORTAUDIO = 1
NO_USE_PULSEAUDIO = 1
NO_MODULE_IMPLS = 1
endif
endif

#-------------------------------------------------
# which 3rdparty library to build;
# link against system (common) library otherwise
Expand Down Expand Up @@ -769,6 +787,10 @@ ifdef USE_DISPATCH_GL
PARAMS += --USE_DISPATCH_GL='$(USE_DISPATCH_GL)'
endif

ifdef NO_MODULE_IMPLS
PARAMS += --NO_MODULE_IMPLS='$(NO_MODULE_IMPLS)'
endif

ifdef NO_USE_MIDI
PARAMS += --NO_USE_MIDI='$(NO_USE_MIDI)'
endif
Expand Down Expand Up @@ -1554,12 +1576,16 @@ $(GEN_FOLDERS):

genie: $(GENIE)

ifneq '$(EMULATOR)' '0'
generate: \
genie \
$(GEN_FOLDERS) \
$(GENDIR)/version.cpp \
$(patsubst %.po,%.mo,$(call rwildcard, language/, *.po)) \
$(patsubst $(SRC)/%.lay,$(GENDIR)/%.lh,$(LAYOUTS))
else
generate: genie $(GENDIR)/version.cpp
endif

ifneq ($(NEW_GIT_VERSION),$(OLD_GIT_VERSION))
stale:
Expand Down
24 changes: 21 additions & 3 deletions scripts/src/3rdparty.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ end
-- SoftFloat library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "softfloat"
uuid "04fbf89e-4761-4cf2-8a12-64500cf0c5c5"
kind "StaticLib"
Expand Down Expand Up @@ -265,12 +266,14 @@ end
MAME_DIR .. "3rdparty/softfloat/fyl2x.c",
MAME_DIR .. "3rdparty/softfloat/f2xm1.c",
}
end


--------------------------------------------------
-- SoftFloat 3 library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "softfloat3"
uuid "9c22fc90-53fd-11e8-b566-0800200c9a66"
kind "StaticLib"
Expand Down Expand Up @@ -629,13 +632,14 @@ end
MAME_DIR .. "3rdparty/softfloat3/bochs_ext/poly.c",
MAME_DIR .. "3rdparty/softfloat3/bochs_ext/extF80_scale.c",
}
end


-------------------------------------------------
-- libJPEG library objects
--------------------------------------------------

if not _OPTIONS["with-system-jpeg"] then
if _OPTIONS["with-emulator"] and not _OPTIONS["with-system-jpeg"] then
project "jpeg"
uuid "447c6800-dcfd-4c48-b72a-a8223bb409ca"
kind "StaticLib"
Expand Down Expand Up @@ -954,7 +958,7 @@ end
--------------------------------------------------
if (STANDALONE~=true) then

if not _OPTIONS["with-system-lua"] then
if _OPTIONS["with-emulator"] and not _OPTIONS["with-system-lua"] then
project "lua"
uuid "d9e2eed1-f1ab-4737-a6ac-863700b1a5a9"
kind "StaticLib"
Expand Down Expand Up @@ -1044,6 +1048,7 @@ end
-- small lua library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "lualibs"
uuid "1d84edab-94cf-48fb-83ee-b75bc697660e"
kind "StaticLib"
Expand Down Expand Up @@ -1093,12 +1098,13 @@ project "lualibs"
MAME_DIR .. "3rdparty/luafilesystem/src/lfs.c",
MAME_DIR .. "3rdparty/lua-linenoise/linenoise.c",
}
end

--------------------------------------------------
-- SQLite3 library objects
--------------------------------------------------

if not _OPTIONS["with-system-sqlite3"] then
if _OPTIONS["with-emulator"] and not _OPTIONS["with-system-sqlite3"] then
project "sqlite3"
uuid "5cb3d495-57ed-461c-81e5-80dc0857517d"
kind "StaticLib"
Expand Down Expand Up @@ -1240,6 +1246,7 @@ end
-- BX library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "bx"
uuid "238318fe-49f5-4eb4-88be-0618900f5eac"
kind "StaticLib"
Expand Down Expand Up @@ -1318,12 +1325,14 @@ project "bx"
MAME_DIR .. "3rdparty/bx/src/timer.cpp",
MAME_DIR .. "3rdparty/bx/src/url.cpp",
}
end


--------------------------------------------------
-- BIMG library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "bimg"
uuid "5603611b-8bf8-4ffd-85bc-76858cd7df39"
kind "StaticLib"
Expand Down Expand Up @@ -1437,12 +1446,14 @@ project "bimg"

MAME_DIR .. "3rdparty/bimg/3rdparty/tinyexr/deps/miniz/miniz.c",
}
end


--------------------------------------------------
-- BGFX library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "bgfx"
uuid "d3e7e119-35cf-4f4f-aba0-d3bdcd1b879a"
kind "StaticLib"
Expand Down Expand Up @@ -1633,6 +1644,7 @@ end
"-D BGFX_CONFIG_MULTITHREADED=0",
}
end
end


--------------------------------------------------
Expand Down Expand Up @@ -1813,6 +1825,7 @@ end
-- linenoise library
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "linenoise"
uuid "7320ffc8-2748-4add-8864-ae29b72a8511"
kind (LIBTYPE)
Expand All @@ -1839,6 +1852,7 @@ project "linenoise"
MAME_DIR .. "3rdparty/linenoise/stringbuf.c",
MAME_DIR .. "3rdparty/linenoise/utf8.c",
}
end


--------------------------------------------------
Expand Down Expand Up @@ -1875,6 +1889,7 @@ end
-- wdlfft library objects (from Cockos WDL)
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "wdlfft"
uuid "74ca017e-fa0d-48b8-81d6-8081a37be14c"
kind "StaticLib"
Expand All @@ -1890,12 +1905,14 @@ project "wdlfft"
MAME_DIR .. "3rdparty/wdlfft/fft.c",
MAME_DIR .. "3rdparty/wdlfft/fft.h"
}
end


--------------------------------------------------
-- ymfm library objects
--------------------------------------------------

if _OPTIONS["with-emulator"] then
project "ymfm"
uuid "2403a536-cb0a-4b50-b41f-10c17917689b"
kind "StaticLib"
Expand Down Expand Up @@ -1928,6 +1945,7 @@ project "ymfm"
MAME_DIR .. "3rdparty/ymfm/src/ymfm_ssg.cpp",
MAME_DIR .. "3rdparty/ymfm/src/ymfm_ssg.h",
}
end


--------------------------------------------------
Expand Down
Loading

0 comments on commit 4f87ad9

Please sign in to comment.