Build: Disable unit tests build (and requirements) by default
This commit is contained in:
parent
22c99bfd1d
commit
9f05a22db7
|
|
@ -63,7 +63,7 @@ jobs:
|
|||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --shadernodes=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ jobs:
|
|||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake config --shadernodes=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
run: xmake config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ jobs:
|
|||
|
||||
# Setup compilation mode and install project dependencies
|
||||
- name: Configure xmake and install dependencies
|
||||
run: xmake.exe config --shadernodes=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
run: xmake.exe config --shadernodes=y --tests=y --arch=${{ matrix.arch }} --mode=${{ matrix.mode }} --verbose --yes
|
||||
|
||||
# Build the engine
|
||||
- name: Build Nazara
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
option("assimp")
|
||||
set_default(true)
|
||||
set_showmenu(true)
|
||||
set_description("Build Assimp plugin")
|
||||
set_default(true)
|
||||
set_showmenu(true)
|
||||
set_description("Build Assimp plugin")
|
||||
|
||||
option_end()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
option("tests")
|
||||
set_default(true)
|
||||
set_showmenu(true)
|
||||
set_description("Build unit tests")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
set_description("Build unit tests")
|
||||
|
||||
option_end()
|
||||
|
||||
|
|
|
|||
186
tools/xmake.lua
186
tools/xmake.lua
|
|
@ -1,117 +1,117 @@
|
|||
option("shadernodes")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
set_description("Build ShaderNodes tool")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
set_description("Build ShaderNodes tool")
|
||||
|
||||
option_end()
|
||||
|
||||
if has_config("shadernodes") then
|
||||
add_requires("nodeeditor", "qt5core", "qt5gui", "qt5widgets", {debug = is_mode("debug")})
|
||||
add_requires("nodeeditor", "qt5core", "qt5gui", "qt5widgets", {debug = is_mode("debug")})
|
||||
|
||||
rule("qt5.env")
|
||||
after_load(function (target)
|
||||
-- retrieve qtbase
|
||||
local qtdir
|
||||
rule("qt5.env")
|
||||
after_load(function (target)
|
||||
-- retrieve qtbase
|
||||
local qtdir
|
||||
|
||||
local qtbase = target:pkg("qt5base")
|
||||
if qtbase then
|
||||
qtdir = assert(qtbase:get("qtdir"))
|
||||
else
|
||||
local qtcore = target:pkg("qt5core")
|
||||
if not qtcore then
|
||||
os.raise("target " .. target:name() .. " does not use qt5")
|
||||
end
|
||||
qtdir = assert(qtcore:get("qtdir"))
|
||||
end
|
||||
local qtbase = target:pkg("qt5base")
|
||||
if qtbase then
|
||||
qtdir = assert(qtbase:get("qtdir"))
|
||||
else
|
||||
local qtcore = target:pkg("qt5core")
|
||||
if not qtcore then
|
||||
os.raise("target " .. target:name() .. " does not use qt5")
|
||||
end
|
||||
qtdir = assert(qtcore:get("qtdir"))
|
||||
end
|
||||
|
||||
target:data_set("qt", qtdir)
|
||||
end)
|
||||
target:data_set("qt", qtdir)
|
||||
end)
|
||||
|
||||
|
||||
rule("qt5.moc")
|
||||
add_deps("qt5.env")
|
||||
set_extensions(".h", ".hpp")
|
||||
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
|
||||
local qtbase = target:dep("qt5core")
|
||||
local qt = assert(qtbase:fetch().qtbase, "qt not found!")
|
||||
rule("qt5.moc")
|
||||
add_deps("qt5.env")
|
||||
set_extensions(".h", ".hpp")
|
||||
before_buildcmd_file(function (target, batchcmds, sourcefile, opt)
|
||||
local qtbase = target:dep("qt5core")
|
||||
local qt = assert(qtbase:fetch().qtbase, "qt not found!")
|
||||
|
||||
-- imports
|
||||
import("core.tool.compiler")
|
||||
-- imports
|
||||
import("core.tool.compiler")
|
||||
|
||||
-- get moc
|
||||
local moc = path.join(qt.bindir, is_host("windows") and "moc.exe" or "moc")
|
||||
if not os.isexec(moc) and qt.libexecdir then
|
||||
moc = path.join(qt.libexecdir, is_host("windows") and "moc.exe" or "moc")
|
||||
end
|
||||
assert(moc and os.isexec(moc), "moc not found!")
|
||||
-- get moc
|
||||
local moc = path.join(qt.bindir, is_host("windows") and "moc.exe" or "moc")
|
||||
if not os.isexec(moc) and qt.libexecdir then
|
||||
moc = path.join(qt.libexecdir, is_host("windows") and "moc.exe" or "moc")
|
||||
end
|
||||
assert(moc and os.isexec(moc), "moc not found!")
|
||||
|
||||
-- get c++ source file for moc
|
||||
--
|
||||
-- add_files("mainwindow.h") -> moc_MainWindow.cpp
|
||||
-- add_files("mainwindow.cpp", {rules = "qt.moc"}) -> mainwindow.moc, @see https://github.com/xmake-io/xmake/issues/750
|
||||
--
|
||||
local basename = path.basename(sourcefile)
|
||||
local filename_moc = "moc_" .. basename .. ".cpp"
|
||||
if sourcefile:endswith(".cpp") then
|
||||
filename_moc = basename .. ".moc"
|
||||
end
|
||||
local sourcefile_moc = path.join(target:autogendir(), "rules", "qt", "moc", filename_moc)
|
||||
-- get c++ source file for moc
|
||||
--
|
||||
-- add_files("mainwindow.h") -> moc_MainWindow.cpp
|
||||
-- add_files("mainwindow.cpp", {rules = "qt.moc"}) -> mainwindow.moc, @see https://github.com/xmake-io/xmake/issues/750
|
||||
--
|
||||
local basename = path.basename(sourcefile)
|
||||
local filename_moc = "moc_" .. basename .. ".cpp"
|
||||
if sourcefile:endswith(".cpp") then
|
||||
filename_moc = basename .. ".moc"
|
||||
end
|
||||
local sourcefile_moc = path.join(target:autogendir(), "rules", "qt", "moc", filename_moc)
|
||||
|
||||
-- add objectfile
|
||||
local objectfile = target:objectfile(sourcefile_moc)
|
||||
table.insert(target:objectfiles(), objectfile)
|
||||
-- add objectfile
|
||||
local objectfile = target:objectfile(sourcefile_moc)
|
||||
table.insert(target:objectfiles(), objectfile)
|
||||
|
||||
-- add commands
|
||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.qt.moc %s", sourcefile)
|
||||
-- add commands
|
||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.qt.moc %s", sourcefile)
|
||||
|
||||
-- generate c++ source file for moc
|
||||
local flags = {}
|
||||
table.join2(flags, compiler.map_flags("cxx", "define", target:get("defines")))
|
||||
table.join2(flags, compiler.map_flags("cxx", "includedir", target:get("includedirs")))
|
||||
table.join2(flags, compiler.map_flags("cxx", "includedir", target:get("sysincludedirs"))) -- for now, moc process doesn't support MSVC external includes flags and will fail
|
||||
table.join2(flags, compiler.map_flags("cxx", "frameworkdir", target:get("frameworkdirs")))
|
||||
batchcmds:mkdir(path.directory(sourcefile_moc))
|
||||
batchcmds:vrunv(moc, table.join(flags, sourcefile, "-o", sourcefile_moc))
|
||||
-- generate c++ source file for moc
|
||||
local flags = {}
|
||||
table.join2(flags, compiler.map_flags("cxx", "define", target:get("defines")))
|
||||
table.join2(flags, compiler.map_flags("cxx", "includedir", target:get("includedirs")))
|
||||
table.join2(flags, compiler.map_flags("cxx", "includedir", target:get("sysincludedirs"))) -- for now, moc process doesn't support MSVC external includes flags and will fail
|
||||
table.join2(flags, compiler.map_flags("cxx", "frameworkdir", target:get("frameworkdirs")))
|
||||
batchcmds:mkdir(path.directory(sourcefile_moc))
|
||||
batchcmds:vrunv(moc, table.join(flags, sourcefile, "-o", sourcefile_moc))
|
||||
|
||||
-- we need compile this moc_xxx.cpp file if exists Q_PRIVATE_SLOT, @see https://github.com/xmake-io/xmake/issues/750
|
||||
local mocdata = io.readfile(sourcefile)
|
||||
if mocdata and mocdata:find("Q_PRIVATE_SLOT") or sourcefile_moc:endswith(".moc") then
|
||||
-- add includedirs of sourcefile_moc
|
||||
target:add("includedirs", path.directory(sourcefile_moc))
|
||||
-- we need compile this moc_xxx.cpp file if exists Q_PRIVATE_SLOT, @see https://github.com/xmake-io/xmake/issues/750
|
||||
local mocdata = io.readfile(sourcefile)
|
||||
if mocdata and mocdata:find("Q_PRIVATE_SLOT") or sourcefile_moc:endswith(".moc") then
|
||||
-- add includedirs of sourcefile_moc
|
||||
target:add("includedirs", path.directory(sourcefile_moc))
|
||||
|
||||
-- remove the object file of sourcefile_moc
|
||||
local objectfiles = target:objectfiles()
|
||||
for idx, objectfile in ipairs(objectfiles) do
|
||||
if objectfile == target:objectfile(sourcefile_moc) then
|
||||
table.remove(objectfiles, idx)
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
-- compile c++ source file for moc
|
||||
batchcmds:compile(sourcefile_moc, objectfile)
|
||||
end
|
||||
-- remove the object file of sourcefile_moc
|
||||
local objectfiles = target:objectfiles()
|
||||
for idx, objectfile in ipairs(objectfiles) do
|
||||
if objectfile == target:objectfile(sourcefile_moc) then
|
||||
table.remove(objectfiles, idx)
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
-- compile c++ source file for moc
|
||||
batchcmds:compile(sourcefile_moc, objectfile)
|
||||
end
|
||||
|
||||
-- add deps
|
||||
batchcmds:add_depfiles(sourcefile)
|
||||
batchcmds:set_depmtime(os.mtime(objectfile))
|
||||
batchcmds:set_depcache(target:dependfile(objectfile))
|
||||
end)
|
||||
-- add deps
|
||||
batchcmds:add_depfiles(sourcefile)
|
||||
batchcmds:set_depmtime(os.mtime(objectfile))
|
||||
batchcmds:set_depcache(target:dependfile(objectfile))
|
||||
end)
|
||||
|
||||
target("NazaraShaderNodes")
|
||||
set_group("Tools")
|
||||
set_kind("binary")
|
||||
add_rules("qt5.moc")
|
||||
target("NazaraShaderNodes")
|
||||
set_group("Tools")
|
||||
set_kind("binary")
|
||||
add_rules("qt5.moc")
|
||||
|
||||
add_deps("NazaraShader")
|
||||
add_packages("nodeeditor")
|
||||
add_packages("qt5core", "qt5gui", "qt5widgets")
|
||||
if not is_plat("windows") then
|
||||
add_cxflags("-fPIC")
|
||||
end
|
||||
add_deps("NazaraShader")
|
||||
add_packages("nodeeditor")
|
||||
add_packages("qt5core", "qt5gui", "qt5widgets")
|
||||
if not is_plat("windows") then
|
||||
add_cxflags("-fPIC")
|
||||
end
|
||||
|
||||
add_includedirs("../src")
|
||||
add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl")
|
||||
add_files("../src/ShaderNode/**.cpp")
|
||||
add_includedirs("../src")
|
||||
add_headerfiles("../src/ShaderNode/**.hpp", "../src/ShaderNode/**.inl")
|
||||
add_files("../src/ShaderNode/**.cpp")
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue