Skip to content

Commit 53a6969

Browse files
authored
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
1 parent b83c4a5 commit 53a6969

File tree

1 file changed

+37
-7
lines changed

1 file changed

+37
-7
lines changed

packages/o/oboe/xmake.lua

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,46 @@ package("oboe")
77
"https://github.com/google/oboe.git")
88

99
add_versions("1.9.3", "9d2486b74bd396d9d9112625077d5eb656fd6942392dc25ebf222b184ff4eb61")
10+
add_configs("cmake", {description = "Use cmake build system", default = false, type = "boolean"})
1011

11-
add_deps("cmake")
12+
on_load(function (package)
13+
if package:config("cmake") then
14+
package:add("deps", "cmake")
15+
end
16+
end)
1217

1318
on_install("android", function (package)
14-
io.replace("CMakeLists.txt", "LIBRARY DESTINATION lib/${ANDROID_ABI}", "LIBRARY DESTINATION lib", {plain = true})
15-
io.replace("CMakeLists.txt", "ARCHIVE DESTINATION lib/${ANDROID_ABI}", "ARCHIVE DESTINATION lib", {plain = true})
16-
local configs = {}
17-
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
18-
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
19-
import("package.tools.cmake").install(package, configs)
19+
if package:config("cmake") then
20+
io.replace("CMakeLists.txt", "LIBRARY DESTINATION lib/${ANDROID_ABI}", "LIBRARY DESTINATION lib", {plain = true})
21+
io.replace("CMakeLists.txt", "ARCHIVE DESTINATION lib/${ANDROID_ABI}", "ARCHIVE DESTINATION lib", {plain = true})
22+
local configs = {}
23+
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
24+
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
25+
import("package.tools.cmake").install(package, configs)
26+
else
27+
io.writefile("xmake.lua", [[
28+
add_rules("mode.release", "mode.debug")
29+
add_rules("utils.install.cmake_importfiles")
30+
option("version", {description = "Set the version"})
31+
set_version(get_config("version"))
32+
target("oboe")
33+
set_kind("$(kind)")
34+
set_languages("c++17")
35+
add_files("src/**.cpp")
36+
add_includedirs("include", "src")
37+
add_headerfiles("include/(oboe/*.h)")
38+
if is_mode("debug") then
39+
set_optimize("fastest")
40+
add_defines("OBOE_ENABLE_LOGGING=1")
41+
else
42+
set_optimize("aggressive")
43+
end
44+
add_defines("DO_NOT_DEFINE_OPENSL_ES_CONSTANTS=0")
45+
add_syslinks("log", "OpenSLES")
46+
add_ldflags("-Wl,-z,max-page-size=16384")
47+
]])
48+
import("package.tools.xmake").install(package, {version = package:version()})
49+
end
2050
end)
2151

2252
on_test(function (package)

0 commit comments

Comments
 (0)