parent
918ce748a4
commit
9bd12660eb
8 changed files with 94 additions and 60 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue