feat: add win32 platform
This commit is contained in:
parent
ffa06e2a83
commit
080a428b9c
19
.github/workflows/auto-build-electron.yml
vendored
19
.github/workflows/auto-build-electron.yml
vendored
@ -24,9 +24,9 @@ jobs:
|
||||
- os: windows-latest
|
||||
arch: amd64
|
||||
build: buildWindows
|
||||
# - os: windows-latest
|
||||
# arch: 386
|
||||
# build: buildWindows386
|
||||
- os: windows-latest
|
||||
arch: 386
|
||||
build: buildWindows
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@ -48,10 +48,23 @@ jobs:
|
||||
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
echo "CXX=aarch64-linux-gnu-g++" >> $GITHUB_ENV
|
||||
|
||||
- name: Install MinGW-w64 using Chocolatey
|
||||
if: runner.os == 'Windows' && matrix.arch == '386'
|
||||
run: |
|
||||
curl -L -o mingw32.7z https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z/download
|
||||
7z x mingw32.7z -oC:/mingw32
|
||||
|
||||
- name: Setup and build on Windows ${{ matrix.arch }}
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
./bootstrap_install_mage.bat
|
||||
$env:GOARCH="${{ matrix.arch }}"
|
||||
if ($env:GOARCH -eq "386") {
|
||||
$env:PATH = "C:/mingw32/bin;$env:PATH"
|
||||
gcc --version
|
||||
$env:CC="gcc -m32"
|
||||
$env:CXX="g++ -m32"
|
||||
}
|
||||
mage ${{ matrix.build }}
|
||||
|
||||
- name: Setup and build on ${{ matrix.os }} ${{ matrix.arch }}
|
||||
|
19
magefile.go
19
magefile.go
@ -127,11 +127,26 @@ func BuildWindows() error {
|
||||
fmt.Println("Building for Windows...")
|
||||
|
||||
outPath += "windows"
|
||||
arch := os.Getenv("GOARCH")
|
||||
cc := os.Getenv("CC")
|
||||
cxx := os.Getenv("CXX")
|
||||
|
||||
if len(arch) == 0 {
|
||||
arch = runtime.GOARCH
|
||||
}
|
||||
|
||||
if len(cc) == 0 {
|
||||
cc = "gcc"
|
||||
}
|
||||
|
||||
if len(cxx) != 0 {
|
||||
os.Setenv("CXX", cxx)
|
||||
}
|
||||
|
||||
os.Setenv("GOOS", "windows")
|
||||
os.Setenv("GOARCH", "amd64")
|
||||
os.Setenv("GOARCH", arch)
|
||||
os.Setenv("CGO_ENABLED", "1")
|
||||
os.Setenv("CC", "gcc")
|
||||
os.Setenv("CC", cc)
|
||||
|
||||
cmd := exec.Command("go", "build", "-buildmode=c-shared", "-trimpath", "-ldflags=-s -w", "-o", outPath+"/"+soName+".dll", ".")
|
||||
cmd.Dir = goSrc
|
||||
|
Loading…
x
Reference in New Issue
Block a user