mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Merge pull request #912 from odin-lang/llvm-api-ci-changes
Update Makefile to compile with LLVM C API
This commit is contained in:
@@ -7,9 +7,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Download LLVM
|
- name: Download LLVM
|
||||||
run: sudo apt-get install llvm
|
run: sudo apt-get install llvm-11 clang-11 llvm
|
||||||
- name: build odin
|
- name: build odin
|
||||||
run: make release
|
run: make release
|
||||||
|
- name: Odin run -llvm-api
|
||||||
|
run: ./odin run examples/demo/demo.odin -llvm-api
|
||||||
- name: Odin run
|
- name: Odin run
|
||||||
run: ./odin run examples/demo/demo.odin
|
run: ./odin run examples/demo/demo.odin
|
||||||
- name: Odin check
|
- name: Odin check
|
||||||
@@ -20,14 +22,16 @@ jobs:
|
|||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Download LLVM and setup PATH
|
- name: Download LLVM and setup PATH
|
||||||
run: |
|
run: |
|
||||||
brew install llvm
|
brew install llvm@11
|
||||||
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
|
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
|
||||||
TMP_PATH=$(xcrun --show-sdk-path)/user/include
|
TMP_PATH=$(xcrun --show-sdk-path)/user/include
|
||||||
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
||||||
- name: build odin
|
- name: build odin
|
||||||
run: make release
|
run: make release
|
||||||
- name: Odin run
|
- 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
|
- name: Odin check
|
||||||
run: ./odin check examples/demo/demo.odin -vet
|
run: ./odin check examples/demo/demo.odin -vet
|
||||||
build_windows:
|
build_windows:
|
||||||
|
|||||||
@@ -49,9 +49,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: (Linux) Download LLVM
|
- name: (Linux) Download LLVM
|
||||||
run: sudo apt-get install llvm
|
run: sudo apt-get install llvm-11 clang-11 llvm
|
||||||
- name: build odin
|
- name: build odin
|
||||||
run: make nightly
|
run: make nightly
|
||||||
|
- name: Odin run -llvm-api
|
||||||
|
run: ./odin run examples/demo/demo.odin -llvm-api
|
||||||
- name: Odin run
|
- name: Odin run
|
||||||
run: ./odin run examples/demo/demo.odin
|
run: ./odin run examples/demo/demo.odin
|
||||||
- name: Copy artifacts
|
- name: Copy artifacts
|
||||||
@@ -78,6 +80,8 @@ jobs:
|
|||||||
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
echo "CPATH=$TMP_PATH" >> $GITHUB_ENV
|
||||||
- name: build odin
|
- name: build odin
|
||||||
run: make nightly
|
run: make nightly
|
||||||
|
- name: Odin run -llvm-api
|
||||||
|
run: ./odin run examples/demo/demo.odin -llvm-api
|
||||||
- name: Odin run
|
- name: Odin run
|
||||||
run: ./odin run examples/demo/demo.odin
|
run: ./odin run examples/demo/demo.odin
|
||||||
- name: Copy artifacts
|
- name: Copy artifacts
|
||||||
@@ -100,26 +104,26 @@ jobs:
|
|||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Install B2 CLI
|
- name: Install B2 CLI
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install --upgrade b2
|
pip install --upgrade b2
|
||||||
|
|
||||||
- name: Display Python version
|
- name: Display Python version
|
||||||
run: python -c "import sys; print(sys.version)"
|
run: python -c "import sys; print(sys.version)"
|
||||||
|
|
||||||
- name: Download Windows artifacts
|
- name: Download Windows artifacts
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: windows_artifacts
|
name: windows_artifacts
|
||||||
|
|
||||||
- name: Download Ubuntu artifacts
|
- name: Download Ubuntu artifacts
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: ubuntu_artifacts
|
name: ubuntu_artifacts
|
||||||
|
|
||||||
- name: Download macOS artifacts
|
- name: Download macOS artifacts
|
||||||
uses: actions/download-artifact@v1
|
uses: actions/download-artifact@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -1,13 +1,19 @@
|
|||||||
GIT_SHA=$(shell git rev-parse --short HEAD)
|
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
|
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++
|
LDFLAGS=-pthread -ldl -lm -lstdc++
|
||||||
CFLAGS=-std=c++11 -DGIT_SHA=\"$(GIT_SHA)\"
|
CFLAGS=-std=c++14 -DGIT_SHA=\"$(GIT_SHA)\"
|
||||||
CC=clang
|
CC=clang
|
||||||
|
|
||||||
OS=$(shell uname)
|
OS=$(shell uname)
|
||||||
|
|
||||||
ifeq ($(OS), Darwin)
|
ifeq ($(OS), Darwin)
|
||||||
LDFLAGS:=$(LDFLAGS) -liconv
|
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
|
endif
|
||||||
|
|
||||||
all: debug demo
|
all: debug demo
|
||||||
|
|||||||
@@ -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) {
|
_fill_file_info_from_stat :: proc(fi: ^File_Info, s: OS_Stat) {
|
||||||
fi.size = s.size;
|
fi.size = s.size;
|
||||||
fi.mode = cast(File_Mode)s.mode;
|
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?)
|
// 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);
|
fi.creation_time = _make_time_from_unix_file_time(s.status_change);
|
||||||
|
|||||||
@@ -1109,6 +1109,11 @@ prefix_table := [?]string{
|
|||||||
};
|
};
|
||||||
|
|
||||||
threading_example :: proc() {
|
threading_example :: proc() {
|
||||||
|
if ODIN_OS == "darwin" {
|
||||||
|
// TODO: Fix threads on darwin/macOS
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fmt.println("\n# threading_example");
|
fmt.println("\n# threading_example");
|
||||||
|
|
||||||
{ // Basic Threads
|
{ // Basic Threads
|
||||||
|
|||||||
@@ -2323,7 +2323,7 @@ void lb_debug_complete_types(lbModule *m) {
|
|||||||
for (unsigned i = 0; i < element_count; i++) {
|
for (unsigned i = 0; i < element_count; i++) {
|
||||||
u64 offset_in_bits = i;
|
u64 offset_in_bits = i;
|
||||||
i64 val = bt->BitSet.lower + cast(i64)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(
|
elements[i] = LLVMDIBuilderCreateBitFieldMemberType(
|
||||||
m->debug_builder,
|
m->debug_builder,
|
||||||
scope,
|
scope,
|
||||||
|
|||||||
Reference in New Issue
Block a user