Browse Source

win32 makefiles add compile time switch for vista+ only APIs usage

Pal Lockheart 7 years ago
parent
commit
8344f93343
3 changed files with 4 additions and 4 deletions
  1. 1 1
      win32/Makefile
  2. 1 1
      win32/Makefile.mingw
  3. 2 2
      win32/win32.cpp

+ 1 - 1
win32/Makefile

@@ -15,7 +15,7 @@ OBJFILES = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(RCFILES:.rc=.o)
 TEST_CPPFILES = $(wildcard ../tests/*.cpp)
 TEST_CPPFILES = $(wildcard ../tests/*.cpp)
 TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
 TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
 
 
-override CCFLAGS = `sdl2-config --cflags` -g -msse -Wall -O2 -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(TEST_CCFLAGS)
+override CCFLAGS += `sdl2-config --cflags` -g -msse -Wall -O2 -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(TEST_CCFLAGS)
 CXXFLAGS = $(CCFLAGS) -std=c++11 
 CXXFLAGS = $(CCFLAGS) -std=c++11 
 CFLAGS = $(CCFLAGS) -std=gnu99
 CFLAGS = $(CCFLAGS) -std=gnu99
 LDFLAGS = `sdl2-config --libs` -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++
 LDFLAGS = `sdl2-config --libs` -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++

+ 1 - 1
win32/Makefile.mingw

@@ -15,7 +15,7 @@ OBJFILES = $(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(RCFILES:.rc=.o)
 TEST_CPPFILES = $(wildcard ../tests/*.cpp)
 TEST_CPPFILES = $(wildcard ../tests/*.cpp)
 TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
 TEST_OBJFILES = $(TEST_CPPFILES:.cpp=.o)
 
 
-override CCFLAGS = -g -msse -Wall -O2 -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(TEST_CCFLAGS)
+override CCFLAGS += -g -msse -Wall -O2 -fno-strict-aliasing -I. -I../ -I../liboggvorbis/include -I../liboggvorbis/src -DPAL_HAS_PLATFORM_SPECIFIC_UTILS $(TEST_CCFLAGS)
 CXXFLAGS = $(CCFLAGS) -std=c++11 
 CXXFLAGS = $(CCFLAGS) -std=c++11 
 CFLAGS = $(CCFLAGS) -std=gnu99
 CFLAGS = $(CCFLAGS) -std=gnu99
 LDFLAGS = -lmingw32 -lSDL2main -lSDL2 -mwindows -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++
 LDFLAGS = -lmingw32 -lSDL2main -lSDL2 -mwindows -lm -lwinmm -lole32 -loleaut32 -limm32 -lcomctl32 -luuid -ldxguid -lversion -static -static-libgcc -static-libstdc++

+ 2 - 2
win32/win32.cpp

@@ -270,7 +270,7 @@ extern "C" int UTIL_Platform_Init(int argc, char* argv[])
 #endif
 #endif
 
 
 	g_hInstance = GetModuleHandle(nullptr);
 	g_hInstance = GetModuleHandle(nullptr);
-#ifndef __MINGW32__ // mingw's windows sdk dont support GetThreadUILanguage, since it's a vista+ API
+#if !defined(__MINGW32__) || _WIN32_WINNT > _WIN32_WINNT_WINXP // compile time switch; make  CCFLAGS=-D_WIN32_WINNT=0x600 for vista+ only automatic language detection, else(default) XP compatible but english only.
 	g_wLanguage = GetThreadUILanguage();
 	g_wLanguage = GetThreadUILanguage();
 	if (PRIMARYLANGID(g_wLanguage) == LANG_CHINESE)
 	if (PRIMARYLANGID(g_wLanguage) == LANG_CHINESE)
 	{
 	{
@@ -304,7 +304,7 @@ extern "C"
 BOOL UTIL_IsAbsolutePath(LPCSTR  lpszFileName)
 BOOL UTIL_IsAbsolutePath(LPCSTR  lpszFileName)
 {
 {
 	char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFname[_MAX_FNAME], szExt[_MAX_EXT];
 	char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFname[_MAX_FNAME], szExt[_MAX_EXT];
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) // MinGW Distro's win32 api lacks this...Anyway, winxp lacks this too
 	if (_splitpath_s(lpszFileName, szDrive, szDir, szFname, szExt) == 0)
 	if (_splitpath_s(lpszFileName, szDrive, szDir, szFname, szExt) == 0)
 #else
 #else
 	_splitpath(lpszFileName, szDrive, szDir, szFname, szExt);
 	_splitpath(lpszFileName, szDrive, szDir, szFname, szExt);