|
@@ -40,18 +40,6 @@ package("libsdl")
|
|
|
|
|
|
add_deps("cmake")
|
|
add_deps("cmake")
|
|
|
|
|
|
- if is_plat("macosx") then
|
|
|
|
- add_frameworks("OpenGL", "CoreVideo", "CoreAudio", "AudioToolbox", "Carbon", "CoreGraphics", "ForceFeedback", "Metal", "AppKit", "IOKit", "CoreFoundation", "Foundation")
|
|
|
|
- add_syslinks("iconv")
|
|
|
|
- elseif is_plat("linux", "bsd") then
|
|
|
|
- if is_plat("bsd") then
|
|
|
|
- add_deps("libusb")
|
|
|
|
- add_syslinks("usbhid")
|
|
|
|
- end
|
|
|
|
- add_syslinks("pthread", "dl")
|
|
|
|
- elseif is_plat("windows", "mingw") then
|
|
|
|
- add_syslinks("gdi32", "user32", "winmm", "shell32")
|
|
|
|
- end
|
|
|
|
add_includedirs("include", "include/SDL2")
|
|
add_includedirs("include", "include/SDL2")
|
|
|
|
|
|
add_configs("use_sdlmain", {description = "Use SDL_main entry point", default = true, type = "boolean"})
|
|
add_configs("use_sdlmain", {description = "Use SDL_main entry point", default = true, type = "boolean"})
|
|
@@ -60,36 +48,48 @@ package("libsdl")
|
|
end
|
|
end
|
|
|
|
|
|
on_load(function (package)
|
|
on_load(function (package)
|
|
- if package.components then
|
|
|
|
- if package:config("use_sdlmain") then
|
|
|
|
- package:add("components", "main")
|
|
|
|
- end
|
|
|
|
- package:add("components", "lib")
|
|
|
|
- else
|
|
|
|
- if package:config("use_sdlmain") then
|
|
|
|
- package:add("links", "SDL2main", "SDL2")
|
|
|
|
- package:add("defines", "SDL_MAIN_HANDLED")
|
|
|
|
- else
|
|
|
|
- package:add("links", "SDL2")
|
|
|
|
- end
|
|
|
|
|
|
+ if package:config("use_sdlmain") then
|
|
|
|
+ package:add("components", "main")
|
|
end
|
|
end
|
|
|
|
+ package:add("components", "lib")
|
|
if package:is_plat("linux") and package:config("with_x") then
|
|
if package:is_plat("linux") and package:config("with_x") then
|
|
package:add("deps", "libxext", {private = true})
|
|
package:add("deps", "libxext", {private = true})
|
|
end
|
|
end
|
|
- if package:is_plat("macosx") and package:version():ge("2.0.14") then
|
|
|
|
- package:add("frameworks", "CoreHaptics", "GameController")
|
|
|
|
- end
|
|
|
|
end)
|
|
end)
|
|
|
|
|
|
- on_component = on_component or function() end
|
|
|
|
on_component("main", function (package, component)
|
|
on_component("main", function (package, component)
|
|
component:add("links", "SDL2main")
|
|
component:add("links", "SDL2main")
|
|
component:add("defines", "SDL_MAIN_HANDLED")
|
|
component:add("defines", "SDL_MAIN_HANDLED")
|
|
component:add("deps", "lib")
|
|
component:add("deps", "lib")
|
|
end)
|
|
end)
|
|
|
|
|
|
- on_component("main", function (package, component)
|
|
|
|
- component:add("links", "SDL2")
|
|
|
|
|
|
+ on_component("lib", function (package, component)
|
|
|
|
+ if package:config("shared") then
|
|
|
|
+ component:add("links", "SDL2")
|
|
|
|
+ else
|
|
|
|
+ component:add("links", package:is_plat("windows") and "SDL2-static" or "SDL2")
|
|
|
|
+ if package:is_plat("windows", "mingw") then
|
|
|
|
+ component:add("syslinks", "user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid", "advapi32", "setupapi", "shell32")
|
|
|
|
+ elseif package:is_plat("linux", "bsd") then
|
|
|
|
+ component:add("syslinks", "pthread", "dl")
|
|
|
|
+ if package:is_plat("bsd") then
|
|
|
|
+ component:add("syslinks", "usbhid")
|
|
|
|
+ end
|
|
|
|
+ elseif package:is_plat("android") then
|
|
|
|
+ component:add("syslinks", "dl", "log", "android", "GLESv1_CM", "GLESv2", "OpenSLES")
|
|
|
|
+ elseif package:is_plat("iphoneos", "macosx") then
|
|
|
|
+ component:add("frameworks", "AudioToolbox", "AVFoundation", "CoreAudio", "CoreVideo", "Foundation", "Metal", "QuartzCore")
|
|
|
|
+ component:add("syslinks", "iconv")
|
|
|
|
+ if package:is_plat("macosx") then
|
|
|
|
+ component:add("frameworks", "Cocoa", "Carbon", "ForceFeedback", "IOKit")
|
|
|
|
+ else
|
|
|
|
+ component:add("frameworks", "CoreBluetooth", "CoreGraphics", "CoreMotion", "OpenGLES", "UIKit")
|
|
|
|
+ end
|
|
|
|
+ if package:version():ge("2.0.14") then
|
|
|
|
+ package:add("frameworks", "CoreHaptics", "GameController")
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
end)
|
|
end)
|
|
|
|
|
|
on_fetch("linux", "macosx", "bsd", function (package, opt)
|
|
on_fetch("linux", "macosx", "bsd", function (package, opt)
|
|
@@ -143,7 +143,8 @@ package("libsdl")
|
|
on_install(function (package)
|
|
on_install(function (package)
|
|
local configs = {}
|
|
local configs = {}
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
|
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
|
|
- table.insert(configs, "-DLIBTYPE=" .. (package:config("shared") and "SHARED" or "STATIC"))
|
|
|
|
|
|
+ table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
|
|
|
|
+ table.insert(configs, "-DSDL_TEST=OFF")
|
|
local opt
|
|
local opt
|
|
if package:is_plat("linux", "cross") then
|
|
if package:is_plat("linux", "cross") then
|
|
local includedirs = {}
|
|
local includedirs = {}
|