diff --git a/build.cmd b/build.cmd index 3485a92..d086bb4 100644 --- a/build.cmd +++ b/build.cmd @@ -35,7 +35,7 @@ set vs_tools_dir=%vs_install_dir%\VC\Tools\MSVC\%vs_tools_version% if exist .cache\repos\cppfront\ ( @rem TODO - report which cppfront version is being used ) else ( - git clone https://github.com/hsutter/cppfront.git .cache/repos/cppfront --quiet + git clone --quiet --branch=v0.8.0 --depth=1 https://github.com/hsutter/cppfront.git .cache/repos/cppfront ) call "%vs_install_dir%\Common7\Tools\vsdevcmd.bat" /no_logo diff --git a/build.sh b/build.sh index 0b2efd9..aca435b 100755 --- a/build.sh +++ b/build.sh @@ -62,10 +62,11 @@ log_info "using compiler '$CPP2B_COMPILER' version '$COMPILER_VERSION'" function ensure_gh_repo() { local repo=$1 + local branch=$2 local repo_path=$ROOT_DIR/.cache/repos/$repo if ! [ -d $repo_path ]; then mkdir -p $repo_path - git clone --quiet --depth=1 --filter=blob:none --sparse https://github.com/$repo $repo_path + git clone --quiet --depth=1 --branch=$branch --filter=blob:none --sparse https://github.com/$repo $repo_path fi } @@ -82,7 +83,7 @@ function ensure_gh_repo_subdir() { fi } -ensure_gh_repo "hsutter/cppfront" +ensure_gh_repo "hsutter/cppfront" "v0.8.0" ensure_gh_repo_subdir "hsutter/cppfront" "source" ensure_gh_repo_subdir "hsutter/cppfront" "include" @@ -93,7 +94,22 @@ LLVM_ROOT=/usr/lib/llvm-$COMPILER_MAJOR_VERSION if ! [ -x $CPPFRONT ]; then log_info "compiling cppfront..." cd $ROOT_DIR/.cache/repos/hsutter/cppfront/source - $CPP2B_COMPILER -lstdc++ -lc -lm -fuse-ld=lld -std=c++23 cppfront.cpp -o $CPPFRONT + $CPP2B_COMPILER \ + -std=c++23 \ + -stdlib=libc++ \ + -fexperimental-library \ + -Wno-unused-result \ + -Wno-deprecated-declarations \ + -fprebuilt-module-path=$MODULES_DIR \ + -L$LLVM_ROOT/lib \ + -isystem $LLVM_ROOT/include/c++/v1 \ + -lc++abi \ + -lc++ \ + -lm \ + -static \ + -fuse-ld=lld \ + -I"$CPPFRONT_INCLUDE_DIR" \ + cppfront.cpp -o $CPPFRONT cd $ROOT_DIR fi diff --git a/src/main.cpp2 b/src/main.cpp2 index 409770d..e88e94e 100644 --- a/src/main.cpp2 +++ b/src/main.cpp2 @@ -65,12 +65,12 @@ expect: (move opt: std::optional, message) -> T = { GitHubRepo: type = { private repo_: fs::path; - operator=: (out this, repo) = { + operator=: (out this, repo, branch) = { repo_ = repo; if !fs::exists(path() / ".git") { ensure_dir(path()); - git_("clone --depth=1 --filter=blob:none --sparse https://github.com/(repo_.generic_string())$ ."); + git_("clone --depth=1 --branch=(branch)$ --filter=blob:none --sparse https://github.com/(repo_.generic_string())$ ."); } } @@ -762,7 +762,7 @@ do_build: (targets: std::vector) -> (stuff: full_build_info, exit_c build_cpp2_dir := fs::current_path(); stuff = (); - (repo := GitHubRepo("hsutter/cppfront")) { + (repo := GitHubRepo("hsutter/cppfront", "v0.8.0")) { repo.add("source"); repo.add("include"); exit_code = ensure_cppfront(repo.path());