Skip to content

Commit

Permalink
self-build static llvm
Browse files Browse the repository at this point in the history
  • Loading branch information
arnetheduck committed Aug 25, 2024
1 parent bccfe0f commit 09a1bc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LLVMPATH=../ext

#NIMFLAGS=--opt:speed --gc:markandsweep
#NIMFLAGS=-d:release
NIMFLAGS=--debuginfo --linedir:on
NIMFLAGS=--debuginfo --linedir:on --cc=clang

NLVMFLAGS= --debuginfo --linedir:on
NLVMFLAGS= --debuginfo --linedir:on --cc=clang

LLVM_MAJ:=$(shell cat llvm/llvm.version | cut -f1 -d.)
LLVM_MIN:=$(shell cat llvm/llvm.version | cut -f2 -d.)
Expand Down Expand Up @@ -111,7 +111,13 @@ ext/$(LLVM_DIR)/sha/lib/libLLVM.so.$(LLVM_MAJ).$(LLVM_MIN):
-DCMAKE_BUILD_TYPE=RelWithDebInfo

ext/$(LLVM_DIR)/sta/bin/llvm-config:
sh ./dl-llvm.sh $(LLVM_MAJ) $(LLVM_MIN) $(LLVM_PAT) sta
sh ./make-llvm.sh $(LLVM_MAJ) $(LLVM_MIN) $(LLVM_PAT) sta \
-DLLVM_BUILD_LLVM_DYLIB=0 \
-DLLVM_LINK_LLVM_DYLIB=0 \
-DLLVM_ENABLE_ASSERTIONS=0 \
-DLLVM_INCLUDE_TESTS=Off \
-DLLVM_INCLUDE_BENCHMARKS=Off \
-DCMAKE_BUILD_TYPE=Release

.PHONY: prepare-llvm
prepare-llvm: $(LLVM_DEP)
Expand Down
4 changes: 2 additions & 2 deletions llvm/llvm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ else:
{.passL: fmt"-lLLVM".}
{.passL: "-Wl,'-rpath=$ORIGIN/" & LLVMOut & "lib/'".}

{.passC: "-I" & LLVMOut & "include".}
{.passC: "-I" & LLVMRoot & "include".}
{.passC: "-I" & LLVMOut & "include".}
{.passC: "-I" & LLVMRoot & "include".}

{.passC: "-I" & LLDRoot & "include".}

Expand Down
2 changes: 1 addition & 1 deletion make-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ mkdir -p $TGT
cd $TGT

shift 4
cmake -GNinja -DLLVM_USE_LINKER=gold "$@" ..
cmake -GNinja -DLLVM_USE_LINKER=lld "$@" ..

ninja

0 comments on commit 09a1bc5

Please sign in to comment.