Compare commits
58 Commits
prerelease
...
prerelease
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b905026010 | ||
|
|
677afd9433 | ||
|
|
757da3f973 | ||
|
|
5a86510c3b | ||
|
|
fb8b6a89ae | ||
|
|
6ddf9953e7 | ||
|
|
1609227a42 | ||
|
|
51f6a88ce8 | ||
|
|
f420273471 | ||
|
|
4b2a747338 | ||
|
|
5277814af0 | ||
|
|
8928ab2d99 | ||
|
|
d08b307c6e | ||
|
|
6474329afc | ||
|
|
c49e67c839 | ||
|
|
25cb96e473 | ||
|
|
f11890a8b3 | ||
|
|
59b1d222c2 | ||
|
|
2fba132016 | ||
|
|
bddc2cdc79 | ||
|
|
e1b80b42d9 | ||
|
|
dab86925b4 | ||
|
|
0f45052dce | ||
|
|
68f4207216 | ||
|
|
f9f8ca08c6 | ||
|
|
0666b02c13 | ||
|
|
1654507835 | ||
|
|
d054ece8e2 | ||
|
|
4937942d6e | ||
|
|
82ea92183f | ||
|
|
5fb15b476f | ||
|
|
d1a455dbbe | ||
|
|
a81640747d | ||
|
|
4a1ed23f96 | ||
|
|
eb36d02fcb | ||
|
|
7b3a1e1835 | ||
|
|
8e53579682 | ||
|
|
0d8f262185 | ||
|
|
fc6f41d89b | ||
|
|
6a7ce72eb7 | ||
|
|
f84e5429a5 | ||
|
|
f4c7294267 | ||
|
|
be4b04a286 | ||
|
|
9d11122e93 | ||
|
|
241e447da0 | ||
|
|
dd750ab164 | ||
|
|
922b129250 | ||
|
|
c2df9c0e83 | ||
|
|
923503493e | ||
|
|
686cb08f11 | ||
|
|
1cfb4acda6 | ||
|
|
436f30330b | ||
|
|
5381967ed6 | ||
|
|
6f84a4a485 | ||
|
|
4b4b1fa777 | ||
|
|
2b6e785638 | ||
|
|
51e82e5b2e | ||
|
|
2c56810cc4 |
213
.github/workflows/release.yml
vendored
213
.github/workflows/release.yml
vendored
@@ -7,22 +7,20 @@ name: Build and Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*' # Trigger on any tag push
|
||||
- '*' # Any tag
|
||||
|
||||
jobs:
|
||||
build_and_release:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Python (needed for Conan)
|
||||
- name: Install build tools
|
||||
run: sudo apt-get update && sudo apt-get install -y flex bison
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
@@ -31,70 +29,167 @@ jobs:
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
||||
conan profile detect
|
||||
|
||||
- name: Configure Conan
|
||||
run: conan profile detect
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
||||
|
||||
- name: Install dependencies and build with Conan
|
||||
- name: Build
|
||||
run: |
|
||||
conan install . --build=missing
|
||||
conan build .
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
||||
|
||||
- name: Determine if prerelease
|
||||
id: prerelease_check
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
if [[ "$TAG" == prerelease-* ]]; then
|
||||
echo "true" > prerelease.txt
|
||||
else
|
||||
echo "false" > prerelease.txt
|
||||
fi
|
||||
echo "prerelease=$(cat prerelease.txt)" >> $GITHUB_OUTPUT
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
ARCH=$(uname -m)
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Archive build folder
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-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:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install build tools
|
||||
run: brew install flex bison
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install Conan
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install conan
|
||||
if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then
|
||||
arch -x86_64 conan profile detect
|
||||
else
|
||||
conan profile detect
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
BUILD_DIR="build_${{ matrix.arch }}"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cd "$BUILD_DIR"
|
||||
|
||||
# Use Rosetta for x86_64 builds on Apple Silicon
|
||||
if [ "${{ matrix.arch }}" = "x86_64" ] && [ "$(uname -m)" = "arm64" ]; then
|
||||
arch -x86_64 bash -c "
|
||||
export CMAKE_OSX_ARCHITECTURES=x86_64
|
||||
conan install .. --build=missing
|
||||
conan build ..
|
||||
"
|
||||
else
|
||||
export CMAKE_OSX_ARCHITECTURES="${{ matrix.arch }}"
|
||||
conan install .. --build=missing
|
||||
conan build ..
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
if [[ "$RUNNER_OS" == "Linux" ]]; then
|
||||
OS=linux
|
||||
OS="macos"
|
||||
ARCH="${{ matrix.arch }}"
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-${{ matrix.arch }}-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: msys2 {0}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: >
|
||||
base-devel
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-make
|
||||
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: |
|
||||
conan install . --profile mingw-profile.txt --build=missing
|
||||
conan build . --profile mingw-profile.txt
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
TAG=${GITHUB_REF##refs/tags/}
|
||||
OS="windows"
|
||||
ARCH=$(uname -m)
|
||||
FOLDER_NAME="chloride-$TAG-$OS-$ARCH"
|
||||
TAR_NAME="$FOLDER_NAME.tar.gz"
|
||||
mv build/bin "$FOLDER_NAME"
|
||||
cp LICENSE "$FOLDER_NAME"
|
||||
tar -czf "$TAR_NAME" "$FOLDER_NAME"
|
||||
elif [[ "$RUNNER_OS" == "macOS" ]]; then
|
||||
OS=macos
|
||||
ARCH=$(uname -m)
|
||||
FOLDER_NAME="chloride-$TAG-$OS-$ARCH"
|
||||
TAR_NAME="$FOLDER_NAME.tar.gz"
|
||||
mv build/bin "$FOLDER_NAME"
|
||||
cp LICENSE "$FOLDER_NAME"
|
||||
tar -czf "$TAR_NAME" "$FOLDER_NAME"
|
||||
else
|
||||
# Windows
|
||||
$TAG = $env:GITHUB_REF -replace 'refs/tags/', ''
|
||||
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
|
||||
$FOLDER_NAME = "chloride-$TAG-windows-$ARCH"
|
||||
$TAR_NAME = "$FOLDER_NAME.zip"
|
||||
Rename-Item build\bin $FOLDER_NAME
|
||||
Copy-Item LICENSE $FOLDER_NAME
|
||||
Compress-Archive -Path $FOLDER_NAME -DestinationPath $TAR_NAME
|
||||
fi
|
||||
echo "TAR_NAME=$TAR_NAME" >> $GITHUB_ENV
|
||||
shell: ${{ matrix.os == 'windows-latest' && 'pwsh' || 'bash' }}
|
||||
FOLDER="chloride-$TAG-$OS-$ARCH"
|
||||
TAR="$FOLDER.tar.gz"
|
||||
mv build/bin "$FOLDER"
|
||||
cp LICENSE.txt "$FOLDER"
|
||||
tar -czf "$TAR" "$FOLDER"
|
||||
echo "TAR_NAME=$TAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-artifact
|
||||
path: ${{ env.TAR_NAME }}
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-linux, build-macos, build-windows]
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: ./artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Create GitHub Release
|
||||
id: create_release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
body: |
|
||||
Automated release based on tag ${{ github.ref_name }}
|
||||
body: Automated release based on tag ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: ${{ steps.prerelease_check.outputs.prerelease }}
|
||||
artifacts: ${{ env.TAR_NAME }}
|
||||
prerelease: ${{ startsWith(github.ref_name, 'prerelease-') }}
|
||||
artifacts: "./artifacts/*"
|
||||
@@ -52,12 +52,12 @@ find_package(BDWgc REQUIRED)
|
||||
find_package(gmp REQUIRED)
|
||||
|
||||
target_compile_options(argon PRIVATE -O3 -Wall -Wextra -Wno-unused-function -s)
|
||||
target_link_options(argon PRIVATE -static)
|
||||
|
||||
target_link_libraries(argon PRIVATE
|
||||
BDWgc::BDWgc
|
||||
gmp::gmp
|
||||
m
|
||||
$<$<PLATFORM_ID:Windows>:bcrypt>
|
||||
)
|
||||
|
||||
target_include_directories(argon PRIVATE
|
||||
|
||||
35
Makefile
35
Makefile
@@ -2,26 +2,43 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Default FLEX tool
|
||||
BINARY = bin/argon
|
||||
FLEX_TOOL = flex
|
||||
|
||||
CFILES = external/xxhash/xxhash.c external/cwalk/src/cwalk.c external/libdye/src/dye.c $(shell find src -name '*.c')
|
||||
|
||||
LEXER_SRC = src/lexer/lex.l
|
||||
LEXER_C = src/lexer/lex.yy.c
|
||||
LEXER_H = src/lexer/lex.yy.h
|
||||
|
||||
CFILES = external/xxhash/xxhash.c external/cwalk/src/cwalk.c external/libdye/src/dye.c $(shell find src -name '*.c')
|
||||
CFLAGS = $(ARCHFLAGS) -lm -lgc -lgmp -Wall -Wextra -Wno-unused-function -Werror=unused-result -Iexternal/cwalk/include -Iexternal/libdye/include
|
||||
BINARY = bin/argon
|
||||
LDFLAGS = -lgc -lgmp -lm
|
||||
|
||||
ifeq ($(MAKECMDGOALS),windows)
|
||||
LDFLAGS = -Wl,-Bstatic -lgc -lgmp -Wl,-Bdynamic -lm
|
||||
endif
|
||||
|
||||
all: $(BINARY)
|
||||
|
||||
|
||||
$(LEXER_C) $(LEXER_H): $(LEXER_SRC)
|
||||
flex --header-file=$(LEXER_H) -o $(LEXER_C) $(LEXER_SRC)
|
||||
$(FLEX_TOOL) --header-file=$(LEXER_H) -o $(LEXER_C) $(LEXER_SRC)
|
||||
|
||||
$(BINARY): $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
mkdir -p bin
|
||||
gcc -O3 -o $(BINARY) $(CFILES) $(CFLAGS) -s
|
||||
gcc -O3 -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS} -s
|
||||
|
||||
windows: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
(echo -n "external/xxhash/xxhash.c " ; \
|
||||
echo -n "external/cwalk/src/cwalk.c " ; \
|
||||
echo -n "external/libdye/src/dye.c " ; \
|
||||
find src -name '*.c' -print0 | xargs -0 echo -n) > sources.txt
|
||||
mkdir -p bin
|
||||
gcc -O3 -march=native -o $(BINARY) @sources.txt $(CFLAGS) -lbcrypt
|
||||
|
||||
native: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
mkdir -p bin
|
||||
gcc -O3 -march=native -o $(BINARY) $(CFILES) $(CFLAGS)
|
||||
gcc -O3 -march=native -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
|
||||
|
||||
debug: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
mkdir -p bin
|
||||
@@ -29,13 +46,13 @@ debug: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
|
||||
full-debug: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
mkdir -p bin
|
||||
gcc -g -O0 -fsanitize=address -fno-omit-frame-pointer -o $(BINARY) $(CFILES) $(CFLAGS)
|
||||
gcc -g -O0 -fsanitize=address -fno-omit-frame-pointer -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
|
||||
|
||||
optimised: $(CFILES) $(LEXER_C) $(LEXER_H)
|
||||
mkdir -p bin
|
||||
gcc -O3 -fprofile-generate -o $(BINARY) $(CFILES) $(CFLAGS)
|
||||
gcc -O3 -fprofile-generate -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
|
||||
${BINARY} rand_test.ar
|
||||
gcc -O3 -fprofile-use -o $(BINARY) $(CFILES) $(CFLAGS)
|
||||
gcc -O3 -fprofile-use -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
|
||||
|
||||
|
||||
clean:
|
||||
|
||||
13
conanfile.py
13
conanfile.py
@@ -5,6 +5,7 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
|
||||
from shutil import which
|
||||
import os
|
||||
|
||||
class ArgonConan(ConanFile):
|
||||
name = "argon"
|
||||
@@ -29,20 +30,14 @@ class ArgonConan(ConanFile):
|
||||
self.folders.generators = "build"
|
||||
|
||||
def generate(self):
|
||||
os.environ["CONAN_NON_INTERACTIVE"] = "1"
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
# Try to find flex in system PATH first
|
||||
flex_path = which("flex")
|
||||
|
||||
# If not found, fallback to flex from Conan build requirements
|
||||
if not flex_path:
|
||||
flex_dep = self.dependencies.build.get("flex", None)
|
||||
if not flex_dep:
|
||||
raise Exception("Flex not found in system PATH and not declared as build requirement")
|
||||
flex_path = join(flex_dep.package_folder, "bin", "flex")
|
||||
|
||||
tc.variables["FLEX_EXECUTABLE"] = 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()
|
||||
|
||||
def build(self):
|
||||
|
||||
12
mingw-profile.txt
Normal file
12
mingw-profile.txt
Normal 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
|
||||
@@ -16,8 +16,11 @@
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <psapi.h>
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0602
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
|
||||
double get_memory_usage_mb() {
|
||||
PROCESS_MEMORY_COUNTERS pmc;
|
||||
|
||||
Reference in New Issue
Block a user