Refactor MACOSX_USE_LIBSDL to USE_LIBSDL for windows and linux static library support (nw)

This commit is contained in:
Jeffrey Clark 2015-12-09 09:41:34 -06:00
parent 51eb416088
commit 4e7f9e86e8
3 changed files with 37 additions and 25 deletions

View File

@ -69,7 +69,7 @@
# SDL_INSTALL_ROOT = /opt/sdl2
# SDL_FRAMEWORK_PATH = $(HOME)/Library/Frameworks
# SDL_LIBVER = sdl
# MACOSX_USE_LIBSDL = 1
# USE_LIBSDL = 1
# CYGWIN_BUILD = 1
# BUILDDIR = build
@ -627,8 +627,8 @@ ifdef SDL_FRAMEWORK_PATH
PARAMS += --SDL_FRAMEWORK_PATH='$(SDL_FRAMEWORK_PATH)'
endif
ifdef MACOSX_USE_LIBSDL
PARAMS += --MACOSX_USE_LIBSDL='$(MACOSX_USE_LIBSDL)'
ifdef USE_LIBSDL
PARAMS += --USE_LIBSDL='$(USE_LIBSDL)'
endif
ifdef LDOPTS

View File

@ -54,14 +54,20 @@ function maintargetosdoptions(_target,_subtarget)
end
if _OPTIONS["targetos"]=="windows" then
if _OPTIONS["SDL_LIBVER"]=="sdl2" then
links {
"SDL2.dll",
}
if _OPTIONS["USE_LIBSDL"]~="1" then
if _OPTIONS["SDL_LIBVER"]=="sdl2" then
links {
"SDL2.dll",
}
else
links {
"SDL.dll",
}
end
else
links {
"SDL.dll",
}
local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'")
addlibfromstring(str)
addoptionsfromstring(str)
end
links {
"psapi",
@ -192,16 +198,16 @@ if not _OPTIONS["SDL_FRAMEWORK_PATH"] then
end
newoption {
trigger = "MACOSX_USE_LIBSDL",
description = "Use SDL library on OS (rather than framework)",
trigger = "USE_LIBSDL",
description = "Use SDL library on OS (rather than framework/dll)",
allowed = {
{ "0", "Use framework" },
{ "0", "Use framework/dll" },
{ "1", "Use library" },
},
}
if not _OPTIONS["MACOSX_USE_LIBSDL"] then
_OPTIONS["MACOSX_USE_LIBSDL"] = "0"
if not _OPTIONS["USE_LIBSDL"] then
_OPTIONS["USE_LIBSDL"] = "0"
end
@ -255,7 +261,7 @@ if BASE_TARGETOS=="unix" then
"-weak_framework Metal",
}
end
if _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then
if _OPTIONS["USE_LIBSDL"]~="1" then
linkoptions {
"-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"],
}
@ -269,7 +275,7 @@ if BASE_TARGETOS=="unix" then
}
end
else
local str = backtick(sdlconfigcmd() .. " --libs | sed 's/-lSDLmain//'")
local str = backtick(sdlconfigcmd() .. " --libs --static | sed 's/-lSDLmain//'")
addlibfromstring(str)
addoptionsfromstring(str)
end
@ -529,14 +535,20 @@ if _OPTIONS["with-tools"] then
}
if _OPTIONS["targetos"] == "windows" then
if _OPTIONS["SDL_LIBVER"] == "sdl2" then
links {
"SDL2.dll",
}
if _OPTIONS["USE_LIBSDL"]~="1" then
if _OPTIONS["SDL_LIBVER"] == "sdl2" then
links {
"SDL2.dll",
}
else
links {
"SDL.dll",
}
end
else
links {
"SDL.dll",
}
local str = backtick(sdlconfigcmd() .. " --libs | sed 's/ -lSDLmain//'")
addlibfromstring(str)
addoptionsfromstring(str)
end
links {
"psapi",

View File

@ -81,7 +81,7 @@ if BASE_TARGETOS=="unix" then
"SDLMAME_UNIX",
}
if _OPTIONS["targetos"]=="macosx" then
if _OPTIONS["MACOSX_USE_LIBSDL"]~="1" then
if _OPTIONS["USE_LIBSDL"]~="1" then
buildoptions {
"-F" .. _OPTIONS["SDL_FRAMEWORK_PATH"],
}