Improve xmake build

This commit is contained in:
Jérôme Leclercq 2021-05-05 14:02:05 +02:00
parent 6ed3d2b144
commit 24c2de405f
10 changed files with 44 additions and 67 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
# xmake-related files # xmake-related files
.xmake .xmake/*
.vscode/*
CMakeLists.txt CMakeLists.txt
Makefile Makefile
vs/* vs/*

View File

@ -1,14 +0,0 @@
EXAMPLE.Name = "DopplerEffect"
EXAMPLE.EnableConsole = true
EXAMPLE.Files = {
"main.cpp"
}
EXAMPLE.Libraries = {
"NazaraAudio",
"NazaraCore",
"NazaraPlatform",
"NazaraUtility"
}

View File

@ -0,0 +1,5 @@
target("DopplerEffect")
set_group("Examples")
set_kind("binary")
add_deps("NazaraAudio", "NazaraPlatform")
add_files("main.cpp")

View File

@ -1,16 +0,0 @@
EXAMPLE.Name = "GraphicsTest"
EXAMPLE.EnableConsole = true
EXAMPLE.Files = {
"main.cpp"
}
EXAMPLE.Libraries = {
"NazaraCore",
"NazaraGraphics",
"NazaraPlatform",
"NazaraRenderer",
"NazaraShader",
"NazaraUtility"
}

View File

@ -0,0 +1,5 @@
target("GraphicsTest")
set_group("Examples")
set_kind("binary")
add_deps("NazaraGraphics")
add_files("main.cpp")

View File

@ -1,15 +0,0 @@
EXAMPLE.Name = "RenderTest"
EXAMPLE.EnableConsole = true
EXAMPLE.Files = {
"main.cpp"
}
EXAMPLE.Libraries = {
"NazaraCore",
"NazaraPlatform",
"NazaraRenderer",
"NazaraShader",
"NazaraUtility"
}

View File

@ -0,0 +1,5 @@
target("RenderTest")
set_group("Examples")
set_kind("binary")
add_deps("NazaraRenderer")
add_files("main.cpp")

13
plugins/Assimp/xmake.lua Normal file
View File

@ -0,0 +1,13 @@
add_requires("assimp")
target("PluginAssimp")
set_kind("shared")
set_group("Plugins")
add_deps("NazaraUtility")
add_packages("assimp")
add_headerfiles("**.hpp")
add_headerfiles("**.inl")
add_includedirs(".")
add_files("**.cpp")

4
thirdparty/xmake.lua vendored Normal file
View File

@ -0,0 +1,4 @@
target("stb_image")
set_kind("static")
set_group("Thirdparties")
add_files("src/stb/*.cpp")

View File

@ -13,6 +13,11 @@ local modules = {
if is_plat("windows") then if is_plat("windows") then
add_syslinks("ws2_32") add_syslinks("ws2_32")
end end
if is_plat("linux") then
del_files("src/Nazara/Network/Posix/SocketPollerImpl.hpp")
del_files("src/Nazara/Network/Posix/SocketPollerImpl.cpp")
end
end end
}, },
OpenGLRenderer = { OpenGLRenderer = {
@ -79,8 +84,7 @@ local modules = {
} }
} }
add_requires("assimp", "chipmunk2d", "libsndfile") add_requires("chipmunk2d", "freetype", "libsndfile", "libsdl")
add_requires("freetype", "libsdl", { configs = { shared = true }})
add_requires("newtondynamics", { debug = is_mode("debug") }) add_requires("newtondynamics", { debug = is_mode("debug") })
set_project("NazaraEngine") set_project("NazaraEngine")
@ -97,7 +101,6 @@ add_sysincludedirs("thirdparty/include")
set_languages("c89", "cxx17") set_languages("c89", "cxx17")
set_rundir("./bin/$(os)_$(arch)_$(mode)") set_rundir("./bin/$(os)_$(arch)_$(mode)")
set_runtimes(is_mode("debug") and "MDd" or "MD")
set_symbols("debug", "hidden") set_symbols("debug", "hidden")
set_targetdir("./bin/$(os)_$(arch)_$(mode)") set_targetdir("./bin/$(os)_$(arch)_$(mode)")
set_warnings("allextra") set_warnings("allextra")
@ -108,6 +111,8 @@ if is_mode("releasedbg") then
end end
if is_plat("windows") then if is_plat("windows") then
set_runtimes(is_mode("debug") and "MDd" or "MD")
add_defines("_CRT_SECURE_NO_WARNINGS") add_defines("_CRT_SECURE_NO_WARNINGS")
add_cxxflags("/bigobj", "/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew") add_cxxflags("/bigobj", "/permissive-", "/Zc:__cplusplus", "/Zc:referenceBinding", "/Zc:throwingNew")
add_cxxflags("/FC") add_cxxflags("/FC")
@ -115,10 +120,7 @@ if is_plat("windows") then
add_cxflags("/wd4251") -- Disable warning: class needs to have dll-interface to be used by clients of class blah blah blah add_cxflags("/wd4251") -- Disable warning: class needs to have dll-interface to be used by clients of class blah blah blah
end end
target("stb_image") includes("thirdparty/xmake.lua")
set_kind("static")
set_group("Thirdparties")
add_files("thirdparty/src/stb/*.cpp")
for name, module in pairs(modules) do for name, module in pairs(modules) do
target("Nazara" .. name) target("Nazara" .. name)
@ -161,20 +163,7 @@ for name, module in pairs(modules) do
end end
end end
target("PluginAssimp") includes("plugins/*/xmake.lua")
set_kind("shared")
set_group("Plugins")
add_deps("NazaraUtility")
add_packages("assimp")
add_headerfiles("plugins/Assimp/**.hpp")
add_headerfiles("plugins/Assimp/**.inl")
add_includedirs("plugins/Assimp")
add_files("plugins/Assimp/**.cpp")
target_end()
includes("examples/*/xmake.lua") includes("examples/*/xmake.lua")
rule("debug_suffix") rule("debug_suffix")