Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Create Release
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand All @@ -29,7 +29,7 @@ jobs:
unit-tests:
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand All @@ -51,7 +51,7 @@ jobs:
verify-bench:
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand All @@ -67,7 +67,7 @@ jobs:
build-tuner:
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand All @@ -82,7 +82,7 @@ jobs:
build-spsa:
runs-on: ubuntu-latest
container:
image: hansbinderup/meson-gcc:1.2
image: hansbinderup/meson-gcc:1.3
options: --user root
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ All binaries are statically compiled so it should be easy to run.

This is the preferred way. It is very useful for quick development and ensures that you use setups verified by the developers.

The build scripts currently support Linux and Windows. The OS is automatically detected on build.
The build scripts currently support Linux and Windows. The OS is automatically detected on build. The scripts default to `clang++` as they've proven to be the fastest runtime. If you're compiling outside of docker then be aware of this.

#### Building with Docker

Expand Down
22 changes: 19 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,35 @@
FROM archlinux:latest

# Install necessary packages
RUN pacman -Sy --noconfirm \
RUN pacman -Syu --noconfirm \
&& pacman -Sy --noconfirm \
base-devel \
clang \
gcc \
mingw-w64-gcc \
lld \
llvm \
meson \
ninja \
gdb \
git \
cmake \
wget \
libxml2 \
openmp \
python \
python-pip \
&& pacman -Scc --noconfirm # Clean package cache
python-pip

# Download and install LLVM-Mingw toolchain
RUN cd /tmp \
&& wget -O llvm-mingw.tar.xz https://github.com/mstorsjo/llvm-mingw/releases/download/20250613/llvm-mingw-20250613-ucrt-ubuntu-22.04-x86_64.tar.xz \
&& mkdir -p llvm-mingw \
&& tar -xf llvm-mingw.tar.xz -C llvm-mingw --strip-components=1 \
&& mv llvm-mingw /opt/llvm-mingw \
&& rm -rf /tmp/*

# add clang-llvm to path
ENV PATH="/opt/llvm-mingw/bin:${PATH}"

# Set the working directory
WORKDIR /workspace
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

# NOTE: should be run from directory of Dockerfile
docker build -t hansbinderup/meson-gcc:1.2 .
docker build -t hansbinderup/meson-gcc:1.3 .
2 changes: 1 addition & 1 deletion docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ args="--privileged \
-w /workspaces/$(basename "$(pwd)")"


docker run -it $args hansbinderup/meson-gcc:1.2
docker run -it $args hansbinderup/meson-gcc:1.3
9 changes: 5 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project('meltdown-chess-engine', 'cpp',
subdir('version')

if get_option('buildtype') != 'debug'
add_project_arguments('-flto=auto', '-Ofast', '-funroll-loops', '-m64', '-finline-functions', language : 'cpp')
add_project_arguments('-ffast-math', '-fno-finite-math-only', '-funroll-loops', '-m64', '-finline-functions', language : 'cpp')

# allows developers to have a safer build - easier to debug with minimal runtime cost
if get_option('developer-build') == false
Expand Down Expand Up @@ -36,11 +36,12 @@ meltdown_dep = declare_dependency(
)

# statically link the C++ standard library and libgcc to avoid runtime issues
add_project_link_arguments('-static-libgcc', '-static-libstdc++', language: 'cpp')

# use full static linking (-static) only on Windows to avoid DLL dependencies
# NOTE: is not a good idea to do on linux
if host_machine.system() == 'windows'
add_project_link_arguments('-static', '-static-libgcc', '-static-libstdc++', language: 'cpp')
else
add_project_link_arguments('-static-libgcc', '-static-libstdc++', language: 'cpp')
add_project_link_arguments('-static', language: 'cpp')
endif

# build tuner instead of meltdown engine
Expand Down
8 changes: 4 additions & 4 deletions scripts/create_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ RELEASE_DIR=".release"
# List of elements that we cross compile.
# They refer to the .txt files in our 'targets' folder
ARCHS=(
"linux-gcc-x86-64-v2"
"linux-gcc-x86-64-v3"
"windows-gcc-x86-64-v2"
"windows-gcc-x86-64-v3"
"linux-x86-64-v2"
"linux-x86-64-v3"
"windows-x86-64-v2"
"windows-x86-64-v3"
)

# Ensure that we always have an empty release folder
Expand Down
10 changes: 6 additions & 4 deletions targets/linux-native.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[binaries]
c = 'x86_64-linux-gnu-gcc'
cpp = 'x86_64-linux-gnu-g++'
ar = 'x86_64-linux-gnu-gcc-ar'
strip = 'strip'
c = 'clang'
cpp = 'clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'linux'
Expand Down
17 changes: 17 additions & 0 deletions targets/linux-x86-64-v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[binaries]
c = 'clang'
cpp = 'clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[built-in options]
cpp_args = ['-march=x86-64-v2']
c_args = ['-march=x86-64-v2']
17 changes: 17 additions & 0 deletions targets/linux-x86-64-v3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[binaries]
c = 'clang'
cpp = 'clang++'
ar = 'llvm-ar'
strip = 'llvm-strip'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'linux'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[built-in options]
cpp_args = ['-march=x86-64-v3']
c_args = ['-march=x86-64-v3']
3 changes: 3 additions & 0 deletions targets/windows-gcc-x86-64-v2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true

[built-in options]
cpp_args = ['-march=x86-64-v2', '-static']
c_args = ['-march=x86-64-v2', '-static']
Expand Down
7 changes: 5 additions & 2 deletions targets/windows-gcc-x86-64-v3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true

[built-in options]
cpp_args = ['-march=x86-64-v3', '-static']
c_args = ['-march=x86-64-v3', '-static']
cpp_args = ['-march=x86-64-v3']
c_args = ['-march=x86-64-v3']
default_library = 'static'
18 changes: 12 additions & 6 deletions targets/windows-native.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-gcc-ar'
strip = 'x86_64-w64-mingw32-strip'
c = 'x86_64-w64-mingw32-clang'
cpp = 'x86_64-w64-mingw32-clang++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'llvm-strip'
windres = 'x86_64-w64-mingw32-windres'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true

[built-in options]
cpp_args = ['-march=native', '-static']
c_args = ['-march=native', '-static']
cpp_args = ['-march=native']
c_args = ['-march=native']
default_library = 'static'
22 changes: 22 additions & 0 deletions targets/windows-x86-64-v2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[binaries]
c = 'x86_64-w64-mingw32-clang'
cpp = 'x86_64-w64-mingw32-clang++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'llvm-strip'
windres = 'x86_64-w64-mingw32-windres'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true

[built-in options]
cpp_args = ['-march=x86-64-v2']
c_args = ['-march=x86-64-v2']
default_library = 'static'
22 changes: 22 additions & 0 deletions targets/windows-x86-64-v3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[binaries]
c = 'x86_64-w64-mingw32-clang'
cpp = 'x86_64-w64-mingw32-clang++'
ar = 'x86_64-w64-mingw32-ar'
strip = 'llvm-strip'
windres = 'x86_64-w64-mingw32-windres'
c_ld = 'lld'
cpp_ld = 'lld'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

[properties]
needs_exe_wrapper = true

[built-in options]
cpp_args = ['-march=x86-64-v3']
c_args = ['-march=x86-64-v3']
default_library = 'static'
Loading