Skip to content

Commit 5b78571

Browse files
committed
fix: bootstrap script fetches mcpplibs.cmdline dependency
mcpp depends on mcpplibs.cmdline for argument parsing. The bootstrap script now downloads and includes it in the module compilation.
1 parent a686a67 commit 5b78571

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

scripts/bootstrap-macos.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,21 @@ OUTDIR="$PROJROOT/target/bootstrap"
6666
PCMDIR="$OUTDIR/pcm.cache"
6767
OBJDIR="$OUTDIR/obj"
6868
BINDIR="$OUTDIR/bin"
69-
mkdir -p "$PCMDIR" "$OBJDIR" "$BINDIR"
69+
DEPSDIR="$OUTDIR/deps"
70+
mkdir -p "$PCMDIR" "$OBJDIR" "$BINDIR" "$DEPSDIR"
71+
72+
# ─── Fetch dependencies ─────────────────────────────────────────────────────
73+
echo ":: Fetching dependencies"
74+
# mcpplibs.cmdline — small cmdline parsing library
75+
CMDLINE_URL="https://github.com/mcpplibs/cmdline/archive/refs/tags/0.0.1.tar.gz"
76+
if [ ! -d "$DEPSDIR/cmdline" ]; then
77+
curl -fsSL "$CMDLINE_URL" | tar -xz -C "$DEPSDIR"
78+
mv "$DEPSDIR/cmdline-0.0.1" "$DEPSDIR/cmdline"
79+
fi
80+
echo " mcpplibs.cmdline at: $DEPSDIR/cmdline/src/"
7081

7182
# Export for Python
72-
export PROJROOT OUTDIR PCMDIR OBJDIR BINDIR CXX LLVM_ROOT STD_CPPM STD_COMPAT_CPPM SDKROOT
83+
export PROJROOT OUTDIR PCMDIR OBJDIR BINDIR DEPSDIR CXX LLVM_ROOT STD_CPPM STD_COMPAT_CPPM SDKROOT
7384

7485
echo
7586
echo ":: Compiling mcpp (42 modules + main.cpp)..."
@@ -86,6 +97,7 @@ outdir = Path(os.environ["OUTDIR"])
8697
pcmdir = Path(os.environ["PCMDIR"])
8798
objdir = Path(os.environ["OBJDIR"])
8899
bindir = Path(os.environ["BINDIR"])
100+
depsdir = Path(os.environ["DEPSDIR"])
89101
cxx = os.environ["CXX"]
90102
sdkroot = os.environ["SDKROOT"]
91103
std_cppm = os.environ["STD_CPPM"]
@@ -132,7 +144,11 @@ re_export = re.compile(r'^\s*export\s+module\s+([\w.]+)\s*;')
132144
re_import = re.compile(r'^\s*(?:export\s+)?import\s+([\w.]+)\s*;')
133145
re_module = re.compile(r'^\s*module\s+([\w.]+)\s*;') # module implementation unit
134146
147+
# Include both project sources and dependency sources
135148
sources = sorted(projroot.glob("src/**/*.cppm")) + sorted(projroot.glob("src/**/*.cpp"))
149+
# Add dependency modules (mcpplibs.cmdline)
150+
dep_sources = sorted(depsdir.glob("cmdline/src/*.cppm"))
151+
sources = dep_sources + sources # deps first so they're available
136152
137153
# Map: module_name -> source_path
138154
mod_source = {}

0 commit comments

Comments
 (0)