Compare commits

...

11 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
4 changed files with 102 additions and 37 deletions

View File

@@ -12,13 +12,21 @@ on:
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [x86_64, arm64]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- 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
uses: actions/setup-python@v4
@@ -33,17 +41,28 @@ jobs:
- name: Build
run: |
conan install . --build=missing
conan build .
BUILD_DIR="build_${{ matrix.arch }}"
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
run: |
TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
OS="linux"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -51,11 +70,14 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-artifact
name: linux-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
build-macos:
runs-on: macos-latest
strategy:
matrix:
arch: [x86_64, arm64] # build both architectures
steps:
- uses: actions/checkout@v3
with:
@@ -77,17 +99,29 @@ jobs:
- name: Build
run: |
conan install . --build=missing
conan build .
# Create a build directory per arch
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
run: |
TAG=${GITHUB_REF##refs/tags/}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
OS="macos"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
TAR="$FOLDER.tar.gz"
mv build/bin "$FOLDER"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
tar -czf "$TAR" "$FOLDER"
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
@@ -95,11 +129,14 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-artifact
name: macos-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
build-windows:
runs-on: windows-latest
strategy:
matrix:
arch: [x86_64, arm64]
defaults:
run:
shell: msys2 {0}
@@ -109,7 +146,8 @@ jobs:
with:
submodules: recursive
- uses: msys2/setup-msys2@v2
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
@@ -117,31 +155,50 @@ jobs:
base-devel
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-gmp
mingw-w64-x86_64-gc
mingw-w64-x86_64-gmp-static
mingw-w64-x86_64-gc-static
mingw-w64-x86_64-cmake
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
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
run: |
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
$FOLDER = "chloride-$TAG-windows-$ARCH"
$ZIP = "$FOLDER.zip"
Rename-Item bin $FOLDER
Copy-Item LICENSE.txt $FOLDER
Compress-Archive -Path $FOLDER -DestinationPath $ZIP
echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV
shell: pwsh
TAG=${GITHUB_REF##refs/tags/}
OS="windows"
ARCH="${{ matrix.arch }}"
FOLDER="chloride-$TAG-$OS-$ARCH"
ZIP="$FOLDER.zip"
mv build_${ARCH}/bin "$FOLDER"
cp LICENSE.txt "$FOLDER"
powershell Compress-Archive -Path "$FOLDER" -DestinationPath "$ZIP"
echo "TAR_NAME=$ZIP" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: windows-artifact
name: windows-${{ matrix.arch }}-artifact
path: ${{ env.TAR_NAME }}
release:

View File

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

View File

@@ -33,14 +33,9 @@ class ArgonConan(ConanFile):
os.environ["CONAN_NON_INTERACTIVE"] = "1"
tc = CMakeToolchain(self)
if os.name == "nt": # Windows
flex_path = which("win_flex") or which("win_flex.exe")
if not flex_path:
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.")
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.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