Compare commits

..

12 Commits

Author SHA1 Message Date
William Bell
fb8b6a89ae build for more architectures 2025-08-16 03:41:32 +01:00
William Bell
6ddf9953e7 change windows builds to tar.gz 2025-08-16 03:23:01 +01:00
William Bell
1609227a42 add bcrypt for windows 2025-08-16 03:10:50 +01:00
William Bell
51f6a88ce8 add profile to build 2025-08-16 03:00:01 +01:00
William Bell
f420273471 fix backslashes 2025-08-16 02:46:33 +01:00
William Bell
4b2a747338 use msys/flex 2025-08-16 02:36:47 +01:00
William Bell
5277814af0 fix conan 2025-08-16 02:31:15 +01:00
William Bell
8928ab2d99 add cmake as dependency 2025-08-16 02:20:57 +01:00
William Bell
d08b307c6e add python as a dependency 2025-08-16 02:12:55 +01:00
William Bell
6474329afc switch to conan for windows 2025-08-16 02:08:56 +01:00
William Bell
c49e67c839 switch windows to use conan 2025-08-16 02:04:00 +01:00
William Bell
25cb96e473 try get it to be static 2025-08-16 01:57:56 +01:00
5 changed files with 107 additions and 36 deletions

View File

@@ -12,13 +12,21 @@ on:
jobs: jobs:
build-linux: build-linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
- name: Install build tools - name: Install build tools
run: sudo apt-get update && sudo apt-get install -y flex bison run: |
sudo apt-get update
sudo apt-get install -y flex bison make cmake build-essential
if [ "${{ matrix.arch }}" = "arm64" ]; then
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
fi
- name: Setup Python - name: Setup Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
@@ -33,17 +41,28 @@ jobs:
- name: Build - name: Build
run: | run: |
conan install . --build=missing BUILD_DIR="build_${{ matrix.arch }}"
conan build . mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
fi
conan install .. --build=missing
conan build ..
cd ..
- name: Package - name: Package
run: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]') OS="linux"
ARCH=$(uname -m) ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH" FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz" TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER" mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER" cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER" tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -51,11 +70,14 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: linux-artifact name: linux-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
build-macos: build-macos:
runs-on: macos-latest runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64] # build both architectures
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
@@ -77,17 +99,29 @@ jobs:
- name: Build - name: Build
run: | run: |
conan install . --build=missing # Create a build directory per arch
conan build . BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Use the matrix architecture for the build
export CFLAGS="-arch ${{ matrix.arch }}"
export CXXFLAGS="-arch ${{ matrix.arch }}"
export LDFLAGS="-arch ${{ matrix.arch }}"
conan install .. --build=missing
conan build ..
cd ..
- name: Package - name: Package
run: | run: |
TAG=${GITHUB_REF##refs/tags/} TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]') OS="macos"
ARCH=$(uname -m) ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH" FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz" TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER" mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER" cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER" tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -95,11 +129,14 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: macos-artifact name: macos-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
strategy:
matrix:
arch: [x86_64, arm64]
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
@@ -109,7 +146,8 @@ jobs:
with: with:
submodules: recursive submodules: recursive
- uses: msys2/setup-msys2@v2 - name: Setup MSYS2
uses: msys2/setup-msys2@v2
with: with:
msystem: MINGW64 msystem: MINGW64
update: true update: true
@@ -117,29 +155,50 @@ jobs:
base-devel base-devel
mingw-w64-x86_64-gcc mingw-w64-x86_64-gcc
mingw-w64-x86_64-make mingw-w64-x86_64-make
mingw-w64-x86_64-gmp mingw-w64-x86_64-cmake
mingw-w64-x86_64-gc mingw-w64-x86_64-python
mingw-w64-x86_64-python-pip
msys/flex
- name: Install Conan
run: |
python -m pip install --upgrade pip
pip install conan
conan profile detect
- name: Build Project - name: Build Project
run: | run: |
make windows BUILD_DIR="build_${{ matrix.arch }}"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
if [ "${{ matrix.arch }}" = "arm64" ]; then
# Use the ARM64 cross-compiler
export CC=aarch64-w64-mingw32-gcc
export CXX=aarch64-w64-mingw32-g++
fi
conan install .. --profile mingw-profile.txt --build=missing
conan build .. --profile mingw-profile.txt
cd ..
- name: Package - name: Package
run: | run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', '' TAG=${GITHUB_REF##refs/tags/}
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' } OS="windows"
$FOLDER = "chloride-$TAG-windows-$ARCH" ARCH="${{ matrix.arch }}"
$ZIP = "$FOLDER.zip" FOLDER="chloride-$TAG-$OS-$ARCH"
Rename-Item bin $FOLDER ZIP="$FOLDER.zip"
Copy-Item LICENSE.txt $FOLDER mv build_${ARCH}/bin "$FOLDER"
Compress-Archive -Path $FOLDER -DestinationPath $ZIP cp LICENSE.txt "$FOLDER"
echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV powershell Compress-Archive -Path "$FOLDER" -DestinationPath "$ZIP"
shell: pwsh echo "TAR_NAME=$ZIP" >> $GITHUB_ENV
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: windows-artifact name: windows-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }} path: ${{ env.TAR_NAME }}
release: release:

View File

@@ -57,6 +57,7 @@ target_link_libraries(argon PRIVATE
BDWgc::BDWgc BDWgc::BDWgc
gmp::gmp gmp::gmp
m m
$<$<PLATFORM_ID:Windows>:bcrypt>
) )
target_include_directories(argon PRIVATE target_include_directories(argon PRIVATE

View File

@@ -12,7 +12,11 @@ LEXER_SRC = src/lexer/lex.l
LEXER_C = src/lexer/lex.yy.c LEXER_C = src/lexer/lex.yy.c
LEXER_H = src/lexer/lex.yy.h LEXER_H = src/lexer/lex.yy.h
CFLAGS = $(ARCHFLAGS) -lm -lgc -lgmp -Wall -Wextra -Wno-unused-function -Werror=unused-result -Iexternal/cwalk/include -Iexternal/libdye/include CFLAGS = $(ARCHFLAGS) -lm -lgc -lgmp -Wall -Wextra -Wno-unused-function -Werror=unused-result -Iexternal/cwalk/include -Iexternal/libdye/include
LDFLAGS = -Wl,-Bstatic -lgc -lgmp -Wl,-Bdynamic -lm LDFLAGS = -lgc -lgmp -lm
ifeq ($(MAKECMDGOALS),windows)
LDFLAGS = -Wl,-Bstatic -lgc -lgmp -Wl,-Bdynamic -lm
endif
all: $(BINARY) all: $(BINARY)

View File

@@ -33,14 +33,9 @@ class ArgonConan(ConanFile):
os.environ["CONAN_NON_INTERACTIVE"] = "1" os.environ["CONAN_NON_INTERACTIVE"] = "1"
tc = CMakeToolchain(self) tc = CMakeToolchain(self)
if os.name == "nt": # Windows flex_path = which("flex")
flex_path = which("win_flex") or which("win_flex.exe") if not flex_path:
if not flex_path: raise Exception("Flex not found in system PATH. Please install flex on Linux/macOS.")
raise Exception("win_flex not found in PATH. Install winflexbison via choco.")
else:
flex_path = which("flex")
if not flex_path:
raise Exception("Flex not found in system PATH. Please install flex on Linux/macOS.")
tc.variables["FLEX_EXECUTABLE"] = flex_path.replace("\\", "\\\\") tc.variables["FLEX_EXECUTABLE"] = flex_path.replace("\\", "\\\\")
tc.generate() tc.generate()

12
mingw-profile.txt Normal file
View File

@@ -0,0 +1,12 @@
[settings]
os=Windows
compiler=gcc
compiler.version=12
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.exception=seh
arch=x86_64
build_type=Release
[tool_requires]
mingw-builds/12.2.0