From a6a965ab6262a3e88eba28a68bdc2753529244cd Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 3 Dec 2021 21:51:50 +0300
Subject: [PATCH] cleanup for build options
---
CMakeLists.txt | 16 +++++++++-------
src/Makefile.os2 | 6 ++++--
src/Makefile.w32 | 6 +++---
src/SDL12_compat.c | 2 +-
src/SDL20_include_wrapper.h | 2 --
5 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2233a8b..78c0dc4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,12 +66,6 @@ endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
-# avoid DLL having 'lib' prefix with Windows MinGW builds
-if(WIN32)
- set(CMAKE_SHARED_LIBRARY_PREFIX "")
- set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "DLL_EXPORT")
-endif()
-
if(UNIX AND NOT APPLE)
set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "_REENTRANT")
target_link_libraries(SDL PRIVATE dl)
@@ -90,8 +84,16 @@ elseif(UNIX AND NOT ANDROID)
VERSION "${SDL12_COMPAT_VERSION_STR}"
SOVERSION "0"
OUTPUT_NAME "SDL-1.2")
+elseif(WIN32)
+ # avoid DLL having 'lib' prefix with MinGW
+ set(CMAKE_SHARED_LIBRARY_PREFIX "")
+ set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "DLL_EXPORT")
+ set_target_properties(SDL PROPERTIES
+ VERSION "${SDL12_COMPAT_VERSION_STR}"
+ SOVERSION "0"
+ OUTPUT_NAME "SDL")
elseif(OS2)
- # OS/2 version was built as SDL12.dll
+ set_target_properties(SDL PROPERTIES COMPILE_DEFINITIONS "BUILD_SDL") # for DECLSPEC
set_target_properties(SDL PROPERTIES
VERSION "${SDL12_COMPAT_VERSION_STR}"
SOVERSION "0"
diff --git a/src/Makefile.os2 b/src/Makefile.os2
index 9b8bdfd..1f4080f 100644
--- a/src/Makefile.os2
+++ b/src/Makefile.os2
@@ -17,12 +17,14 @@ LIBFILE = $(LIBNAME).lib
LNKFILE = $(LIBNAME).lnk
CFLAGS_DEF=-bt=os2 -d0 -zq -bm -5s -fp5 -fpi87 -sg -oteanbmier $(INCPATH)
-CFLAGS_DEF+= -DSDL_DISABLE_IMMINTRIN_H
+CFLAGS_DEF+= -DNDEBUG -DSDL_DISABLE_IMMINTRIN_H
+# for DECLSPEC
+CFLAGS_DEF+= -DBUILD_SDL
CFLAGS_DLL=$(CFLAGS_DEF) -bd
# Special flags for building SDL
CFLAGS=$(CFLAGS_DLL) -otexan -wx -ei
-# avoid bogus W200 from cpuid code:
+# avoid bogus W200 from cpuid code
CFLAGS+= -wcd=200
# newer OpenWatcom versions enable W303 by default
CFLAGS+= -wcd=303
diff --git a/src/Makefile.w32 b/src/Makefile.w32
index af1f65f..d85018a 100644
--- a/src/Makefile.w32
+++ b/src/Makefile.w32
@@ -17,14 +17,14 @@ LIBFILE = $(LIBNAME).lib
LNKFILE = $(LIBNAME).lnk
CFLAGS_DEF=-bt=nt -d0 -zq -bm -5s -fp5 -fpi87 -sg -oteanbmier $(INCPATH)
-CFLAGS_DEF+= -DSDL_DISABLE_IMMINTRIN_H
+CFLAGS_DEF+= -DNDEBUG -DSDL_DISABLE_IMMINTRIN_H
# we override the DECLSPEC define in begin_code.h, because we are using
# an exports file to remove the _cdecl '_' prefix from the symbol names
-CFLAGS_DLL=$(CFLAGS_DEF) -bd -DDLL_EXPORT -DDECLSPEC=
+CFLAGS_DLL=$(CFLAGS_DEF) -bd -DDECLSPEC=
# Special flags for building SDL
CFLAGS=$(CFLAGS_DLL) -otexan -wx -ei
-# avoid bogus W200 from cpuid code:
+# avoid bogus W200 from cpuid code
CFLAGS+= -wcd=200
# newer OpenWatcom versions enable W303 by default
CFLAGS+= -wcd=303
diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index e389c9e..73f7879 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1246,7 +1246,7 @@ unsigned _System LibMain(unsigned hmod, unsigned termination)
}
#else
- #error Please define your platform
+ #error Please define an init procedure for your platform.
#endif
#ifdef _WIN32
diff --git a/src/SDL20_include_wrapper.h b/src/SDL20_include_wrapper.h
index 57d7ca5..eadf497 100644
--- a/src/SDL20_include_wrapper.h
+++ b/src/SDL20_include_wrapper.h
@@ -101,8 +101,6 @@
#define SDL_RegisterApp IGNORE_THIS_VERSION_OF_SDL_RegisterApp
#define SDL_UnregisterApp IGNORE_THIS_VERSION_OF_SDL_UnregisterApp
-#define BUILD_SDL 1
-
/* *** HACK HACK HACK:
* *** Avoid including SDL_thread.h: it defines SDL_CreateThread() as a macro */
#if defined(_WIN32) || defined(__OS2__)