From 9bd12660eb27809ab4d9d5d77a0ea44efa8151d6 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Mon, 2 Mar 2026 15:24:45 +0100 Subject: [PATCH] libc++ --- build.sh | 78 ++++++++++--------- implementations/Crafter.Build-Command.cpp | 8 +- .../Crafter.Build-Configuration.cpp | 16 +++- implementations/Crafter.Build-Module.cpp | 4 +- implementations/Crafter.Build-Project.cpp | 16 +++- interfaces/Crafter.Build-Configuration.cppm | 6 ++ interfaces/Crafter.Build-Shader.cppm | 3 - project.json | 15 +++- 8 files changed, 90 insertions(+), 56 deletions(-) diff --git a/build.sh b/build.sh index f8731f3..e648722 100755 --- a/build.sh +++ b/build.sh @@ -1,46 +1,50 @@ mkdir build mkdir bin -mkdir bin/executable +mkdir bin/executable-linux-gnu -GCC_VERSION=$(g++ -dumpversion) -STD_HEADER="/usr/include/c++/$GCC_VERSION/bits/std.cc" -if [ ! -f "$STD_HEADER" ]; then - echo "Cannot find std.cc for GCC $GCC_VERSION" - exit 1 -fi -cp "$STD_HEADER" ./build/std.cppm -clang++ -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile ./build/std.cppm -o ./build/std.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-CompileStatus.cppm -o ./build/Crafter.Build-CompileStatus.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Command.cppm -o ./build/Crafter.Build-Command.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Shader.cppm -o ./build/Crafter.Build-Shader.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Module.cppm -o ./build/Crafter.Build-Module.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Implementation.cppm -o ./build/Crafter.Build-Implementation.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Configuration.cppm -o ./build/Crafter.Build-Configuration.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Test.cppm -o ./build/Crafter.Build-Test.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build-Project.cppm -o ./build/Crafter.Build-Project.pcm -clang++ -std=c++26 --precompile -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE interfaces/Crafter.Build.cppm -o ./build/Crafter.Build.pcm +git clone https://github.com/KhronosGroup/glslang.git ./build/glslang -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Command.pcm -o ./build/Crafter.Build-Command.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Shader.pcm -o ./build/Crafter.Build-Shader.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Module.pcm -o ./build/Crafter.Build-Module.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Implementation.pcm -o ./build/Crafter.Build-Implementation.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Configuration.pcm -o ./build/Crafter.Build-Configuration.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Project.pcm -o ./build/Crafter.Build-Project.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-Test.pcm -o ./build/Crafter.Build-Test.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build-CompileStatus.pcm -o ./build/Crafter.Build-CompileStatus.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./build/Crafter.Build.pcm -o ./build/Crafter.Build.o +current_dir=$(pwd) -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Command.cpp -o ./build/Crafter.Build-Command_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Test.cpp -o ./build/Crafter.Build-Test_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Implementation.cpp -o ./build/Crafter.Build-Implementation_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Shader.cpp -o ./build/Crafter.Build-Shader_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Module.cpp -o ./build/Crafter.Build-Module_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Configuration.cpp -o ./build/Crafter.Build-Configuration_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/Crafter.Build-Project.cpp -o ./build/Crafter.Build-Project_impl.o -clang++ -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c ./implementations/main.cpp -o ./build/main.o +cd ./build/glslang +cmake -B build \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" \ + -DCMAKE_SHARED_LINKER_FLAGS="-stdlib=libc++" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$current_dir/build \ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$current_dir/build \ + -DENABLE_OPT=OFF -clang++ -std=c++26 -O3 -march=native -mtune=native -L/usr/local/lib -L/usr/lib/ -lvulkan -lMachineIndependent -lOSDependent -lGenericCodeGen -lglslang -lglslang-default-resource-limits -lSPIRV -ltbb -fuse-ld=lld ./build/Crafter.Build-Command.o ./build/Crafter.Build-CompileStatus.o ./build/Crafter.Build-Shader.o ./build/Crafter.Build-Module.o ./build/Crafter.Build-Configuration.o ./build/Crafter.Build-Project.o ./build/Crafter.Build.o ./build/Crafter.Build-Command_impl.o ./build/Crafter.Build-Shader_impl.o ./build/Crafter.Build-Module_impl.o ./build/Crafter.Build-Configuration_impl.o ./build/Crafter.Build-Project_impl.o ./build/Crafter.Build-Implementation.o ./build/Crafter.Build-Implementation_impl.o ./build/Crafter.Build-Test_impl.o ./build/Crafter.Build-Test.o ./build/main.o -o ./bin/executable/crafter-build +cmake --build build --config Release +cd ../../ + +common_options="-stdlib=libc++ -I./build -std=c++26 -O3 -march=native -mtune=native -fprebuilt-module-path=./build -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -D CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu -D CRAFTER_BUILD_CONFIGURATION_TYPE_EXECUTABLE -c" + +clang++ -std=c++26 -stdlib=libc++ -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile /usr/share/libc++/v1/std.cppm -o ./build/std.pcm + +clang++ $common_options -fmodule-output interfaces/Crafter.Build-CompileStatus.cppm -o ./build/Crafter.Build-CompileStatus.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Command.cppm -o ./build/Crafter.Build-Command.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Shader.cppm -o ./build/Crafter.Build-Shader.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Module.cppm -o ./build/Crafter.Build-Module.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Implementation.cppm -o ./build/Crafter.Build-Implementation.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Configuration.cppm -o ./build/Crafter.Build-Configuration.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Test.cppm -o ./build/Crafter.Build-Test.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build-Project.cppm -o ./build/Crafter.Build-Project.o +clang++ $common_options -fmodule-output interfaces/Crafter.Build.cppm -o ./build/Crafter.Build.o + +clang++ $common_options ./implementations/Crafter.Build-Command.cpp -o ./build/Crafter.Build-Command_impl.o +clang++ $common_options ./implementations/Crafter.Build-Test.cpp -o ./build/Crafter.Build-Test_impl.o +clang++ $common_options ./implementations/Crafter.Build-Implementation.cpp -o ./build/Crafter.Build-Implementation_impl.o +clang++ $common_options ./implementations/Crafter.Build-Shader.cpp -o ./build/Crafter.Build-Shader_impl.o +clang++ $common_options ./implementations/Crafter.Build-Module.cpp -o ./build/Crafter.Build-Module_impl.o +clang++ $common_options ./implementations/Crafter.Build-Configuration.cpp -o ./build/Crafter.Build-Configuration_impl.o +clang++ $common_options ./implementations/Crafter.Build-Project.cpp -o ./build/Crafter.Build-Project_impl.o +clang++ $common_options ./implementations/main.cpp -o ./build/main.o + +clang++ -std=c++26 -stdlib=libc++ -O3 -march=native -mtune=native -L./build -fuse-ld=lld -lSPIRV -GenericCodeGen -lglslang -lOSDependent -lMachineIndependent -lglslang-default-resource-limits ./build/Crafter.Build-Command.o ./build/Crafter.Build-CompileStatus.o ./build/Crafter.Build-Shader.o ./build/Crafter.Build-Module.o ./build/Crafter.Build-Configuration.o ./build/Crafter.Build-Project.o ./build/Crafter.Build.o ./build/Crafter.Build-Command_impl.o ./build/Crafter.Build-Shader_impl.o ./build/Crafter.Build-Module_impl.o ./build/Crafter.Build-Configuration_impl.o ./build/Crafter.Build-Project_impl.o ./build/Crafter.Build-Implementation.o ./build/Crafter.Build-Implementation_impl.o ./build/Crafter.Build-Test_impl.o ./build/Crafter.Build-Test.o ./build/main.o -o ./bin/executable-linux-gnu/crafter-build cp -r binlib/* bin/ - rm -rf build \ No newline at end of file diff --git a/implementations/Crafter.Build-Command.cpp b/implementations/Crafter.Build-Command.cpp index 354eb1b..6332a54 100644 --- a/implementations/Crafter.Build-Command.cpp +++ b/implementations/Crafter.Build-Command.cpp @@ -211,12 +211,8 @@ namespace Crafter { fs::create_directories(exeDir/config.target); const std::string stdPcm = std::format("{}/{}/std.pcm", exeDir.string(), config.target); - std::string gccVersion = RunCommand("g++ -dumpversion"); - gccVersion.pop_back(); - fs::path stdCc = fs::path(std::format("/usr/include/c++/{}/bits/std.cc", gccVersion)); - - if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time(stdCc)) { - std::string result = RunCommand(std::format("cp {} {}/{}/std.cppm\nclang++ --target={} -std=c++26 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile {}/{}/std.cppm -o {}", stdCc.string(), exeDir.string(), config.target, config.target, exeDir.string(), config.target, stdPcm)); + if(!fs::exists(stdPcm) || fs::last_write_time(stdPcm) < fs::last_write_time("/usr/share/libc++/v1/std.cppm")) { + std::string result = RunCommand(std::format("clang++ --target={} -std=c++26 -stdlib=libc++ -march=native -mtune=native -O3 -Wno-reserved-identifier -Wno-reserved-module-identifier --precompile /usr/share/libc++/v1/std.cppm -o {}", config.target, stdPcm)); if(result != "") { throw std::runtime_error(result); } diff --git a/implementations/Crafter.Build-Configuration.cpp b/implementations/Crafter.Build-Configuration.cpp index a63c59a..8384279 100644 --- a/implementations/Crafter.Build-Configuration.cpp +++ b/implementations/Crafter.Build-Configuration.cpp @@ -268,7 +268,6 @@ namespace Crafter { if(config.contains("dependencies")) { for (auto it : config["dependencies"]) { fs::path path = it["path"].get(); - std::string configName = it["configuration"].get(); if(path.string().ends_with(".git")) { fs::path name = path.filename(); name.replace_extension(); @@ -305,7 +304,20 @@ namespace Crafter { // Update path to the project.json of the dependency path = cacheDir / depFolder / "project.json"; } - + if(it.contains("type")) { + std::string type = it["type"].get(); + if(type == "cmake") { + std::string options; + if(it.contains("options")) { + options = it["options"].get(); + } + cmakeDeps.emplace_back(path.parent_path(), options); + continue; + } + } + + std::string configName = it["configuration"].get(); + // Create a Project object for the dependency std::unique_ptr depProject = std::make_unique(std::move(path), configName); diff --git a/implementations/Crafter.Build-Module.cpp b/implementations/Crafter.Build-Module.cpp index eb0332e..a227fae 100644 --- a/implementations/Crafter.Build-Module.cpp +++ b/implementations/Crafter.Build-Module.cpp @@ -74,7 +74,7 @@ namespace Crafter { result += RunClang(std::format("cd {} && {} {}.cppm --precompile -o {}.pcm", pcmDir.string(), clang, path.string(), path.filename().string())); #endif - result += RunClang(std::format("{} {}.pcm -c -o {}.o", clang, (pcmDir/path.filename()).string(), (buildDir/path.filename()).string())); + result += RunClang(std::format("{} -Wno-unused-command-line-argument {}.pcm -c -o {}.o", clang, (pcmDir/path.filename()).string(), (buildDir/path.filename()).string())); if(result.empty()) { compiled.store(CRAFTER_COMPILE_STATUS_COMPLETED); compiled.notify_all(); @@ -157,7 +157,7 @@ namespace Crafter { #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32) result += RunClang(std::format("cd {} && {} {}.cppm --precompile -o {}.pcm", pcmDir.string(), clang, path.string(), path.filename().string())); #endif - result += RunClang(std::format("{} {}.pcm -c -o {}.o", clang, (pcmDir/path.filename()).string(), (buildDir/path.filename()).string())); + result += RunClang(std::format("{} -Wno-unused-command-line-argument {}.pcm -c -o {}.o", clang, (pcmDir/path.filename()).string(), (buildDir/path.filename()).string())); if(result.empty()) { compiled.store(CRAFTER_COMPILE_STATUS_COMPLETED); compiled.notify_all(); diff --git a/implementations/Crafter.Build-Project.cpp b/implementations/Crafter.Build-Project.cpp index 3fe83a4..7b28cb8 100644 --- a/implementations/Crafter.Build-Project.cpp +++ b/implementations/Crafter.Build-Project.cpp @@ -246,7 +246,7 @@ namespace Crafter { std::replace(editedTarget.begin(), editedTarget.end(), '-', '_'); #ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu - std::string command = std::format("clang++ --target={} -march={} -mtune={} -std={} -D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={}", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string()); + std::string command = std::format("clang++ -stdlib=libc++ --target={} -march={} -mtune={} -std={} -D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={} -I{} -I{}", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string(), buildDir.string(), (exeDir/"cloneCache").string()); #endif #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32) std::string command = std::format("clang-cl.exe /EHsc --target={} -march={} -mtune={} /std:{} /D CRAFTER_BUILD_CONFIGURATION_TARGET_{} -fprebuilt-module-path={} -Wno-unused-command-line-argument", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).string()); @@ -303,7 +303,10 @@ namespace Crafter { command += std::format(" -fprebuilt-module-path={}", pcmDir.string()); + std::string cmakeBuildType; + if(config.debug) { + cmakeBuildType = "Debug"; #ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu command += " -g -D CRAFTER_BUILD_CONFIGURATION_DEBUG"; #endif @@ -311,6 +314,7 @@ namespace Crafter { command += " -g /MDd /D CRAFTER_BUILD_CONFIGURATION_DEBUG"; #endif } else { + cmakeBuildType = "Release"; #ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu command += " -O3"; #endif @@ -353,6 +357,12 @@ namespace Crafter { }); } + for(const CmakeDep& cmake : config.cmakeDeps) { + depThreads.emplace_back([&cmake, &cmakeBuildType, &buildDir](){ + system(std::format("cd {} && cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS=\"-stdlib=libc++\" -DCMAKE_EXE_LINKER_FLAGS=\"-stdlib=libc++\" -DCMAKE_SHARED_LINKER_FLAGS=\"-stdlib=libc++\" -DCMAKE_BUILD_TYPE={} -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY={} -DCMAKE_LIBRARY_OUTPUT_DIRECTORY={} {} && cmake --build build --config {}", cmake.path.string(), cmakeBuildType, buildDir.string(), buildDir.string(), cmake.options, cmakeBuildType).c_str()); + }); + } + for(std::thread& thread : depThreads) { thread.join(); } @@ -428,6 +438,8 @@ namespace Crafter { command += " -L/usr/local/lib"; } + command += std::format(" -L{}", buildDir.string()); + if(config.type != CRAFTER_CONFIGURATION_TYPE_LIBRARY) { #ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu command += libsString; @@ -460,7 +472,7 @@ namespace Crafter { if(config.target == "wasm32-wasi") { outputName += ".wasm"; } - buildResult.errors = RunClang(std::format("{}{} -o {} -fuse-ld=lld", command, files, (binDir/outputName).string())); + buildResult.errors = RunClang(std::format("{}{} -o {} -fuse-ld=lld ", command, files, (binDir/outputName).string())); #endif #if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32) diff --git a/interfaces/Crafter.Build-Configuration.cppm b/interfaces/Crafter.Build-Configuration.cppm index dd5ccde..65f9866 100644 --- a/interfaces/Crafter.Build-Configuration.cppm +++ b/interfaces/Crafter.Build-Configuration.cppm @@ -39,6 +39,11 @@ namespace Crafter { CRAFTER_CONFIGURATION_TYPE_SHARED_LIBRARY, }; + export struct CmakeDep { + fs::path path; + std::string options; + }; + export class Project; export class Configuration { public: @@ -51,6 +56,7 @@ namespace Crafter { std::vector c_files; std::vector cuda; std::vector, Configuration&>> dependencies; + std::vector cmakeDeps; std::vector shaders; std::vector additionalFiles; std::vector defines; diff --git a/interfaces/Crafter.Build-Shader.cppm b/interfaces/Crafter.Build-Shader.cppm index 5a19932..671d1e9 100644 --- a/interfaces/Crafter.Build-Shader.cppm +++ b/interfaces/Crafter.Build-Shader.cppm @@ -18,10 +18,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ module; -#include #include -#include -#include "../lib/DirStackFileIncluder.h" export module Crafter.Build:Shader; import std; namespace fs = std::filesystem; diff --git a/project.json b/project.json index 49ed999..96d777a 100644 --- a/project.json +++ b/project.json @@ -4,12 +4,19 @@ { "name": "base", "interfaces": ["interfaces/Crafter.Build-Command", "interfaces/Crafter.Build-Configuration", "interfaces/Crafter.Build-Module", "interfaces/Crafter.Build-Project", "interfaces/Crafter.Build-Shader", "interfaces/Crafter.Build", "interfaces/Crafter.Build-Implementation", "interfaces/Crafter.Build-Test", "interfaces/Crafter.Build-CompileStatus"], - "implementations": ["implementations/Crafter.Build-Command", "implementations/Crafter.Build-Configuration", "implementations/Crafter.Build-Module", "implementations/Crafter.Build-Project", "implementations/Crafter.Build-Shader", "implementations/Crafter.Build-Implementation", "implementations/Crafter.Build-Test"] + "implementations": ["implementations/Crafter.Build-Command", "implementations/Crafter.Build-Configuration", "implementations/Crafter.Build-Module", "implementations/Crafter.Build-Project", "implementations/Crafter.Build-Shader", "implementations/Crafter.Build-Implementation", "implementations/Crafter.Build-Test"], + "dependencies": [ + { + "path": "https://github.com/KhronosGroup/glslang.git", + "type": "cmake", + "options": "-DENABLE_OPT=OFF" + } + ] }, { "name": "libs-linux-gnu", "target": "x86_64-pc-linux-gnu", - "libs": ["vulkan", "MachineIndependent", "OSDependent", "GenericCodeGen", "glslang", "glslang-default-resource-limits", "SPIRV", "tbb"] + "libs": ["MachineIndependent", "OSDependent", "GenericCodeGen", "glslang", "glslang-default-resource-limits", "SPIRV"] }, { "name": "libs-windows-msvc", @@ -56,14 +63,14 @@ "name": "lib-windows-msvc", "extends": ["base", "libs-windows-msvc"], "type":"library", - "implementations": ["implementations/main"], + "implementations": ["implementations/main"] }, { "name": "lib-windows-msvc-debug", "extends": ["base", "libs-windows-msvc-debug"], "type":"library", "implementations": ["implementations/main"], - "debug": true, + "debug": true } ] } \ No newline at end of file