Use C++23. Do not build mod converter if fbx sdk is not present.

This commit is contained in:
lzwdgc 2022-09-05 01:27:52 +03:00
parent 3e6326747e
commit c0e6a2226e

18
sw.cpp
View file

@ -5,29 +5,31 @@ void build(Solution &s)
auto &tools = s.addProject("Polygon4.Tools", "master"); auto &tools = s.addProject("Polygon4.Tools", "master");
tools += Git("https://github.com/aimrebirth/tools", "", "{v}"); tools += Git("https://github.com/aimrebirth/tools", "", "{v}");
auto cppstd = cpp23;
auto &common = tools.addStaticLibrary("common"); auto &common = tools.addStaticLibrary("common");
common += cpp20; common += cppstd;
common.setRootDirectory("src/common"); common.setRootDirectory("src/common");
common.Public += "pub.egorpugin.primitives.filesystem"_dep; common.Public += "pub.egorpugin.primitives.filesystem"_dep;
auto add_exe = [&tools](const String &name) -> decltype(auto) auto add_exe = [&](const String &name) -> decltype(auto)
{ {
auto &t = tools.addExecutable(name); auto &t = tools.addExecutable(name);
t.PackageDefinitions = true; t.PackageDefinitions = true;
t += cpp20; t += cppstd;
t.setRootDirectory("src/" + name); t.setRootDirectory("src/" + name);
t += "pub.egorpugin.primitives.sw.main"_dep; t += "pub.egorpugin.primitives.sw.main"_dep;
return t; return t;
}; };
auto add_exe_with_common = [&add_exe, &common](const String &name) -> decltype(auto) auto add_exe_with_common = [&](const String &name) -> decltype(auto)
{ {
auto &t = add_exe(name); auto &t = add_exe(name);
t.Public += common; t.Public += common;
return t; return t;
}; };
auto add_exe_with_data_manager = [&add_exe_with_common](const String &name) -> decltype(auto) auto add_exe_with_data_manager = [&](const String &name) -> decltype(auto)
{ {
auto &t = add_exe_with_common(name); auto &t = add_exe_with_common(name);
t.Public += "pub.lzwdgc.Polygon4.DataManager-master"_dep; t.Public += "pub.lzwdgc.Polygon4.DataManager-master"_dep;
@ -59,7 +61,7 @@ void build(Solution &s)
auto &model = tools.addStaticLibrary("model"); auto &model = tools.addStaticLibrary("model");
{ {
model += cpp20; model += cppstd;
model.setRootDirectory("src/model"); model.setRootDirectory("src/model");
model.Public += common, model.Public += common,
"org.sw.demo.unicode.icu.i18n"_dep, "org.sw.demo.unicode.icu.i18n"_dep,
@ -71,10 +73,11 @@ void build(Solution &s)
add_exe("mod_reader") += model; add_exe("mod_reader") += model;
path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0";
if (fs::exists(sdk)) {
auto &mod_converter = add_exe("mod_converter"); auto &mod_converter = add_exe("mod_converter");
mod_converter += model; mod_converter += model;
mod_converter += "org.sw.demo.xmlsoft.libxml2"_dep; // fbx 2020 sdk requires libxml2 mod_converter += "org.sw.demo.xmlsoft.libxml2"_dep; // fbx 2020 sdk requires libxml2
path sdk = "d:/arh/apps/Autodesk/FBX/FBX SDK/2019.0";
mod_converter += IncludeDirectory(sdk / "include"); mod_converter += IncludeDirectory(sdk / "include");
String cfg = "release"; String cfg = "release";
if (mod_converter.getBuildSettings().Native.ConfigurationType == ConfigurationType::Debug) if (mod_converter.getBuildSettings().Native.ConfigurationType == ConfigurationType::Debug)
@ -87,3 +90,4 @@ void build(Solution &s)
md = "mt"; md = "mt";
mod_converter += LinkLibrary(sdk / ("lib/vs2015/" + arch + "/" + cfg + "/libfbxsdk-" + md + ".lib")); mod_converter += LinkLibrary(sdk / ("lib/vs2015/" + arch + "/" + cfg + "/libfbxsdk-" + md + ".lib"));
} }
}