This commit is contained in:
parent
e8edd610f5
commit
1311ece26f
2 changed files with 15 additions and 7 deletions
|
|
@ -60,13 +60,7 @@ namespace Crafter {
|
||||||
if(config.contains("standard")) {
|
if(config.contains("standard")) {
|
||||||
standard = config["standard"].get<std::string>();
|
standard = config["standard"].get<std::string>();
|
||||||
} else {
|
} else {
|
||||||
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
|
||||||
standard = "c++26";
|
standard = "c++26";
|
||||||
#endif
|
|
||||||
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
|
|
||||||
standard = "c++latest";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if(config.contains("target")) {
|
if(config.contains("target")) {
|
||||||
target = config["target"].get<std::string>();
|
target = config["target"].get<std::string>();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,13 @@ namespace Crafter {
|
||||||
std::string editedTarget = config.target;
|
std::string editedTarget = config.target;
|
||||||
std::replace(editedTarget.begin(), editedTarget.end(), '-', '_');
|
std::replace(editedTarget.begin(), editedTarget.end(), '-', '_');
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
||||||
std::string command = std::format("clang++ -stdlib=libc++ --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={}", config.target, config.march, config.march, config.standard, editedTarget, (exeDir/config.target).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++ -nostdinc++ -nostdlib++ -isystem %LIBCXX_DIR%\\include\\c++\\v1 --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());
|
||||||
|
#endif
|
||||||
|
|
||||||
for (const auto& entry : fs::recursive_directory_iterator(buildDir)) {
|
for (const auto& entry : fs::recursive_directory_iterator(buildDir)) {
|
||||||
if (entry.is_directory() && entry.path().filename() == "include") {
|
if (entry.is_directory() && entry.path().filename() == "include") {
|
||||||
|
|
@ -450,14 +456,22 @@ namespace Crafter {
|
||||||
if(config.target == "wasm32-wasi") {
|
if(config.target == "wasm32-wasi") {
|
||||||
outputName += ".wasm";
|
outputName += ".wasm";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
||||||
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)
|
||||||
|
system("copy %LIBCXX_DIR%\\lib\\c++.dll \bin\executable-windows-msvc\\c++.dll");
|
||||||
|
uildResult.errors = RunClang(std::format("{}{} -o {} -fuse-ld=lld -L %LIBCXX_DIR%\\lib -lc++ %useLibcCommon% -nostdinc++ -nostdlib++", command, files, (binDir/outputName).string()));
|
||||||
|
#endif
|
||||||
} else if(config.type == CRAFTER_CONFIGURATION_TYPE_LIBRARY) {
|
} else if(config.type == CRAFTER_CONFIGURATION_TYPE_LIBRARY) {
|
||||||
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
#ifdef CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_linux_gnu
|
||||||
RunClang(std::format("ar r {}.a {}", (binDir/fs::path(std::string("lib")+outputName)).string(), files));
|
RunClang(std::format("ar r {}.a {}", (binDir/fs::path(std::string("lib")+outputName)).string(), files));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
|
#if defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_pc_windows_msvc) || defined(CRAFTER_BUILD_CONFIGURATION_TARGET_x86_64_w64_mingw32)
|
||||||
system("copy %LIBCXX_DIR%\\lib\\c++.dll \bin\executable-windows-msvc\\c++.dll");
|
|
||||||
RunClang(std::format("clang-lib.exe {} /OUT:{}.lib", files, (binDir/fs::path(outputName)).string()));
|
RunClang(std::format("clang-lib.exe {} /OUT:{}.lib", files, (binDir/fs::path(outputName)).string()));
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue