Skip to content
Open
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
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.env
*.log
*.md
*.git*
*.DS_Store

docker-compose.yml
docker-compose.override.yml

dist/
build/
tmp/
*.tmp
*.swp

.github/
31 changes: 31 additions & 0 deletions .github/runner/ubuntu_image.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Commands:
# [build] docker build -t ghr-chess-engine-ubuntu . -f .github\runner\ubuntu_image.dockerfile
# [run] docker run -it --rm ghr-chess-engine-ubuntu
# [configure cmake] cmake --preset=clang_release
# [build cmake] cmake --build --preset=clang_release

FROM ubuntu:24.04

# [curl, zip]: dependencies for vcpkg
RUN apt-get update && apt-get install -y \
curl zip \
pkg-config \
build-essential \
git \
cmake \
clang \
ninja-build \
&& rm -rf /var/lib/apt/lists/*

# Configure VCPKG
WORKDIR /
RUN git clone https://github.com/microsoft/vcpkg.git
WORKDIR /vcpkg
RUN ./bootstrap-vcpkg.sh -disableMetrics
ENV VCPKG_ROOT=/vcpkg
ENV PATH="${VCPKG_ROOT}:${PATH}"

WORKDIR /chess_engine
COPY . .

RUN ["/bin/bash"]
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ set(COMPILE_PACKAGE "Packages and exports library and binaries" ON)
include(cmake/clang_format.cmake)
include(cmake/clang_tidy.cmake)
include(cmake/compile_options.cmake)
include(cmake/setup_pthread.cmake)

find_package(fmt CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"hidden": true,
"binaryDir": "${sourceDir}/build/${presetName}",
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install"
Expand Down
14 changes: 14 additions & 0 deletions cmake/setup_pthread.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
# Required for pthread libs to be detected properly by cmake while configuring
# It's a requirement for spdlog external library
# Error log:
# 'Could NOT find Threads (missing: Threads_FOUND)'
# build/clang_debug/vcpkg_installed/x64-linux/share/spdlog/spdlogConfig.cmake:30 (find_package)
# Tried installing libs and checking availability with the PATH: everything was ok but cmake still couldn't find it
# Tried libs: libpthread-stubs0-dev / libatomic1 / gcc-multilib / g++-multilib / libc6-dev / libc++-dev / libc++abi-dev
# Finally found a workaround by forcing the pthread flags
set(CMAKE_THREAD_LIBS_INIT "-pthread" CACHE STRING "")
set(CMAKE_HAVE_THREADS_LIBRARY 1 CACHE BOOL "")
set(CMAKE_USE_PTHREADS_INIT 1 CACHE BOOL "")
endif()