improve magnum (#610)

pull/611/head
Hoildkv 4 years ago committed by GitHub
parent 5d7f549e98
commit d93848fac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 34
      packages/m/magnum-extras/xmake.lua
  2. 46
      packages/m/magnum-integration/xmake.lua
  3. 57
      packages/m/magnum-plugins/xmake.lua
  4. 57
      packages/m/magnum/xmake.lua

@ -0,0 +1,34 @@
package("magnum-extras")
set_homepage("https://magnum.graphics/")
set_description("Extras for magnum, Light­weight and mod­u­lar C++11/C++14 graph­ics mid­dle­ware for games and data visu­al­iz­a­tion.")
set_license("MIT")
add_urls("https://github.com/mosra/magnum-extras/archive/refs/tags/$(version).tar.gz",
"https://github.com/mosra/magnum-extras.git")
add_versions("v2020.06", "a8d7babc50ac070984d39f6cc15c3ce2af7b41fe980fe81b0405da6f5ba3c36d")
add_configs("ui", {description = "Build the ui library.", default = false, type = "boolean"})
add_configs("player", {description = "Build the magnum-player executable.", default = false, type = "boolean"})
add_configs("ui_gallery", {description = "Build the magnum-ui-gallery executable.", default = false, type = "boolean"})
add_deps("cmake", "magnum")
on_install("windows", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTS=OFF", "-DLIB_SUFFIX="}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DWITH_UI=" .. (package:config("ui") and "ON" or "OFF"))
table.insert(configs, "-DWITH_PLAYER=" .. (package:config("player") and "ON" or "OFF"))
table.insert(configs, "-DWITH_UI_GALLERY=" .. (package:config("ui_gallery") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
auto year = MAGNUMEXTRAS_VERSION_YEAR;
auto month = MAGNUMEXTRAS_VERSION_MONTH;
}
]]}, {configs = {languages = "c++14"}, includes = "Magnum/versionExtras.h"}))
end)

@ -0,0 +1,46 @@
package("magnum-integration")
set_homepage("https://magnum.graphics/")
set_description("Integration libraries for magnum, Light­weight and mod­u­lar C++11/C++14 graph­ics mid­dle­ware for games and data visu­al­iz­a­tion.")
set_license("MIT")
add_urls("https://github.com/mosra/magnum-integration/archive/refs/tags/$(version).tar.gz",
"https://github.com/mosra/magnum-integration.git")
add_versions("v2020.06", "4eb461e0a38d7be69a52b8faf7664493da4e4cabc2c4fa86bd672d2e8f0a9311")
local intergrations = {"bullet", "dart", "eigen", "glm", "imgui", "ovr"}
for _, integration in ipairs(integrations) do
add_configs(integration, {description = "Build " .. integration .. " integration library.", default = false, type = "boolean"})
end
add_deps("cmake", "magnum")
on_load("windows", "linux", "macosx", function (package)
local configdeps = {bullet = "bullet3",
eigen = "eigen3",
glm = "glm",
imgui = "imgui"}
for config, dep in pairs(configdeps) do
if package:config(config) then
package:add("deps", dep)
end
end
end)
on_install("windows", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTS=OFF", "-DLIB_SUFFIX="}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
for _, integration in ipairs(integrations) do
table.insert(configs, "-DWITH_" .. integration:upper() .. "=" .. (package:config(integration) and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
auto year = MAGNUMINTEGRATION_VERSION_YEAR;
auto month = MAGNUMINTEGRATION_VERSION_MONTH;
}
]]}, {configs = {languages = "c++14"}, includes = "Magnum/versionIntegration.h"}))
end)

@ -0,0 +1,57 @@
package("magnum-plugins")
set_homepage("https://magnum.graphics/")
set_description("Plugins for magnum, C++11/C++14 graph­ics mid­dle­ware for games and data visu­al­iz­a­tion.")
set_license("MIT")
add_urls("https://github.com/mosra/magnum-plugins/archive/refs/tags/$(version).tar.gz",
"https://github.com/mosra/magnum-plugins.git")
add_versions("v2020.06", "8650cab43570c826d2557d5b42459150d253316f7f734af8b3e7d0883510b40a")
add_configs("plugin_static", {description = "Build plugins as static libraries.", default = false, type = "boolean"})
add_configs("openddl", {description = "Build the OpenDdl library.", default = false, type = "boolean"})
local plugins = {"assimpimporter", "basisimageconverter", "basisimporter", "ddsimporter", "devilimageimporter", "drflacaudioimporter", "drmp3audioimporter", "drwavimporter", "faad2audioimporter", "freetypefont", "glslangshaderconverter", "harfbuzzfont", "icoimporter", "jpegimageconverter", "jpegimporter", "meshoptimizersceneconverter", "miniexrimageconverter", "openexrimageconverter", "openexrimporter", "opengeximporter", "pngimageconverter", "pngimporter", "primitiveimporter", "spirvtoolsshaderconverter", "stanfordimporter", "stanfordsceneconverter", "stbdxtimageconverter", "stbimageconverter", "stbimageimporter", "stbtruetypefont", "stbvorbisaudioimporter", "tinygltfimporter"}
for _, plugin in ipairs(plugins) do
add_configs(plugin, {description = "Build the " .. plugin .. " plugin.", default = false, type = "boolean"})
end
add_deps("cmake", "magnum")
on_load("windows", "linux", "macosx", function (package)
local configdeps = {assimpimporter = "assimp",
freetypefont = "freetype",
glslangshaderconverter = "vulkansdk",
harfbuzzfont = "harfbuzz",
jpegimporter = "libjpeg-turbo",
openexrimageconverter = "openexr",
openexrimporter = "openexr",
pngimageconverter = "libpng",
pngimporter = "libpng",
spirvtoolsshaderconverter = "vulkansdk"}
for config, dep in pairs(configdeps) do
if package:config(config) then
package:add("deps", dep)
end
end
end)
on_install("windows", "linux", "macosx", function (package)
local configs = {"-DBUILD_TESTS=OFF", "-DLIB_SUFFIX="}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DBUILD_PLUGIN_STATIC=" .. (package:config("plugin_static") and "ON" or "OFF"))
table.insert(configs, "-DWITH_OPENDDL=" .. (package:config("openddl") and "ON" or "OFF"))
for _, plugin in ipairs(plugins) do
table.insert(configs, "-DWITH_" .. plugin:upper() .. "=" .. (package:config(plugin) and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
auto year = MAGNUMPLUGINS_VERSION_YEAR;
auto month = MAGNUMPLUGINS_VERSION_MONTH;
}
]]}, {configs = {languages = "c++14"}, includes = "Magnum/versionPlugins.h"}))
end)

@ -8,8 +8,35 @@ package("magnum")
"https://github.com/mosra/magnum.git")
add_versions("v2020.06", "98dfe802e56614e4e6bf750d9b693de46a5ed0c6eb479b0268f1a20bf34268bf")
add_configs("audio", {description = "Build audio module.", default = false, type = "boolean"})
add_configs("vulkan", {description = "Build vulkan module.", default = false, type = "boolean"})
add_configs("audio", {description = "Build audio module.", default = false, type = "boolean"})
add_configs("vulkan", {description = "Build vulkan module.", default = false, type = "boolean"})
add_configs("deprecated", {description = "Include deprecated APIs in the build.", default = true, type = "boolean"})
add_configs("plugin_static", {description = "Build plugins as static libraries.", default = false, type = "boolean"})
local applicationlibs = {"android", "emscripten", "glfw", "glx", "sdl2", "xegl", "windowlesscgl", "windowlessegl", "windowlessglx", "windowlessios", "windowlesswgl", "windowlesswindowsegl"}
for _, applicationlib in ipairs(applicationlibs) do
add_configs(applicationlib, {description = "Build the " .. applicationlib .. " application library.", default = false, type = "boolean"})
end
local contexts = {"cgl", "egl", "glx", "wgl"}
for _, context in ipairs(contexts) do
add_configs(context .. "context", {description = "Build the " .. context .. " context handling library.", default = false, type = "boolean"})
end
local testers = {"opengltester", "vulkantester"}
for _, tester in ipairs(testers) do
add_configs(tester, {description = "Build the " .. tester .. " class.", default = false, type = "boolean"})
end
local plugins = {"anyaudioimporter", "anyimageconverter", "anyimageimporter", "anysceneconverter", "anysceneimporter", "anyshaderconverter", "magnumfont", "magnumfontconverter", "objimporter", "tgaimporter", "tgaimageconverter", "wavaudioimporter"}
for _, plugin in ipairs(plugins) do
add_configs(plugin, {description = "Build the " .. plugin .. " plugin.", default = false, type = "boolean"})
end
local utilities = {"gl_info", "vk_info", "al_info", "distancefieldconverter", "fontconverter", "imageconverter", "sceneconverter", "shaderconverter"}
for _, utility in ipairs(utilities) do
add_configs(utility, {description = "Build the " .. utility .. " executable.", default = false, type = "boolean"})
end
add_deps("cmake", "corrade", "opengl")
add_links("MagnumAudio", "MagnumDebugTools", "MagnumGL", "MagnumMeshTools", "MagnumPrimitives", "MagnumSceneGraph", "MagnumShaders", "MagnumText", "MagnumTextureTools", "MagnumTrade", "MagnumVk", "Magnum")
@ -20,6 +47,15 @@ package("magnum")
if package:config("vulkan") then
package:add("deps", "vulkansdk")
end
if package:config("glfw") then
package:add("deps", "glfw")
end
if package:config("sdl2") then
package:add("deps", "libsdl")
end
if package:config("glx") then
package:add("deps", "libx11")
end
end)
on_install("windows", "linux", "macosx", function (package)
@ -28,6 +64,23 @@ package("magnum")
table.insert(configs, "-DBUILD_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
table.insert(configs, "-DWITH_AUDIO=" .. (package:config("audio") and "ON" or "OFF"))
table.insert(configs, "-DWITH_VK=" .. (package:config("vulkan") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_DEPRECATED=" .. (package:config("deprecated") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_PLUGIN_STATIC=" .. (package:config("plugin_static") and "ON" or "OFF"))
for _, applicationlib in ipairs(applicationlibs) do
table.insert(configs, "-DWITH_" .. applicationlib:upper() .. "APPLICATION=" .. (package:config(applicationlib) and "ON" or "OFF"))
end
for _, context in ipairs(contexts) do
table.insert(configs, "-DWITH_" .. context:upper() .. "CONTEXT=" .. (package:config(context) and "ON" or "OFF"))
end
for _, tester in ipairs(testers) do
table.insert(configs, "-DWITH_" .. tester:upper() .. "=" .. (package:config(tester) and "ON" or "OFF"))
end
for _, plugin in ipairs(plugins) do
table.insert(configs, "-DWITH_" .. plugin:upper() .. "=" .. (package:config(plugin) and "ON" or "OFF"))
end
for _, utility in ipairs(utilities) do
table.insert(configs, "-DWITH_" .. utility:upper() .. "=" .. (package:config(utility) and "ON" or "OFF"))
end
import("package.tools.cmake").install(package, configs, {buildir = os.tmpdir()})
end)

Loading…
Cancel
Save