From 9c9fe82d4f811fff6639df5b286d8c7da13818a9 Mon Sep 17 00:00:00 2001 From: couriersud Date: Sun, 17 Feb 2019 01:50:05 +0100 Subject: Fix cross compile mame/sdl/windows. (nw) --- scripts/src/osd/sdl.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/src/osd/sdl.lua') diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 9ef57e0ba7c..f94f0f35613 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -107,7 +107,7 @@ function maintargetosdoptions(_target,_subtarget) targetprefix "sdl" links { "psapi", - "Ole32", + "ole32", } configuration { } -- cgit v1.2.3-70-g09d2 From 176ba64b260e32e792f7a6381e8bcd112f1ea415 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 18 Feb 2019 14:26:10 +1100 Subject: attempt to fix testkeys linking in more configurations (nw) --- scripts/src/osd/sdl.lua | 2 +- scripts/src/tools.lua | 116 +++++++++++++++++++++++++++++++++--------------- 2 files changed, 82 insertions(+), 36 deletions(-) (limited to 'scripts/src/osd/sdl.lua') diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index f94f0f35613..28e126ecee3 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -91,11 +91,11 @@ function maintargetosdoptions(_target,_subtarget) libdirs { path.join(_OPTIONS["SDL_INSTALL_ROOT"],"lib","x64") } + configuration { } end links { "psapi", } - configuration {} elseif _OPTIONS["targetos"]=="haiku" then links { "network", diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index e1e1081a203..157cbde1e7e 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -797,46 +797,92 @@ end -------------------------------------------------- if (_OPTIONS["osd"] == "sdl") then - project("testkeys") - uuid ("b3f5a5b8-3203-11e9-93e4-670b4f4e359d") - kind "ConsoleApp" + project("testkeys") + uuid ("b3f5a5b8-3203-11e9-93e4-670b4f4e359d") + kind "ConsoleApp" - flags { - "Symbols", -- always include minimum symbols for executables - } + flags { + "Symbols", -- always include minimum symbols for executables + } - if _OPTIONS["SEPARATE_BIN"]~="1" then - targetdir(MAME_DIR) - end + if _OPTIONS["SEPARATE_BIN"]~="1" then + targetdir(MAME_DIR) + end - if _OPTIONS["targetos"] == "macosx" then - links { - "ocore_" .. _OPTIONS["osd"], - ext_lib("utf8proc"), - } - else - links { - "SDL2", - "SDL2main", - "ocore_" .. _OPTIONS["osd"], - ext_lib("utf8proc"), - } - end + links { + "ocore_" .. _OPTIONS["osd"], + ext_lib("utf8proc"), + } + + if _OPTIONS["targetos"]=="windows" then + if _OPTIONS["with-bundled-sdl2"]~=nil then + configuration { "mingw*"} + links { + "SDL2", + "Imm32", + "Version", + "Ole32", + "OleAut32", + } + configuration { "vs*" } + links { + "SDL2", + "Imm32", + "Version", + } + configuration { } + else + if _OPTIONS["USE_LIBSDL"]~="1" then + configuration { "mingw*"} + links { + "SDL2main", + "SDL2", + } + configuration { "vs*" } + links { + "SDL2", + "Imm32", + "Version", + } + configuration { } + else + local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'") + addlibfromstring(str) + addoptionsfromstring(str) + end + configuration { "x32", "vs*" } + libdirs { + path.join(_OPTIONS["SDL_INSTALL_ROOT"],"lib","x86") + } + configuration { "x64", "vs*" } + libdirs { + path.join(_OPTIONS["SDL_INSTALL_ROOT"],"lib","x64") + } + end + end + + if BASE_TARGETOS=="unix" then + if _OPTIONS["with-bundled-sdl2"]~=nil then + links { + "SDL2", + } + end + end - dofile("osd/sdl_cfg.lua") + dofile("osd/sdl_cfg.lua") - includedirs { - MAME_DIR .. "src/osd", - } + includedirs { + MAME_DIR .. "src/osd", + } - files { - MAME_DIR .. "src/tools/testkeys.cpp", - } - - configuration { "mingw*" or "vs*" } - targetextension ".exe" - - configuration { } + files { + MAME_DIR .. "src/tools/testkeys.cpp", + } - strip() + configuration { "mingw*" or "vs*" } + targetextension ".exe" + + configuration { } + + strip() end -- cgit v1.2.3-70-g09d2 From 8ffff5d2d3bcebbdbefec2508ddd2ecd264a399a Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 18 Feb 2019 21:13:44 +1100 Subject: (nw) misc stuff: * Document cross-compilation options * Use lowercase for some libraries that are lowercase in system32 on Windows anyway * Make USE_BUNDLED_LIB_SDL2=0 not use the bundled SDL --- docs/source/initialsetup/compilingmame.rst | 35 +++++++++++++++++++++++++++--- makefile | 2 ++ scripts/src/osd/sdl.lua | 16 +++++++------- scripts/src/tools.lua | 16 +++++++------- 4 files changed, 50 insertions(+), 19 deletions(-) (limited to 'scripts/src/osd/sdl.lua') diff --git a/docs/source/initialsetup/compilingmame.rst b/docs/source/initialsetup/compilingmame.rst index 1c102f66e63..44d416d3108 100644 --- a/docs/source/initialsetup/compilingmame.rst +++ b/docs/source/initialsetup/compilingmame.rst @@ -252,15 +252,27 @@ IGNORE_GIT revision description in the version string. Tool locations -~~~~~~~~~~~~~~~~~~~~ +~~~~~~~~~~~~~~ OVERRIDE_CC - Set the C/Objective-C compiler command. + Set the C/Objective-C compiler command. (This sets the target C compiler + command when cross-compiling.) OVERRIDE_CXX - Set the C++/Objective-C++ compiler command. + Set the C++/Objective-C++ compiler command. (This sets the target C++ + compiler command when cross-compiling.) +OVERRIDE_LD + Set the linker command. This is often not necessary or useful because the C + or C++ compiler command is used to invoke the linker. (This sets the target + linker command when cross-compiling.) PYTHON_EXECUTABLE Set the Python interpreter command. You need Python 2.7 or Python 3 to build MAME. +CROSS_BUILD + Set to **1** to use separate host and target compilers and linkers, as + required for cross-compilation. In this case, **OVERRIDE_CC**, + **OVERRIDE_CXX** and **OVERRIDE_LD** set the target C compiler, C++ compiler + and linker commands, while **CC**, **CXX** and **LD** set the host C + compiler, C++ compiler and linker commands. Optional features ~~~~~~~~~~~~~~~~~ @@ -439,6 +451,23 @@ variables. Unusual Build Configurations ---------------------------- +Cross-compiling MAME +~~~~~~~~~~~~~~~~~~~~ + +MAME's build system has basic support for cross-compilation. Set +**CROSS_BUILD=1** to enable separate host and target compilers, set +**OVERRIDE_CC** and **OVERRIDE_CXX** to the target C/C++ compiler commands, and +if necessary set **CC** and **CXX** to the host C/C++ compiler commands. If the +target OS is different to the host OS, set it with **TARGETOS**. For example it +may be possible to build a MinGW32 x64 build on a Linux host using a command +like this: + +**make TARGETOS=windows PTR64=1 OVERRIDE_CC=x86_64-w64-mingw32-gcc OVERRIDE_CXX=x86_64-w64-mingw32-g++ OVERRIDE_LD=x86_64-w64-mingw32-ld MINGW64=/usr** + +(The additional packages required for producing a standard MinGW32 x64 build on +a Fedora Linux host are `mingw64-gcc-c++`, `mingw64-winpthreads-static` and +their dependencies. Non-standard builds may require additional packages.) + Using libc++ on Linux ~~~~~~~~~~~~~~~~~~~~~ diff --git a/makefile b/makefile index d5dc79988f3..1895eeffcfc 100644 --- a/makefile +++ b/makefile @@ -505,8 +505,10 @@ endif # reverse logic for this one ifdef USE_BUNDLED_LIB_SDL2 +ifneq '$(USE_BUNDLED_LIB_SDL2)' '0' PARAMS += --with-bundled-sdl2 endif +endif #------------------------------------------------- # distribution may change things diff --git a/scripts/src/osd/sdl.lua b/scripts/src/osd/sdl.lua index 28e126ecee3..c9a63dcb24e 100644 --- a/scripts/src/osd/sdl.lua +++ b/scripts/src/osd/sdl.lua @@ -52,16 +52,16 @@ function maintargetosdoptions(_target,_subtarget) configuration { "mingw*"} links { "SDL2", - "Imm32", - "Version", - "Ole32", - "OleAut32", + "imm32", + "version", + "ole32", + "oleaut32", } configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else @@ -74,8 +74,8 @@ function maintargetosdoptions(_target,_subtarget) configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else diff --git a/scripts/src/tools.lua b/scripts/src/tools.lua index 157cbde1e7e..25790c257ac 100644 --- a/scripts/src/tools.lua +++ b/scripts/src/tools.lua @@ -819,16 +819,16 @@ if (_OPTIONS["osd"] == "sdl") then configuration { "mingw*"} links { "SDL2", - "Imm32", - "Version", - "Ole32", - "OleAut32", + "imm32", + "version", + "ole32", + "oleaut32", } configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else @@ -841,8 +841,8 @@ if (_OPTIONS["osd"] == "sdl") then configuration { "vs*" } links { "SDL2", - "Imm32", - "Version", + "imm32", + "version", } configuration { } else -- cgit v1.2.3-70-g09d2