From 3f5bb5939ad94d85234f23bcc728199de206ea4c Mon Sep 17 00:00:00 2001 From: Rokas Kupstys Date: Wed, 24 Feb 2021 10:26:13 +0200 Subject: [PATCH] Examples: Fix MinGW detection in makefiles. Fix example_null build due to missing IME input libs. (#2590) --- .github/workflows/build.yml | 4 ++-- examples/example_glfw_opengl2/Makefile | 2 +- examples/example_glfw_opengl3/Makefile | 2 +- examples/example_glut_opengl2/Makefile | 2 +- examples/example_null/Makefile | 4 ++-- examples/example_null/build_win32.bat | 2 +- examples/example_sdl_opengl2/Makefile | 2 +- examples/example_sdl_opengl3/Makefile | 10 +++++----- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 888593e0..8cd056cf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: #include "examples/example_null/main.cpp" EOF - g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp + g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 - name: Build example_null (with IMGUI_DISABLE_WIN32_FUNCTIONS) shell: bash @@ -81,7 +81,7 @@ jobs: #include "examples/example_null/main.cpp" EOF - g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp + g++ -I. -Wall -Wformat -o example_single_file.exe example_single_file.cpp -limm32 - name: Build example_null (as DLL) shell: cmd diff --git a/examples/example_glfw_opengl2/Makefile b/examples/example_glfw_opengl2/Makefile index a24a91f3..720a403c 100644 --- a/examples/example_glfw_opengl2/Makefile +++ b/examples/example_glfw_opengl2/Makefile @@ -49,7 +49,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) +ifeq ($(OS), Windows_NT) ECHO_MESSAGE = "MinGW" LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 diff --git a/examples/example_glfw_opengl3/Makefile b/examples/example_glfw_opengl3/Makefile index 294d103d..83fdcf06 100644 --- a/examples/example_glfw_opengl3/Makefile +++ b/examples/example_glfw_opengl3/Makefile @@ -79,7 +79,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) +ifeq ($(OS), Windows_NT) ECHO_MESSAGE = "MinGW" LIBS += -lglfw3 -lgdi32 -lopengl32 -limm32 diff --git a/examples/example_glut_opengl2/Makefile b/examples/example_glut_opengl2/Makefile index 952ca318..a980f56f 100644 --- a/examples/example_glut_opengl2/Makefile +++ b/examples/example_glut_opengl2/Makefile @@ -40,7 +40,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) +ifeq ($(OS), Windows_NT) ECHO_MESSAGE = "MinGW" LIBS += -lgdi32 -lopengl32 -limm32 ifeq ($(shell pkg-config freeglut --exists 2> /dev/null && echo yes || echo no),yes) diff --git a/examples/example_null/Makefile b/examples/example_null/Makefile index d4159e4b..2197c01c 100644 --- a/examples/example_null/Makefile +++ b/examples/example_null/Makefile @@ -57,12 +57,12 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) +ifeq ($(OS), Windows_NT) ECHO_MESSAGE = "MinGW" ifneq ($(WITH_EXTRA_WARNINGS), 0) CXXFLAGS += -Wextra -Wpedantic - LIBS += -limm32 endif + LIBS += -limm32 CFLAGS = $(CXXFLAGS) endif diff --git a/examples/example_null/build_win32.bat b/examples/example_null/build_win32.bat index 38e79148..0cdfdc93 100644 --- a/examples/example_null/build_win32.bat +++ b/examples/example_null/build_win32.bat @@ -1,3 +1,3 @@ @REM Build for Visual Studio compiler. Run your copy of vcvars32.bat or vcvarsall.bat to setup command-line compiler. mkdir Debug -cl /nologo /Zi /MD /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib +cl /nologo /Zi /MD /I ..\.. %* *.cpp ..\..\*.cpp /FeDebug/example_null.exe /FoDebug/ /link gdi32.lib shell32.lib imm32.lib diff --git a/examples/example_sdl_opengl2/Makefile b/examples/example_sdl_opengl2/Makefile index 5fdad0ba..92e0554b 100644 --- a/examples/example_sdl_opengl2/Makefile +++ b/examples/example_sdl_opengl2/Makefile @@ -48,7 +48,7 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) +ifeq ($(OS), Windows_NT) ECHO_MESSAGE = "MinGW" LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` diff --git a/examples/example_sdl_opengl3/Makefile b/examples/example_sdl_opengl3/Makefile index 6e30a135..7c0e7ea8 100644 --- a/examples/example_sdl_opengl3/Makefile +++ b/examples/example_sdl_opengl3/Makefile @@ -78,12 +78,12 @@ ifeq ($(UNAME_S), Darwin) #APPLE CFLAGS = $(CXXFLAGS) endif -ifeq ($(findstring MINGW,$(UNAME_S)),MINGW) - ECHO_MESSAGE = "MinGW" - LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` +ifeq ($(OS), Windows_NT) + ECHO_MESSAGE = "MinGW" + LIBS += -lgdi32 -lopengl32 -limm32 `pkg-config --static --libs sdl2` - CXXFLAGS += `pkg-config --cflags sdl2` - CFLAGS = $(CXXFLAGS) + CXXFLAGS += `pkg-config --cflags sdl2` + CFLAGS = $(CXXFLAGS) endif ##---------------------------------------------------------------------