diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 18:09:44 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-03-01 18:09:44 +0100 |
| commit | 2c291aed4bb80f07e8557284d3399cf1e2a4ccb9 (patch) | |
| tree | 2c009a3ad206842b07b1cd758b8192e2154231e9 /build.bat | |
| parent | dff3a040637f2985b5b5e369148a993183964096 (diff) | |
| download | nissy-core-2c291aed4bb80f07e8557284d3399cf1e2a4ccb9.tar.gz nissy-core-2c291aed4bb80f07e8557284d3399cf1e2a4ccb9.zip | |
Improve Windows build support.
- Use multithreading (works with a sufficiently recent version of
the Microsoft developer tools / C SDK).
- Detect CPU architecture and use AVX2 or NEON when appropriate.
- Automatically detect python installation path.
Diffstat (limited to 'build.bat')
| -rw-r--r-- | build.bat | 26 |
1 files changed, 19 insertions, 7 deletions
| @@ -9,15 +9,25 @@ if [%1]==[/d] ( | |||
| 9 | 9 | ||
| 10 | SET CC=clang | 10 | SET CC=clang |
| 11 | SET CXX=clang++ | 11 | SET CXX=clang++ |
| 12 | SET ARCH=PORTABLE | 12 | SET THREADS=16 |
| 13 | SET THREADS=1 | ||
| 14 | SET SANITIZE= | 13 | SET SANITIZE= |
| 15 | 14 | ||
| 16 | :: TODO depends on ARCH variable | 15 | SET ARCH=PORTABLE |
| 17 | SET ARCHOPTS= | 16 | clang -march=native -dM -E - < NUL | findstr /C:"__AVX2__" >NUL 2>&1 |
| 18 | :: TODO depends on SANITIZE variable | 17 | if %ERRORLEVEL% EQU 0 ( |
| 19 | SET DFLAGS=-g3 -DDEBUG | 18 | SET ARCH=AVX2 |
| 19 | SET ARCHOPTS=-mavx2 | ||
| 20 | goto :ArchDone | ||
| 21 | ) | ||
| 22 | clang -march=native -dM -E - < NUL | findstr /C:"__ARM_NEON" >NUL 2>&1 | ||
| 23 | if %ERRORLEVEL% EQU 0 ( | ||
| 24 | SET ARCH=NEON | ||
| 25 | goto :ArchDone | ||
| 26 | ) | ||
| 27 | :ArchDone | ||
| 28 | |||
| 20 | 29 | ||
| 30 | SET DFLAGS=-g3 -DDEBUG | ||
| 21 | SET WARNINGS=-Wno-deprecated-declarations | 31 | SET WARNINGS=-Wno-deprecated-declarations |
| 22 | SET VARIABLES=-DTHREADS=%THREADS% -D%ARCH% | 32 | SET VARIABLES=-DTHREADS=%THREADS% -D%ARCH% |
| 23 | SET OFLAGS=-O3 | 33 | SET OFLAGS=-O3 |
| @@ -28,7 +38,9 @@ SET STACKSIZE=-Wl,-stack:16777216 | |||
| 28 | SET LFLAGS=%STACKSIZE% | 38 | SET LFLAGS=%STACKSIZE% |
| 29 | 39 | ||
| 30 | :: Python libraries - change to match your local installation | 40 | :: Python libraries - change to match your local installation |
| 31 | SET PYPATH=%userprofile%\AppData\Local\Programs\Python\Python313 | 41 | for /f "delims=" %%i in ('python -c "import sys; print(sys.base_prefix)"') do set PYPATH=%%i |
| 42 | ::SET PYPATH=%userprofile%\AppData\Local\Programs\Python\Python313 | ||
| 43 | |||
| 32 | SET PYINCLUDE=%PYPATH%\include | 44 | SET PYINCLUDE=%PYPATH%\include |
| 33 | SET PYLIBS=%PYPATH%\libs | 45 | SET PYLIBS=%PYPATH%\libs |
| 34 | 46 | ||
