瀏覽代碼

Rename libsdl packages to libsdl2 (#6292)

* Rename libsdl packages to libsdl2

* Add temporary libsdl packages to avoid breaking projects

* Replace all existing libsdl deps to libsdl2

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

---------

Co-authored-by: ruki <[email protected]>
Jérôme Leclercq 5 月之前
父節點
當前提交
50ea22ebb1

+ 1 - 1
packages/f/fluidsynth/xmake.lua

@@ -51,7 +51,7 @@ package("fluidsynth")
             libsndfile = "libsndfile",
             openmp = "openmp",
             readline = "readline",
-            sdl2 = "libsdl"
+            sdl2 = "libsdl2"
         }
         for config, info in pairs(configdeps) do
             if package:config(config) then

+ 4 - 4
packages/i/imgui/port/xmake.lua

@@ -28,9 +28,9 @@ if has_config("glad") then
 end
 
 if has_config("sdl2_renderer") then
-    add_requires("libsdl >=2.0.17")
+    add_requires("libsdl2 >=2.0.17")
 elseif has_config("sdl2") then
-    add_requires("libsdl")
+    add_requires("libsdl2")
 end
 
 if has_config("vulkan") then
@@ -105,7 +105,7 @@ target("imgui")
             add_files("backends/imgui_impl_sdl.cpp")
             add_headerfiles("(backends/imgui_impl_sdl.h)")
         end
-        add_packages("libsdl")
+        add_packages("libsdl2")
     end
 
     if has_config("sdl2_renderer") then
@@ -116,7 +116,7 @@ target("imgui")
             add_files("backends/imgui_impl_sdlrenderer.cpp")
             add_headerfiles("(backends/imgui_impl_sdlrenderer.h)")
         end
-        add_packages("libsdl")
+        add_packages("libsdl2")
     end
 
     if has_config("vulkan") then

+ 2 - 2
packages/i/imgui/xmake.lua

@@ -138,10 +138,10 @@ package("imgui")
             end
         end
         if package:config("sdl2_no_renderer") then
-            package:add("deps", "libsdl")
+            package:add("deps", "libsdl2")
         end
         if package:config("sdl2_renderer") then
-            package:add("deps", "libsdl >=2.0.17")
+            package:add("deps", "libsdl2 >=2.0.17")
         end
         if package:config("vulkan") then
             package:add("deps", "vulkansdk")

+ 33 - 4
packages/j/johnnyengine/xmake.lua

@@ -1,16 +1,45 @@
 package("johnnyengine")
-
     set_homepage("https://github.com/PucklaJ/JohnnyEngine")
     set_description("A 2D/3D Engine using OpenGL and SDL for input and the window")
+    set_license("zlib")
 
     add_urls("https://github.com/PucklaJ/JohnnyEngine/archive/refs/tags/$(version).zip",
             "https://github.com/PucklaJ/JohnnyEngine.git")
     add_versions("1.0.1", "53c11b827bea6fe30f9bca27adbd712eec85a0853c0402407930bae78ad54a8f")
     add_patches("1.0.1", path.join(os.scriptdir(), "patches", "1.0.1", "win32_shared_fix.patch"), "fbe22cb5a9f0485982c7755936d14de6da3ce80a42394d48946b14b922847611")
 
-    add_deps("glew", "libsdl", "libsdl_ttf", "libsdl_mixer", "libsdl_gfx", "box2d", "assimp", "stb", "tmxparser")
+    add_deps("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d 2.x", "assimp", "stb", "tmxparser")
+
+    if is_plat("macosx") then
+        add_frameworks("OpenGL")
+    end
+
+    on_install("windows|x86", "windows|x64", "linux", "macosx", function (package)
+        io.writefile("xmake.lua", [[
+set_project("johnny-engine")
+
+add_requires("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d 2.x", "assimp", "stb", "tmxparser")
+
+add_rules("mode.debug", "mode.release")
+target("johnny-engine")
+    set_kind("$(kind)")
+    add_defines("STB_IMAGE_IMPLEMENTATION")
+    set_languages("c++11")
+
+    add_packages("glew", "libsdl2", "libsdl2_ttf", "libsdl2_mixer", "libsdl2_gfx", "box2d", "assimp", "stb", "tmxparser")
+
+    if is_kind("shared") then
+        add_rules("utils.symbols.export_all", {export_classes = true})
+    end
+
+    if is_plat("macosx") then
+        add_frameworks("OpenGL")
+    end
 
-    on_install("windows", "linux", "macosx", function (package)
+    add_files("src/*.cpp")
+    add_headerfiles("include/*.h")
+    add_includedirs("include")
+        ]])
         import("package.tools.xmake").install(package, {kind = (package:config("shared") and "shared" or "static")})
     end)
 
@@ -35,5 +64,5 @@ package("johnnyengine")
           Rectangle<int> r(1, 2, 3, 4);
           Game().run();
         }
-        ]]}, {configs = {languages = "cxx11"}, includes = "Johnny.h"}))
+        ]]}, {configs = {defines = "SDL_MAIN_HANDLED", languages = "cxx11"}, includes = "Johnny.h"}))
     end)

+ 7 - 2
packages/o/openscenegraph/xmake.lua

@@ -1,5 +1,4 @@
 package("openscenegraph")
-
     set_homepage("https://www.openscenegraph.com/")
     set_description("The OpenSceneGraph is an open source high performance 3D graphics toolkit.")
 
@@ -19,11 +18,13 @@ package("openscenegraph")
                         dcmtk      = "DCMTK",
                         ffmpeg     = "FFmpeg",
                         glib       = "GLIB",
-                        libsdl     = "SDL2",
+                        libsdl2    = "SDL2",
                         nvtt       = "NVTT"}
     for config, dep in pairs(configdeps) do
         add_configs(config, {description = "Enable the " .. config .. " plugin.", default = false, type = "boolean"})
     end
+    -- deprecated config
+    add_configs("libsdl", {description = "Enable the libsdl2 plugin (deprecated, use libsdl2 config instead).", default = nil, type = "boolean"})
 
     set_policy("platform.longpaths", true)
 
@@ -43,6 +44,10 @@ package("openscenegraph")
         add_syslinks("pthread")
     end
     on_load("windows", "linux", "macosx", function (package)
+        if package:config("libsdl") ~= nil then
+            wprint("package(openscenegraph): config libsdl has been renamed has been renamed to libsdl2 following the release of SDL3, please use libsdl2 config instead.${clear}")
+            package:config_set("libsdl2", package:config("libsdl"))
+        end
         for config, dep in pairs(configdeps) do
             if package:config(config) then
                 package:add("deps", config)