add Visual Studio 2022 support (via CMAKE)

This commit is contained in:
Logan Aerl Arias 2024-02-10 19:29:48 +00:00
parent 58e6ce5c2d
commit 5e175a3438
8 changed files with 30 additions and 14 deletions

View file

@ -6,8 +6,6 @@
"description": "Build using default generator", "description": "Build using default generator",
"binaryDir": "build", "binaryDir": "build",
"cacheVariables": { "cacheVariables": {
"CMAKE_C_FLAGS": "-fdiagnostics-color",
"CMAKE_CXX_FLAGS": "-fdiagnostics-color",
"CMAKE_BUILD_TYPE": "RelWithDebInfo" "CMAKE_BUILD_TYPE": "RelWithDebInfo"
} }
}, },

View file

@ -1,4 +1,4 @@
set(CPM_DOWNLOAD_VERSION 0.36.0) set(CPM_DOWNLOAD_VERSION 0.38.7)
if(CPM_SOURCE_CACHE) if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")

View file

@ -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_BINARY_DIR "${BINARY_DIR}")
set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}") set(CMAKE_CURRENT_BINARY_DIR "${BINARY_DIR}")

View file

@ -58,6 +58,10 @@ if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin)
) )
endif() 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}") 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) target_link_libraries(SRB2SDL2 PRIVATE SDL2::SDL2-static SDL2_mixer::SDL2_mixer-static)
else() else()

View file

@ -41,7 +41,7 @@
#endif #endif
#if defined (_WIN32) && !defined (main) #if defined (_WIN32) && !defined (main)
//#define SDLMAIN #define SDLMAIN
#endif #endif
#ifdef SDLMAIN #ifdef SDLMAIN

View file

@ -31,7 +31,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 #define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#endif #endif
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST srb2win.exe.manifest /* CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST srb2win.exe.manifest */
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //

View file

@ -12,5 +12,5 @@ CPMAddPackage(
if(libgme_ADDED) if(libgme_ADDED)
target_compile_features(gme PRIVATE cxx_std_11) target_compile_features(gme PRIVATE cxx_std_11)
# libgme's CMakeLists.txt already links this # libgme's CMakeLists.txt already links this
#target_link_libraries(gme PRIVATE ZLIB::ZLIB) target_link_libraries(gme PRIVATE ZLIB::ZLIB)
endif() endif()

View file

@ -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( CPMAddPackage(
NAME SDL2 NAME SDL2
VERSION 2.24.2 VERSION 2.24.2
URL "https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.24.2.zip" URL "https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.24.2.zip"
EXCLUDE_FROM_ALL ON EXCLUDE_FROM_ALL ON
OPTIONS OPTIONS ${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_SDL2MAIN ON"
"SDL2_DISABLE_INSTALL ON"
) )