mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-30 13:28:13 +08:00
cmake: build ci and and release with static runtime library
(The Visual Studio projects do this as well)
This commit is contained in:
@@ -35,13 +35,23 @@ jobs:
|
|||||||
builddir = f"{ srcdir }/build"
|
builddir = f"{ srcdir }/build"
|
||||||
os.makedirs(builddir)
|
os.makedirs(builddir)
|
||||||
cmakelists_txt = textwrap.dedent(f"""\
|
cmakelists_txt = textwrap.dedent(f"""\
|
||||||
# Always build .PDB symbol file
|
# MSVC debug information format flags are selected by an abstraction
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction")
|
set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction")
|
||||||
|
# MSVC runtime library flags are selected by an abstraction
|
||||||
|
set(CMAKE_POLICY_DEFAULT_CMP0091 "NEW" CACHE STRING "MSVC runtime library flags are selected by an abstraction")
|
||||||
|
cmake_minimum_required(VERSION 3.0...3.25)
|
||||||
|
project(sdl_user)
|
||||||
|
# Always build .PDB symbol file
|
||||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
|
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
|
set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
|
set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries")
|
||||||
cmake_minimum_required(VERSION 3.0...3.25)
|
if(WINDOWS_STORE) # WINDOWS_STORE is available AFTER project()
|
||||||
project(sdl_user)
|
# UWP only supports dynamic runtime
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL" CACHE STRING "MSVC runtime libary")
|
||||||
|
else()
|
||||||
|
# Use static runtime library
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "MSVC runtime libary")
|
||||||
|
endif()
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory("{ srcdir }" SDL)
|
add_subdirectory("{ srcdir }" SDL)
|
||||||
""")
|
""")
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
|||||||
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
|
message(FATAL_ERROR "Prevented in-tree build. Please create a build directory outside of the SDL source code and run \"cmake -S ${CMAKE_SOURCE_DIR} -B .\" from there")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# MSVC runtime library flags are selected by an abstraction.
|
|
||||||
set(CMAKE_POLICY_DEFAULT_CMP0091 NEW)
|
|
||||||
|
|
||||||
# See docs/release_checklist.md
|
# See docs/release_checklist.md
|
||||||
project(SDL3 LANGUAGES C VERSION "3.1.2")
|
project(SDL3 LANGUAGES C VERSION "3.1.2")
|
||||||
|
|
||||||
|
|||||||
@@ -471,6 +471,10 @@ class Releaser:
|
|||||||
"-DCMAKE_EXE_LINKER_FLAGS=-DEBUG",
|
"-DCMAKE_EXE_LINKER_FLAGS=-DEBUG",
|
||||||
# Linker flag for shared libraries
|
# Linker flag for shared libraries
|
||||||
"-DCMAKE_SHARED_LINKER_FLAGS=-INCREMENTAL:NO -DEBUG -OPT:REF -OPT:ICF",
|
"-DCMAKE_SHARED_LINKER_FLAGS=-INCREMENTAL:NO -DEBUG -OPT:REF -OPT:ICF",
|
||||||
|
# MSVC runtime library flags are selected by an abstraction
|
||||||
|
"-DCMAKE_POLICY_DEFAULT_CMP0091=NEW",
|
||||||
|
# Use statically linked runtime (-MT) (ideally, should be "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
"-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
|
||||||
])
|
])
|
||||||
|
|
||||||
with self.section_printer.group(f"Build VC CMake project for {arch}"):
|
with self.section_printer.group(f"Build VC CMake project for {arch}"):
|
||||||
|
|||||||
Reference in New Issue
Block a user