diff --git a/CMakePresets.json b/CMakePresets.json index 7713bb385..effea7260 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -6,8 +6,6 @@ "description": "Build using default generator", "binaryDir": "build", "cacheVariables": { - "CMAKE_C_FLAGS": "-fdiagnostics-color", - "CMAKE_CXX_FLAGS": "-fdiagnostics-color", "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index 772103fc3..fba27d2fe 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -1,4 +1,4 @@ -set(CPM_DOWNLOAD_VERSION 0.36.0) +set(CPM_DOWNLOAD_VERSION 0.38.7) if(CPM_SOURCE_CACHE) set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") diff --git a/cmake/Comptime.cmake b/cmake/Comptime.cmake index 8388aed9e..c609efee4 100644 --- a/cmake/Comptime.cmake +++ b/cmake/Comptime.cmake @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.3 FATAL_ERROR) +cmake_minimum_required(VERSION 3.5 FATAL_ERROR) set(CMAKE_BINARY_DIR "${BINARY_DIR}") set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}") diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index 4c4cdafb6..5aca04d12 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -58,6 +58,10 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin) ) endif() +if("${CMAKE_SYSTEM_NAME}" MATCHES Windows) + target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2main) +endif() + if(NOT "${SRB2_CONFIG_SYSTEM_LIBRARIES}" AND NOT "${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}") target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static) else() diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 3eeacd835..f5fe9fb04 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -41,7 +41,7 @@ #endif #if defined (_WIN32) && !defined (main) -//#define SDLMAIN +#define SDLMAIN #endif #ifdef SDLMAIN diff --git a/src/win32/Srb2win.rc b/src/win32/Srb2win.rc index b69900746..8f3a43268 100644 --- a/src/win32/Srb2win.rc +++ b/src/win32/Srb2win.rc @@ -31,7 +31,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #endif -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST srb2win.exe.manifest +/* CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST srb2win.exe.manifest */ ///////////////////////////////////////////////////////////////////////////// // diff --git a/thirdparty/cpm-libgme.cmake b/thirdparty/cpm-libgme.cmake index f15bc3b31..20949f975 100644 --- a/thirdparty/cpm-libgme.cmake +++ b/thirdparty/cpm-libgme.cmake @@ -12,5 +12,5 @@ CPMAddPackage( if(libgme_ADDED) target_compile_features(gme PRIVATE cxx_std_11) # libgme's CMakeLists.txt already links this - #target_link_libraries(gme PRIVATE ZLIB::ZLIB) + target_link_libraries(gme PRIVATE ZLIB::ZLIB) endif() diff --git a/thirdparty/cpm-sdl2.cmake b/thirdparty/cpm-sdl2.cmake index 58cf9afc2..365ae5a06 100644 --- a/thirdparty/cpm-sdl2.cmake +++ b/thirdparty/cpm-sdl2.cmake @@ -1,13 +1,27 @@ +set( + internal_sdl2_options + + "BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" + "SDL_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" + "SDL_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" + "SDL_TEST OFF" + "SDL2_DISABLE_INSTALL ON" +) + +if(${CMAKE_SYSTEM} MATCHES Windows) + list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF") +endif() +if(${CMAKE_SYSTEM} MATCHES Darwin) + list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN OFF") +endif() +if(${CMAKE_SYSTEM} MATCHES Linux) + list(APPEND internal_sdl2_options "SDL2_DISABLE_SDL2MAIN ON") +endif() + CPMAddPackage( NAME SDL2 VERSION 2.24.2 URL "https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.24.2.zip" EXCLUDE_FROM_ALL ON - OPTIONS - "BUILD_SHARED_LIBS ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" - "SDL_SHARED ${SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" - "SDL_STATIC ${NOT_SRB2_CONFIG_SHARED_INTERNAL_LIBRARIES}" - "SDL_TEST OFF" - "SDL2_DISABLE_SDL2MAIN ON" - "SDL2_DISABLE_INSTALL ON" + OPTIONS ${internal_sdl2_options} )