2
.github/actions/setup-deps/action.yml
vendored
2
.github/actions/setup-deps/action.yml
vendored
@@ -34,7 +34,7 @@ runs:
|
||||
echo "deb http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${{inputs.llvm-version}} main" | sudo tee /etc/apt/sources.list.d/llvm.list
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y llvm-${{inputs.llvm-version}}-dev clang-${{inputs.llvm-version}} libclang-${{inputs.llvm-version}}-dev lld-${{inputs.llvm-version}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libunwind-dev libuv1-dev
|
||||
sudo apt-get install -y llvm-${{inputs.llvm-version}}-dev clang-${{inputs.llvm-version}} libclang-${{inputs.llvm-version}}-dev lld-${{inputs.llvm-version}} pkg-config libgc-dev libssl-dev zlib1g-dev libffi-dev libcjson-dev libunwind-${{inputs.llvm-version}}-dev libuv1-dev libc++-${{inputs.llvm-version}}-dev
|
||||
echo "PATH=/usr/lib/llvm-${{inputs.llvm-version}}/bin:$PATH" >> $GITHUB_ENV
|
||||
|
||||
# Install optional deps for demos.
|
||||
|
||||
10
.github/workflows/llgo.yml
vendored
10
.github/workflows/llgo.yml
vendored
@@ -70,11 +70,6 @@ jobs:
|
||||
with:
|
||||
go-version: ${{matrix.go}}
|
||||
|
||||
- name: _xtool build tests
|
||||
run: |
|
||||
cd _xtool
|
||||
llgo build -v ./...
|
||||
|
||||
- name: Test demos
|
||||
run: |
|
||||
# TODO(lijie): force python3-embed to be linked with python-3.12-embed
|
||||
@@ -88,6 +83,11 @@ jobs:
|
||||
export PKG_CONFIG_PATH=$pcdir
|
||||
bash .github/workflows/test_demo.sh
|
||||
|
||||
- name: _xtool build tests
|
||||
run: |
|
||||
cd _xtool
|
||||
llgo build -v ./...
|
||||
|
||||
- name: Show test result
|
||||
run: cat result.md
|
||||
|
||||
|
||||
12
_demo/cppstr/cppstr.go
Normal file
12
_demo/cppstr/cppstr.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/lib/c"
|
||||
"github.com/goplus/lib/cpp/std"
|
||||
)
|
||||
|
||||
func main() {
|
||||
s := std.Str("Hello world\n")
|
||||
c.Printf(s.CStr())
|
||||
print(s.Str(), s.Size(), "\n")
|
||||
}
|
||||
@@ -953,6 +953,13 @@ func clFiles(ctx *context, files string, pkg *packages.Package, procFile func(li
|
||||
|
||||
func clFile(ctx *context, args []string, cFile, expFile string, procFile func(linkFile string), verbose bool) {
|
||||
llFile := expFile + filepath.Base(cFile) + ".ll"
|
||||
ext := filepath.Ext(cFile)
|
||||
|
||||
// default clang++ will use c++ to compile c file,will cause symbol be mangled
|
||||
if ext == ".c" {
|
||||
args = append(args, "-x", "c")
|
||||
}
|
||||
|
||||
args = append(args, "-emit-llvm", "-S", "-o", llFile, "-c", cFile)
|
||||
args = append(args, ctx.crossCompile.CCFLAGS...)
|
||||
args = append(args, ctx.crossCompile.CFLAGS...)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
LLGoFiles = "_wrap/debug.c"
|
||||
LLGoFiles = "$(llvm-config --cflags): _wrap/debug.c"
|
||||
)
|
||||
|
||||
type Info struct {
|
||||
|
||||
2
xtool/env/llvm/llvm.go
vendored
2
xtool/env/llvm/llvm.go
vendored
@@ -72,7 +72,7 @@ func (e *Env) BinDir() string { return e.binDir }
|
||||
|
||||
// Clang returns a new [clang.Cmd] instance.
|
||||
func (e *Env) Clang() *clang.Cmd {
|
||||
bin := filepath.Join(e.BinDir(), "clang")
|
||||
bin := filepath.Join(e.BinDir(), "clang++")
|
||||
return clang.New(bin)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user