Statically link MSVC runtime

This commit is contained in:
Martin Natano
2022-06-03 19:47:45 +02:00
parent 4de9bd7c7f
commit 7b9a799cdb
7 changed files with 6 additions and 40 deletions
+1 -1
View File
@@ -12,7 +12,7 @@ At first, you have to install CMake.
All OSes All OSes
=== ===
The common way of installing CMake is to go to [CMake's download page](http://www.cmake.org/download/). At this time of writing, the latest version is 3.22.3. The minimum version supported at this time is 3.12. The common way of installing CMake is to go to [CMake's download page](http://www.cmake.org/download/). At this time of writing, the latest version is 3.23.2. The minimum version supported at this time is 3.20.
If this approach is used, consider using the binary distributions. Most should also provide a friendly GUI interface. If this approach is used, consider using the binary distributions. Most should also provide a friendly GUI interface.
-32
View File
@@ -66,35 +66,3 @@ macro(check_compile_features
endif() endif()
endif() endif()
endmacro() endmacro()
# Borrowed from http://stackoverflow.com/q/10113017
macro(configure_msvc_runtime)
if(MSVC)
# Get the compiler options generally used.
list(APPEND COMPILER_VARIABLES
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(WITH_STATIC_LINKING)
set(TO_REPLACE "/MD")
set(REPLACE_WITH "/MT")
else()
set(TO_REPLACE "/MT")
set(REPLACE_WITH "/MD")
endif()
foreach(COMPILER_VARIABLE ${COMPILER_VARIABLES})
if(${COMPILER_VARIABLE} MATCHES "${TO_REPLACE}")
string(REGEX
REPLACE "${TO_REPLACE}"
"${REPLACE_WITH}"
${COMPILER_VARIABLE}
"${${COMPILER_VARIABLE}}")
endif()
endforeach()
endif()
endmacro()
-2
View File
@@ -41,8 +41,6 @@ else()
WITH_TEXTURE_GENERATOR WITH_TEXTURE_GENERATOR
"Build with the Texture Font Generator. Ensure the MFC library is installed." "Build with the Texture Font Generator. Ensure the MFC library is installed."
OFF) OFF)
# Turn this option off to use dynamic linking instead of static linking.
option(WITH_STATIC_LINKING "Build StepMania with static linking." ON)
endif() endif()
if(WIN32) if(WIN32)
+1 -1
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12) cmake_minimum_required(VERSION 3.20)
project(StepMania) project(StepMania)
+1 -1
View File
@@ -21,7 +21,7 @@ ITGmania is a fork of [StepMania 5.1](https://github.com/stepmania/stepmania/tre
For those that do not wish to compile the game on their own and use a binary right away, be aware of the following issues: For those that do not wish to compile the game on their own and use a binary right away, be aware of the following issues:
* Windows users are expected to have installed the [Microsoft Visual C++ x86 Redistributable for Visual Studio 2015](http://www.microsoft.com/en-us/download/details.aspx?id=48145) prior to running the game. For those on a 64-bit operating system, grab the x64 redistributable as well. Windows 7 is the minimum supported version. * Windows 7 is the minimum supported version.
* macOS users need to have macOS 11 (Big Sur) or higher to run ITGmania. * macOS users need to have macOS 11 (Big Sur) or higher to run ITGmania.
* Linux users should receive all they need from the package manager of their choice. * Linux users should receive all they need from the package manager of their choice.
+2 -2
View File
@@ -49,8 +49,8 @@ include("${SM_CMAKE_DIR}/SMDefs.cmake")
# Put the predefined targets in separate groups. # Put the predefined targets in separate groups.
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Set up the linker flags for MSVC builds. # Select static MSVC runtime instead of DLL
configure_msvc_runtime() set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
# Checks the standard include directories for c-style headers. We may use C++ in # Checks the standard include directories for c-style headers. We may use C++ in
# this project, but the check works better with plain C headers. # this project, but the check works better with plain C headers.
+1 -1
View File
@@ -1,7 +1,7 @@
set(OGG_SRC "ogg/src/bitwise.c" set(OGG_SRC "ogg/src/bitwise.c"
"ogg/src/framing.c") "ogg/src/framing.c")
set(OGG_HPP "ogg/include/ogg/config_types.h" set(OGG_HPP "ogg/ogg/config_types.h"
"ogg/include/ogg/ogg.h" "ogg/include/ogg/ogg.h"
"ogg/include/ogg/os_types.h") "ogg/include/ogg/os_types.h")