stellar

Stellar - UCI Chess engine written in C++20
git clone git://git.dimitrijedobrota.com/stellar.git
Log | Files | Refs | README | LICENSE

commit 2fb9a673b6887550d88a7d3be0cfd8df2a4e0536
parent 1e2a1194e08c9d8f2fb72219cabf7dc5b56d0765
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Tue, 15 Aug 2023 23:17:36 +0200

Improve CMake file

Diffstat:
MCMakeLists.txt | 23+++++++++++++++++------
Msrc/include/utils_cpp.hpp | 2+-
Msrc/perft/perft.cpp | 2++
3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -3,20 +3,31 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) project( Stellar - VERSION 0.0.20 + VERSION 0.0.21 DESCRIPTION "Chess engine written in C" HOMEPAGE_URL https://git.dimitrijedobrota.com/stellar.git LANGUAGES C CXX ) -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_C_EXTENSIONS ON) - set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconstexpr-ops-limit=1000000000") +include(CheckCXXCompilerFlag) + +CHECK_CXX_COMPILER_FLAG("-flto -fno-fat-lto-objects" COMPILER_SUPPORTS_LTO) +if(COMPILER_SUPPORTS_LTO) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fno-fat-lto-objects") +endif() + +CHECK_CXX_COMPILER_FLAG("-fconstexpr-ops-limit=10000000000" COMPILER_SUPPORTS_CONSTEXPR_OPS_LIMIT) +if(COMPILER_SUPPORTS_CONSTEXPR_OPS_LIMIT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconstexpr-ops-limit=1000000000") +endif() + +CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) +if(COMPILER_SUPPORTS_MARCH_NATIVE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") +endif() add_subdirectory(src) diff --git a/src/include/utils_cpp.hpp b/src/include/utils_cpp.hpp @@ -35,7 +35,7 @@ template <typename C, C beginVal, C endVal> class Iterator { typedef uint64_t U64; typedef uint32_t U32; -enum class Color : uint8_t { +enum class Color : bool { WHITE = 0, BLACK }; diff --git a/src/perft/perft.cpp b/src/perft/perft.cpp @@ -20,6 +20,7 @@ class Perft { Board board = board_start; if (!move.make(board, 0)) return; sem.acquire(); + debug(board_start, move, board); if (depth > 1) { test(board, depth - 1); @@ -63,6 +64,7 @@ class Perft { for (int i = 0; i < list.size(); i++) { Board copy = board; if (!list[i].make(copy, 0)) continue; + debug(board, list[i], copy); if (depth != 1) test(copy, depth - 1); else