Crafter.Build/tests/fixtures/libraries/project.cpp

47 lines
1.6 KiB
C++
Raw Normal View History

import std;
import Crafter.Build;
namespace fs = std::filesystem;
using namespace Crafter;
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view>) {
static auto MathStatic = std::make_unique<Configuration>();
MathStatic->path = "./mathlib/";
MathStatic->name = "MathLib";
MathStatic->outputName = "MathLib";
MathStatic->target = "x86_64-pc-linux-gnu";
MathStatic->type = ConfigurationType::LibraryStatic;
{
std::array<fs::path, 1> ifaces = { "MathLib" };
std::array<fs::path, 0> impls = {};
MathStatic->GetInterfacesAndImplementations(ifaces, impls);
}
static auto GreetDynamic = std::make_unique<Configuration>();
GreetDynamic->path = "./greetlib/";
GreetDynamic->name = "GreetLib";
GreetDynamic->outputName = "GreetLib";
GreetDynamic->target = "x86_64-pc-linux-gnu";
GreetDynamic->type = ConfigurationType::LibraryDynamic;
{
std::array<fs::path, 1> ifaces = { "GreetLib" };
std::array<fs::path, 0> impls = {};
GreetDynamic->GetInterfacesAndImplementations(ifaces, impls);
}
Configuration app;
app.path = "./";
app.name = "libs-app";
app.outputName = "libs-app";
app.target = "x86_64-pc-linux-gnu";
app.type = ConfigurationType::Executable;
app.dependencies = { MathStatic.get(), GreetDynamic.get() };
{
std::array<fs::path, 0> ifaces = {};
std::array<fs::path, 1> impls = { "main" };
app.GetInterfacesAndImplementations(ifaces, impls);
}
app.linkFlags.push_back("-Wl,--export-dynamic");
app.linkFlags.push_back("-ldl");
return app;
}