Explorar el Código

oboe: use XMake buildsystem by default and provide auto-generated CMakeConfig/CMakeVersion files (#7663)

* oboe: add XMake buildsystem to use as default and auto-generate CMakeConfig file

* fixup

* do not use this as bug
error: @programdir\core\main.lua:329: @programdir\actions\build\main.lua:146: @programdir\modules\async\runjobs.lua:331: @programdir\core\sandbox\modules\os.lua:132: cannot link liboboe.so.1.9.3 to liboboe.so.1, Unknown Error (1314)

* use `get_config(version))`

* tackle CI

* tackle ci just once again
Saikari hace 5 meses
padre
commit
53a6969580
Se han modificado 1 ficheros con 37 adiciones y 7 borrados
  1. 37 7
      packages/o/oboe/xmake.lua

+ 37 - 7
packages/o/oboe/xmake.lua

@@ -7,16 +7,46 @@ package("oboe")
              "https://github.com/google/oboe.git")
 
     add_versions("1.9.3", "9d2486b74bd396d9d9112625077d5eb656fd6942392dc25ebf222b184ff4eb61")
+    add_configs("cmake", {description = "Use cmake build system", default = false, type = "boolean"})
 
-    add_deps("cmake")
+    on_load(function (package)
+        if package:config("cmake") then
+            package:add("deps", "cmake")
+        end
+    end)
 
     on_install("android", function (package)
-        io.replace("CMakeLists.txt", "LIBRARY DESTINATION lib/${ANDROID_ABI}", "LIBRARY DESTINATION lib", {plain = true})
-        io.replace("CMakeLists.txt", "ARCHIVE DESTINATION lib/${ANDROID_ABI}", "ARCHIVE DESTINATION lib", {plain = true})
-        local configs = {}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
-        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        import("package.tools.cmake").install(package, configs)
+        if package:config("cmake") then
+            io.replace("CMakeLists.txt", "LIBRARY DESTINATION lib/${ANDROID_ABI}", "LIBRARY DESTINATION lib", {plain = true})
+            io.replace("CMakeLists.txt", "ARCHIVE DESTINATION lib/${ANDROID_ABI}", "ARCHIVE DESTINATION lib", {plain = true})
+            local configs = {}
+            table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
+            table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+            import("package.tools.cmake").install(package, configs)
+        else
+            io.writefile("xmake.lua", [[
+                add_rules("mode.release", "mode.debug")
+                add_rules("utils.install.cmake_importfiles")
+                option("version", {description = "Set the version"})
+                set_version(get_config("version"))
+                target("oboe")
+                    set_kind("$(kind)")
+                    set_languages("c++17")
+                    add_files("src/**.cpp")
+                    add_includedirs("include", "src")
+                    add_headerfiles("include/(oboe/*.h)")
+                    if is_mode("debug") then
+                        set_optimize("fastest")
+                        add_defines("OBOE_ENABLE_LOGGING=1")
+                    else
+                        set_optimize("aggressive")
+                    end
+                    add_defines("DO_NOT_DEFINE_OPENSL_ES_CONSTANTS=0")
+                    add_syslinks("log", "OpenSLES")
+                    add_ldflags("-Wl,-z,max-page-size=16384")
+            ]])
+            import("package.tools.xmake").install(package, {version = package:version()})
+        end
     end)
 
     on_test(function (package)