Merge pull request #912 from odin-lang/llvm-api-ci-changes

Update Makefile to compile with LLVM C API
This commit is contained in:
gingerBill
2021-04-25 19:02:24 +01:00
committed by GitHub
6 changed files with 31 additions and 12 deletions

View File

@@ -7,9 +7,11 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Download LLVM
run: sudo apt-get install llvm
run: sudo apt-get install llvm-11 clang-11 llvm
- name: build odin
run: make release
- name: Odin run -llvm-api
run: ./odin run examples/demo/demo.odin -llvm-api
- name: Odin run
run: ./odin run examples/demo/demo.odin
- name: Odin check
@@ -20,14 +22,16 @@ jobs:
- uses: actions/checkout@v1
- name: Download LLVM and setup PATH
run: |
brew install llvm
brew install llvm@11
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
TMP_PATH=$(xcrun --show-sdk-path)/user/include
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
- name: build odin
run: make release
- name: Odin run
run: ./odin run examples/demo/demo.odin
run: |
./odin run examples/demo/demo.odin
./odin run examples/demo/demo.odin -llvm-api
- name: Odin check
run: ./odin check examples/demo/demo.odin -vet
build_windows:

View File

@@ -49,9 +49,11 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: (Linux) Download LLVM
run: sudo apt-get install llvm
run: sudo apt-get install llvm-11 clang-11 llvm
- name: build odin
run: make nightly
- name: Odin run -llvm-api
run: ./odin run examples/demo/demo.odin -llvm-api
- name: Odin run
run: ./odin run examples/demo/demo.odin
- name: Copy artifacts
@@ -78,6 +80,8 @@ jobs:
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
- name: build odin
run: make nightly
- name: Odin run -llvm-api
run: ./odin run examples/demo/demo.odin -llvm-api
- name: Odin run
run: ./odin run examples/demo/demo.odin
- name: Copy artifacts
@@ -100,26 +104,26 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install B2 CLI
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade b2
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Download Windows artifacts
uses: actions/download-artifact@v1
with:
name: windows_artifacts
- name: Download Ubuntu artifacts
uses: actions/download-artifact@v1
with:
name: ubuntu_artifacts
- name: Download macOS artifacts
uses: actions/download-artifact@v1
with:

View File

@@ -1,13 +1,19 @@
GIT_SHA=$(shell git rev-parse --short HEAD)
DISABLED_WARNINGS=-Wno-switch -Wno-pointer-sign -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare -Wno-macro-redefined
LDFLAGS=-pthread -ldl -lm -lstdc++
CFLAGS=-std=c++11 -DGIT_SHA=\"$(GIT_SHA)\"
CFLAGS=-std=c++14 -DGIT_SHA=\"$(GIT_SHA)\"
CC=clang
OS=$(shell uname)
ifeq ($(OS), Darwin)
LDFLAGS:=$(LDFLAGS) -liconv
CFLAGS:=$(CFLAGS) $(shell llvm-config --cxxflags --ldflags) -DLLVM_BACKEND_SUPPORT -DUSE_NEW_LLVM_ABI_SYSTEM
LDFLAGS:=$(LDFLAGS) -lLLVM-C
endif
ifeq ($(OS), Linux)
CFLAGS:=$(CFLAGS) $(shell llvm-config-11 --cxxflags --ldflags) -DLLVM_BACKEND_SUPPORT -DUSE_NEW_LLVM_ABI_SYSTEM
LDFLAGS:=$(LDFLAGS) $(shell llvm-config-11 --libs core native --system-libs)
endif
all: debug demo

View File

@@ -61,7 +61,7 @@ _make_time_from_unix_file_time :: proc(uft: Unix_File_Time) -> time.Time {
_fill_file_info_from_stat :: proc(fi: ^File_Info, s: OS_Stat) {
fi.size = s.size;
fi.mode = cast(File_Mode)s.mode;
fi.is_dir = S_ISDIR(s.mode);
fi.is_dir = S_ISDIR(u32(s.mode));
// NOTE(laleksic, 2021-01-21): Not really creation time, but closest we can get (maybe better to leave it 0?)
fi.creation_time = _make_time_from_unix_file_time(s.status_change);

View File

@@ -1109,6 +1109,11 @@ prefix_table := [?]string{
};
threading_example :: proc() {
if ODIN_OS == "darwin" {
// TODO: Fix threads on darwin/macOS
return;
}
fmt.println("\n# threading_example");
{ // Basic Threads

View File

@@ -2323,7 +2323,7 @@ void lb_debug_complete_types(lbModule *m) {
for (unsigned i = 0; i < element_count; i++) {
u64 offset_in_bits = i;
i64 val = bt->BitSet.lower + cast(i64)i;
gb_snprintf(name, gb_count_of(name), "%lld", val);
gb_snprintf(name, gb_count_of(name), "%lld", cast(long long)val);
elements[i] = LLVMDIBuilderCreateBitFieldMemberType(
m->debug_builder,
scope,