diff --git a/.github/workflows/build-unoptimized.yml b/.github/workflows/build-unoptimized.yml index 04f15b4..246a956 100644 --- a/.github/workflows/build-unoptimized.yml +++ b/.github/workflows/build-unoptimized.yml @@ -40,7 +40,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 - # TODO: build using MSVC. It currently errors and warns on a whole bunch of stuff - # Also yes, that requires either shenanigans or a seperate action. - uses: ilammy/msvc-dev-cmd@v1 + # Build using MSVC. It currently warns on a bit of stuff because apparently -Wall warns on basically everything + # Also yes, using mvsc requires either shenanigans or a seperate action. + - uses: ilammy/msvc-dev-cmd@v1 - name: Make target ${{ matrix.target }} - run: $env:TARGET='${{ matrix.target }}'; make + run: $env:CXX='cl.exe'; $env:TARGET='${{ matrix.target }}'; make diff --git a/Makefile b/Makefile index 91e3eb9..17977fc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,10 @@ SRCDIR := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) CFLAGS_gtk = -DFLIPS_GTK $(GTKFLAGS) $(GTKLIBS) -CFLAGS_windows := -DFLIPS_WINDOWS -mwindows -lgdi32 -lcomdlg32 -lcomctl32 -luser32 -lkernel32 -lshell32 -ladvapi32 +CFLAGS_windows_base := -DFLIPS_WINDOWS +CFLAGS_windows_gcc := -mwindows -lgdi32 -lcomdlg32 -lcomctl32 -luser32 -lkernel32 -lshell32 -ladvapi32 +CFLAGS_windows := $(CFLAGS_windows_base) $(CFLAGS_windows_gcc) +LFLAGS_windows_msvc := gdi32.lib comdlg32.lib comctl32.lib user32.lib kernel32.lib shell32.lib advapi32.lib CFLAGS_cli := -DFLIPS_CLI CFLAGS_G = -fno-rtti -fno-exceptions -DNDEBUG -Wall @@ -52,6 +55,14 @@ ifeq ($(TARGET),) endif endif +ifeq ($(TARGET),windows) + ifneq (,$(filter $(CXX),cl cl.exe)) + override CFLAGS_windows := $(CFLAGS_windows_base) + LFLAGS += $(LFLAGS_windows_msvc) + endif + +endif + ifeq ($(TARGET),gtk) ifeq ($(GTKFLAGS),) GTKFLAGS := $(shell pkg-config --cflags --libs gtk+-3.0)