Compare commits

..

23 Commits

Author SHA1 Message Date
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
William Bell
f11890a8b3 fix linking for linux and macos 2025-08-16 01:39:44 +01:00
William Bell
59b1d222c2 fix cmake 2025-08-16 01:32:57 +01:00
William Bell
2fba132016 make gc and gmp static and math dynamic 2025-08-16 01:22:08 +01:00
William Bell
bddc2cdc79 fix release to merge multiple 2025-08-16 01:06:06 +01:00
William Bell
e1b80b42d9 fix make release 2025-08-16 01:02:48 +01:00
William Bell
dab86925b4 fix winblows 2025-08-16 00:58:56 +01:00
William Bell
0f45052dce fix for winblows 2025-08-16 00:56:35 +01:00
William Bell
68f4207216 fix for winblows 2025-08-16 00:54:33 +01:00
William Bell
f9f8ca08c6 fix bug for windows 2025-08-16 00:50:23 +01:00
William Bell
0666b02c13 fix flex tool 2025-08-16 00:44:00 +01:00
William Bell
1654507835 fix for windows 2025-08-16 00:42:13 +01:00
William Bell
d054ece8e2 release 2025-08-16 00:39:37 +01:00
William Bell
4937942d6e fix release 2025-08-16 00:35:48 +01:00
William Bell
82ea92183f fix release 2025-08-16 00:28:08 +01:00
William Bell
5fb15b476f fix release 2025-08-16 00:26:26 +01:00
6 changed files with 64 additions and 36 deletions

View File

@@ -100,24 +100,38 @@ jobs:
build-windows: build-windows:
runs-on: windows-latest runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: recursive submodules: recursive
- name: Install build tools - uses: msys2/setup-msys2@v2
run: choco install winflexbison -y
shell: pwsh
- name: Setup Python
uses: actions/setup-python@v4
with: with:
python-version: '3.x' 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: Build with MinGW - name: Install Conan
run: | run: |
make windows python -m pip install --upgrade pip
shell: pwsh pip install conan
conan profile detect
- name: Build Project
run: |
conan install . --profile mingw-profile.txt --build=missing
conan build .
- name: Package - name: Package
run: | run: |
@@ -125,7 +139,7 @@ jobs:
$ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' } $ARCH = if ([Environment]::Is64BitOperatingSystem) { 'x64' } else { 'x86' }
$FOLDER = "chloride-$TAG-windows-$ARCH" $FOLDER = "chloride-$TAG-windows-$ARCH"
$ZIP = "$FOLDER.zip" $ZIP = "$FOLDER.zip"
Rename-Item bin $FOLDER Rename-Item build/bin $FOLDER
Copy-Item LICENSE.txt $FOLDER Copy-Item LICENSE.txt $FOLDER
Compress-Archive -Path $FOLDER -DestinationPath $ZIP Compress-Archive -Path $FOLDER -DestinationPath $ZIP
echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV echo "TAR_NAME=$ZIP" >> $env:GITHUB_ENV
@@ -145,6 +159,7 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
path: ./artifacts path: ./artifacts
merge-multiple: true
- name: Create GitHub Release - name: Create GitHub Release
uses: ncipollo/release-action@v1 uses: ncipollo/release-action@v1

View File

@@ -52,9 +52,6 @@ find_package(BDWgc REQUIRED)
find_package(gmp REQUIRED) find_package(gmp REQUIRED)
target_compile_options(argon PRIVATE -O3 -Wall -Wextra -Wno-unused-function -s) target_compile_options(argon PRIVATE -O3 -Wall -Wextra -Wno-unused-function -s)
if(NOT APPLE)
target_link_options(argon PRIVATE -static)
endif()
target_link_libraries(argon PRIVATE target_link_libraries(argon PRIVATE
BDWgc::BDWgc BDWgc::BDWgc

View File

@@ -6,33 +6,39 @@
BINARY = bin/argon BINARY = bin/argon
FLEX_TOOL = flex FLEX_TOOL = flex
# If target is "windows", override FLEX_TOOL CFILES = external/xxhash/xxhash.c external/cwalk/src/cwalk.c external/libdye/src/dye.c $(shell find src -name '*.c')
ifeq ($(MAKECMDGOALS),windows)
BINARY = bin/argon.exe
FLEX_TOOL = win_flex
endif
LEXER_SRC = src/lexer/lex.l 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
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 CFLAGS = $(ARCHFLAGS) -lm -lgc -lgmp -Wall -Wextra -Wno-unused-function -Werror=unused-result -Iexternal/cwalk/include -Iexternal/libdye/include
LDFLAGS = -lgc -lgmp -lm
ifeq ($(MAKECMDGOALS),windows)
LDFLAGS = -Wl,-Bstatic -lgc -lgmp -Wl,-Bdynamic -lm
endif
all: $(BINARY) all: $(BINARY)
windows: $(BINARY)
$(LEXER_C) $(LEXER_H): $(LEXER_SRC) $(LEXER_C) $(LEXER_H): $(LEXER_SRC)
$(FLEX_TOOL) --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) $(BINARY): $(CFILES) $(LEXER_C) $(LEXER_H)
mkdir -p bin 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) native: $(CFILES) $(LEXER_C) $(LEXER_H)
mkdir -p bin 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) debug: $(CFILES) $(LEXER_C) $(LEXER_H)
mkdir -p bin mkdir -p bin
@@ -40,13 +46,13 @@ debug: $(CFILES) $(LEXER_C) $(LEXER_H)
full-debug: $(CFILES) $(LEXER_C) $(LEXER_H) full-debug: $(CFILES) $(LEXER_C) $(LEXER_H)
mkdir -p bin 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) optimised: $(CFILES) $(LEXER_C) $(LEXER_H)
mkdir -p bin mkdir -p bin
gcc -O3 -fprofile-generate -o $(BINARY) $(CFILES) $(CFLAGS) gcc -O3 -fprofile-generate -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
${BINARY} rand_test.ar ${BINARY} rand_test.ar
gcc -O3 -fprofile-use -o $(BINARY) $(CFILES) $(CFLAGS) gcc -O3 -fprofile-use -o $(BINARY) $(CFILES) $(CFLAGS) ${LDFLAGS}
clean: clean:

View File

@@ -33,11 +33,6 @@ 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("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") flex_path = which("flex")
if not flex_path: if not flex_path:
raise Exception("Flex not found in system PATH. Please install flex on Linux/macOS.") raise Exception("Flex not found in system PATH. Please install flex on Linux/macOS.")

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

View File

@@ -16,8 +16,11 @@
#include <string.h> #include <string.h>
#if defined(_WIN32) #if defined(_WIN32)
#include <psapi.h> #ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0602
#endif
#include <windows.h> #include <windows.h>
#include <psapi.h>
double get_memory_usage_mb() { double get_memory_usage_mb() {
PROCESS_MEMORY_COUNTERS pmc; PROCESS_MEMORY_COUNTERS pmc;