diff --git a/tooling/project.cpp b/tooling/project.cpp index 1314403..b4db367 100644 --- a/tooling/project.cpp +++ b/tooling/project.cpp @@ -17,14 +17,26 @@ import Crafter.Build; namespace fs = std::filesystem; using namespace Crafter; +namespace { + // This file's directory. crafter-build runs a pragma's project file from + // the root of the clone for a git source, and from the file's own + // directory for a local path, so "./" and relative sources named the + // repository root for every consumer using the URL: "No module + // declaration found in .../interfaces/Crafter.Debug.Build.cppm". Spelled + // from the file itself, they mean this directory in both cases. + fs::path Here() { + return fs::path(std::source_location::current().file_name()).parent_path(); + } +} + extern "C" Configuration CrafterBuildProject(std::span args) { Configuration cfg; - cfg.path = "./"; + cfg.path = Here(); cfg.name = "Crafter.Debug.Build"; cfg.outputName = "Crafter.Debug.Build"; cfg.type = ConfigurationType::LibraryStatic; ApplyStandardArgs(cfg, args); - std::array interfaces = { "interfaces/Crafter.Debug.Build" }; + std::array interfaces = { Here() / "interfaces" / "Crafter.Debug.Build" }; std::array implementations = {}; cfg.GetInterfacesAndImplementations(interfaces, implementations); return cfg;