Skip to content

Commit

Permalink
Merge #3367
Browse files Browse the repository at this point in the history
3367: Change LLVM detection in Makefile r=ptitSeb a=ptitSeb

# Description
Change how the Makefile detect llvm version to allows detection of LLVM 13 even if LLVM 14 is installed.

Co-authored-by: ptitSeb <[email protected]>
  • Loading branch information
bors[bot] and ptitSeb authored Nov 24, 2022
2 parents c3ef0b7 + 2d3a325 commit d1ebffa
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,33 +117,31 @@ endif
##

# If the user didn't disable the LLVM compiler…
ifneq ($(ENABLE_LLVM), 0)
ifeq ($(ENABLE_LLVM), 0)
LLVM_VERSION :=
# … then maybe the user forced to enable the LLVM compiler.
ifeq ($(ENABLE_LLVM), 1)
LLVM_VERSION := $(shell llvm-config --version)
compilers += llvm
# … otherwise, we try to autodetect LLVM from `llvm-config`
else ifneq (, $(shell which llvm-config 2>/dev/null))
LLVM_VERSION := $(shell llvm-config --version)

# If findstring is not empty, then it have found the value
ifneq (, $(findstring 13,$(LLVM_VERSION)))
compilers += llvm
else ifneq (, $(findstring 12,$(LLVM_VERSION)))
compilers += llvm
endif
else ifeq ($(ENABLE_LLVM), 1)
LLVM_VERSION := $(shell llvm-config --version)
compilers += llvm
# … or try to autodetect LLVM from `llvm-config-<version>`.
else
ifneq (, $(shell which llvm-config-13 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-13 --version)
compilers += llvm
else ifneq (, $(shell which llvm-config-12 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-12 --version)
compilers += llvm
endif
else ifneq (, $(shell which llvm-config-13 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-13 --version)
compilers += llvm
else ifneq (, $(shell which llvm-config-12 2>/dev/null))
LLVM_VERSION := $(shell llvm-config-12 --version)
compilers += llvm
# … otherwise, we try to autodetect LLVM from `llvm-config`
else ifneq (, $(shell which llvm-config 2>/dev/null))
LLVM_VERSION := $(shell llvm-config --version)
ifneq (, $(findstring 13,$(LLVM_VERSION)))
compilers += llvm
else ifneq (, $(findstring 12,$(LLVM_VERSION)))
compilers += llvm
endif
endif

# If findstring is not empty, then it have found the value

exclude_tests := --exclude wasmer-c-api --exclude wasmer-cli --exclude wasmer-compiler-cli
# Is failing to compile in Linux for some reason
exclude_tests += --exclude wasmer-wasi-experimental-io-devices
Expand Down

0 comments on commit d1ebffa

Please sign in to comment.