This commit is contained in:
jusax23 2023-11-12 17:26:37 +01:00
parent e794e2e134
commit 3238f0304c
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41
3 changed files with 28 additions and 2 deletions

1
.gitignore vendored
View file

@ -44,3 +44,4 @@ src/-lstdc++.res
# Neural network for the NNUE evaluation
**/*.nnue
flags.txt

View file

@ -9,7 +9,6 @@ project(${PROJECT_NAME} LANGUAGES CXX)
# Invoke the build for native code shared with the other target platforms.
# This can be changed to accomodate different builds.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")

View file

@ -6,7 +6,33 @@ cmake_minimum_required(VERSION 3.18)
project(flutter_stockfish_plugin VERSION 0.0.1 LANGUAGES CXX)
file(GLOB_RECURSE cppPaths "Stockfish/src/*.cpp")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3 -flto -DNDEBUG -fPIC")
set(COMMON_FLAGS "-Wall -Wcast-qual -fno-exceptions -std=c++17 -pedantic -Wextra -Wshadow -Wmissing-declarations -flto -DUSE_PTHREADS") #-flto-partition=one
set(SIMD_FLAGS "-msse -msse3 -mpopcnt -DUSE_POPCNT -DUSE_SSE41 -msse4.1 -DUSE_SSSE3 -mssse3 -DUSE_SSE2 -msse2")
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
message(STATUS "Adding x86_64 specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} ${SIMD_FLAGS} -m64 -DIS_64BIT -DUSE_PTHREADS")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
message(STATUS "Adding x86 specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} ${SIMD_FLAGS}")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv8")
message(STATUS "Adding armv8 specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} -DIS_64BIT -DUSE_POPCNT -DUSE_NEON=8")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7")
message(STATUS "Adding armv7 specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS}")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
message(STATUS "Adding aarch64 specific flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_FLAGS} -DIS_64BIT -DNO_PREFETCH")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
set(NNUE_NAME nn-5af11540bbfe.nnue)
add_library(flutter_stockfish_plugin SHARED