From 72c880f701ec53fce377f2c0f1ff4055590d63d4 Mon Sep 17 00:00:00 2001 From: Samuel Ellicott Date: Sat, 22 Oct 2022 01:21:21 -0400 Subject: [PATCH] Fix Windows build and build instructions --- README.md | 16 ++++++++++------ colorchord2/windows/compile-clang.bat | 4 ++-- colorchord2/windows/compile.bat | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ea45090..e930d70 100644 --- a/README.md +++ b/README.md @@ -102,14 +102,18 @@ Building with Windows There are 3 options available for building on Windows, clang, or TCC, MSYS2. ### clang Start by [downloading](https://clang.llvm.org/) the clang compiler, and installing it. - -Edit the batch script at `colorchord2/windows/compile-clang.bat`: -- Verify that the executable location is correct, on line 0 (`CC`). +You can also install using `winget` using the following command in PowerShell +``` +winget install -e --id LLVM.LLVM +``` If you have the Windows SDK installed, you should not need to do any additional work. -If you do not, you'll want to either [install it](https://developer.microsoft.com/en-US/windows/downloads/windows-11-sdk/) to get the official headers, or use the unofficial headers instead by adding `-DNO_WIN_HEADERS` to the `CCFLAGS` line in the batch file above. +If you do not, you'll want to either [install it](https://developer.microsoft.com/en-US/windows/downloads/windows-11-sdk/) to get the official headers. Realistically, it's easyist to get the headers by installing Visual Studio Communitiy and selecting the C/C++ Desktop Application devlopment package and installing it from there [Visual Studio](https://visualstudio.microsoft.com/). -Run the batch script, and it should output to `colorchord2/colorchord.exe`. +Once the Windows headers are installed run the clang batch script, and it should output to `colorchord2/colorchord.exe`. +``` +./compile-clang.bat +``` ### TCC Start by [downloading TCC](http://savannah.nongnu.org/projects/tinycc/), and extracting it to `C:\tcc`. @@ -119,7 +123,7 @@ to the default location, you can skip the next step. Edit the batch script at `colorchord2/windows/compile.bat`: - Edit line 17 (`CC`) to be the location where you put TCC. If there are spaces in the path, wrap the entire path in quotes. -Note that TCC is not able to use the Windows SDK, and as such using the unofficial headers is required, and automatically enabled when compiling with TCC. If you encounter issues, try the clang method above instead. +Note that TCC is not able to use the Windows SDK, and as such using the unofficial headers is required, and automatically enabled when compiling with TCC. If you encounter issues, try the clang method above instead. TCC does not support open-gl rendering and is limited to software rendering. ### MSYS2 With either 64bit or 32bit [MSYS2](https://msys2.github.io/) installed, run the _MSYS2 MSYS_ launcher and use `pacman` to set up a MinGW32 toolchain, if you don't have one already: diff --git a/colorchord2/windows/compile-clang.bat b/colorchord2/windows/compile-clang.bat index d3d7e04..1afaba0 100644 --- a/colorchord2/windows/compile-clang.bat +++ b/colorchord2/windows/compile-clang.bat @@ -1,7 +1,7 @@ @echo off set CC="C:\Program Files\LLVM\bin\clang.exe" rem To enable OpenGL rendering use the -DCNFGOGL option -set CCFLAGS=-g -D_CRT_SECURE_NO_WARNINGS -DCNFGOGL +set CCFLAGS=-g -D_CRT_SECURE_NO_WARNINGS -DCNFGOGL set CCIFLAGS=-I../../embeddedcommon -I../cnfa -I../rawdraw -I../ -O2 set CCLFLAGS=-lwinmm -lgdi32 -lws2_32 -lsetupapi -lkernel32 -luser32 -ldbghelp -lole32 -lmmdevapi -lAvrt -lopengl32 set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\filter.c ^ @@ -9,7 +9,7 @@ set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\..\embeddedcommon\DFT32.c symbol_enumerator.c ^ ..\DisplayArray.c ..\DisplayDMX.c ..\DisplayFileWrite.c ..\DisplayHIDAPI.c ..\DisplayNetwork.c ^ ..\DisplayOUTDriver.c ..\DisplayPie.c ..\DisplayRadialPoles.c ..\DisplaySHM.c ..\DisplayUSB2812.c ^ -..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c . +..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c @echo on %CC% %CCFLAGS% %CCIFLAGS% -o ../colorchord.exe %SOURCES% %CCLFLAGS% diff --git a/colorchord2/windows/compile.bat b/colorchord2/windows/compile.bat index c84d7c9..e9b4424 100644 --- a/colorchord2/windows/compile.bat +++ b/colorchord2/windows/compile.bat @@ -13,7 +13,7 @@ set SOURCES=..\main.c ..\chash.c ..\color.c ..\configs.c ..\decompose.c ..\dft.c ..\..\embeddedcommon\DFT32.c tcc_stubs.c symbol_enumerator.c ^ ..\DisplayArray.c ..\DisplayDMX.c ..\DisplayFileWrite.c ..\DisplayHIDAPI.c ..\DisplayNetwork.c ^ ..\DisplayOUTDriver.c ..\DisplayPie.c ..\DisplayRadialPoles.c ..\DisplaySHM.c ..\DisplayUSB2812.c ^ -..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c . +..\OutputCells.c ..\OutputLinear.c ..\OutputProminent.c ..\OutputVoronoi.c set ARCH_SPECIFIC=-L32 C:\windows\system32\winmm.dll -DWIN32_LEAN_AND_MEAN set CC=C:\tcc\tcc.exe