Skip to content

Commit

Permalink
feat: use cppfront v0.8.0 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaucy authored Nov 24, 2024
1 parent cb5b5ad commit 2b0c007
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 19 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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"

Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions src/main.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ expect: <T>(move opt: std::optional<T>, 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())$ .");
}
}

Expand Down Expand Up @@ -762,7 +762,7 @@ do_build: (targets: std::vector<std::string>) -> (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());
Expand Down

0 comments on commit 2b0c007

Please sign in to comment.