Hello, I'm Kobe from South Korea, studying iOS and Swift.
I'm currently working on an issue as follows:
Issue Description:
/MD and /MDd cannot be mixed in the current setup, but it's necessary to build both debug and release variants of the runtime as swiftCore.dll and swiftCored.dll, allowing builds with both /MD and /MDd for enabling debug builds.
My question is:
Currently, the runtime and compiler are being built simultaneously in the project.
The compiler cannot be built in debug mode due to numerous undefined behaviors.
This indicates the need for a separated build, which currently has no trigger mechanism.
How can we separate the runtime to enable builds in both debug and release modes and subsequently use default settings to resolve this issue?
Up to now, I have made the following modifications in the swift/CMakeLists.txt:
- Lines 378-406:
#
# User-configurable Swift Standard Library specific options.
#
# TODO: Once the stdlib/compiler builds are split, this should be sunk into the
# stdlib cmake.
#
option(BUILD_RUNTIME "Build the runtime separately" OFF)
option(BUILD_COMPILER "Build the compiler separately" OFF)
option(BUILD_DEBUG_MODE "Build in debug mode" OFF)
option(BUILD_RELEASE_MODE "Build in release mode" OFF)
if(BUILD_RUNTIME)
message(STATUS "Building runtime separately")
endif()
if(BUILD_COMPILER)
message(STATUS "Building compiler separately")
endif()
if(BUILD_DEBUG_MODE)
set(CMAKE_BUILD_TYPE Debug)
message(STATUS "Building in debug mode")
endif()
if(BUILD_RELEASE_MODE)
set(CMAKE_BUILD_TYPE Release)
message(STATUS "Building in release mode")
endif()
- Lines 408-428:
set(SWIFT_STDLIB_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING
"Build type for the Swift standard library and SDK overlays [Debug, RelWithDebInfo, Release, MinSizeRel]")
set(SWIFT_STDLIB_RELEASE_RUNTIME_TYPE "MD" CACHE STRING "MSVC Runtime type for the standard library in Release mode [MD, MDd]")
set(SWIFT_STDLIB_DEBUG_RUNTIME_TYPE "MDd" CACHE STRING "MSVC Runtime type for the standard library in Debug mode [MD, MDd]")
# Allow the user to specify the standard library CMAKE_MSVC_RUNTIME_LIBRARY
# value. The following values are valid:
# - MultiThreaded (/MT)
# - MultiThreadedDebug (/MTd)
# - MultiThreadedDLL (/MD)
# - MultiThreadedDebugDLL (/MDd)
if(SWIFT_STDLIB_RELEASE_RUNTIME_TYPE STREQUAL "MD")
set(SWIFT_STDLIB_RELEASE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
else()
set(SWIFT_STDLIB_RELEASE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
endif()
if(SWIFT_STDLIB_DEBUG_RUNTIME_TYPE STREQUAL "MD")
set(SWIFT_STDLIB_DEBUG_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
else()
set(SWIFT_STDLIB_DEBUG_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
endif()