From 4e437d52fc446373c14c71a2ca4aff42cbc35fc0 Mon Sep 17 00:00:00 2001 From: rektdie Date: Wed, 22 Apr 2026 00:52:00 +0200 Subject: [PATCH] windows builds with clang++ too | bench 1246472 --- Makefile | 14 ++++++++++---- README.md | 3 ++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 3c05d97..ab569a1 100644 --- a/Makefile +++ b/Makefile @@ -5,14 +5,16 @@ OBJ_DIR := obj EXE ?= Eleanor EVALFILE := ./nnue.bin +CXX := clang++ + ifeq ($(OS),Windows_NT) UNAME_S := Windows + ARCH := x86_64 EXE_EXT := .exe MKDIR := mkdir RM := rmdir /s /q DEL := del /q PLATFORM := windows - CXX := g++ else UNAME_S := $(shell uname -s) ARCH := $(shell uname -m) @@ -20,7 +22,6 @@ else MKDIR := mkdir -p RM := rm -rf DEL := rm -f - CXX := clang++ ifeq ($(UNAME_S),Darwin) PLATFORM := mac else @@ -28,6 +29,8 @@ else endif endif +CXX_BASE := $(notdir $(firstword $(CXX))) +CXX_DRIVER_FLAGS := CXXFLAGS := -std=c++20 -O3 -flto -Wall LDFLAGS := -O3 -flto @@ -39,6 +42,9 @@ ifeq ($(PLATFORM),mac) endif else ifeq ($(PLATFORM),windows) ARCH_FLAGS := -march=native + CXX_DRIVER_FLAGS += --target=$(ARCH)-w64-windows-gnu + CXXFLAGS += -pthread + LDFLAGS += -pthread LDFLAGS += -static -Wl,--stack,8388608 else ifeq ($(ARCH),aarch64) @@ -58,10 +64,10 @@ SRCS := $(wildcard $(SRC_DIR)/*.cpp) OBJS := $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRCS)) $(EXE)$(EXE_EXT): $(OBJS) - $(CXX) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $^ -o $@ $(LDFLAGS) + $(CXX) $(CXX_DRIVER_FLAGS) $(CXXFLAGS) -DEVALFILE=\"$(EVALFILE)\" $^ -o $@ $(LDFLAGS) $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR) - $(CXX) $(CXXFLAGS) -c -o $@ $< + $(CXX) $(CXX_DRIVER_FLAGS) $(CXXFLAGS) -c -o $@ $< $(OBJ_DIR): $(MKDIR) $(OBJ_DIR) diff --git a/README.md b/README.md index 79991d1..06b0208 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ A 1536-hidden-layer *perspective net* with 8 input buckets, 8 output buckets and ## Installation > **Prerequisites:** -> - `clang++` on linux, `g++` on windows +> - `clang++` compiler +> - On Windows, `clang++` must have access to a MinGW GNU toolchain/runtime because the build targets `x86_64-w64-windows-gnu` > - Access to `make` command 1. Clone the repository -- 2.47.3