mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a build-script + CMake flag to enable/disable building the _Volatile module
This commit is contained in:
@@ -712,6 +712,10 @@ option(SWIFT_ENABLE_SYNCHRONIZATION
|
|||||||
"Enable build of the Swift Synchronization module"
|
"Enable build of the Swift Synchronization module"
|
||||||
FALSE)
|
FALSE)
|
||||||
|
|
||||||
|
option(SWIFT_ENABLE_VOLATILE
|
||||||
|
"Enable build of the Swift Volatile module"
|
||||||
|
FALSE)
|
||||||
|
|
||||||
option(SWIFT_ENABLE_DISPATCH
|
option(SWIFT_ENABLE_DISPATCH
|
||||||
"Enable use of libdispatch"
|
"Enable use of libdispatch"
|
||||||
TRUE)
|
TRUE)
|
||||||
@@ -1359,6 +1363,7 @@ if(SWIFT_BUILD_STDLIB OR SWIFT_BUILD_SDK_OVERLAY)
|
|||||||
message(STATUS "Unicode Support: ${SWIFT_STDLIB_ENABLE_UNICODE_DATA}")
|
message(STATUS "Unicode Support: ${SWIFT_STDLIB_ENABLE_UNICODE_DATA}")
|
||||||
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
|
message(STATUS "Observation Support: ${SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION}")
|
||||||
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
|
message(STATUS "Synchronization Support: ${SWIFT_ENABLE_SYNCHRONIZATION}")
|
||||||
|
message(STATUS "Volatile Support: ${SWIFT_ENABLE_VOLATILE}")
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
else()
|
else()
|
||||||
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
|
message(STATUS "Not building Swift standard library, SDK overlays, and runtime")
|
||||||
|
|||||||
@@ -330,6 +330,10 @@ function(_add_target_variant_swift_compile_flags
|
|||||||
list(APPEND result "-D" "SWIFT_ENABLE_SYNCHRONIZATION")
|
list(APPEND result "-D" "SWIFT_ENABLE_SYNCHRONIZATION")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SWIFT_ENABLE_VOLATILE)
|
||||||
|
list(APPEND result "-D" "SWIFT_ENABLE_VOLATILE")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SWIFT_STDLIB_OS_VERSIONING)
|
if(SWIFT_STDLIB_OS_VERSIONING)
|
||||||
list(APPEND result "-D" "SWIFT_RUNTIME_OS_VERSIONING")
|
list(APPEND result "-D" "SWIFT_RUNTIME_OS_VERSIONING")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -282,7 +282,9 @@ if(SWIFT_BUILD_STDLIB AND NOT SWIFT_STDLIB_BUILD_ONLY_CORE_MODULES)
|
|||||||
add_subdirectory(Synchronization)
|
add_subdirectory(Synchronization)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(Volatile)
|
if(SWIFT_ENABLE_VOLATILE)
|
||||||
|
add_subdirectory(Volatile)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SWIFT_BUILD_REMOTE_MIRROR)
|
if(SWIFT_BUILD_REMOTE_MIRROR)
|
||||||
|
|||||||
@@ -215,6 +215,7 @@ normalize_boolean_spelling(SWIFT_STDLIB_ENABLE_OBJC_INTEROP)
|
|||||||
normalize_boolean_spelling(SWIFT_ENABLE_BACKTRACING)
|
normalize_boolean_spelling(SWIFT_ENABLE_BACKTRACING)
|
||||||
normalize_boolean_spelling(SWIFT_BUILD_SWIFT_SYNTAX)
|
normalize_boolean_spelling(SWIFT_BUILD_SWIFT_SYNTAX)
|
||||||
normalize_boolean_spelling(SWIFT_ENABLE_SYNCHRONIZATION)
|
normalize_boolean_spelling(SWIFT_ENABLE_SYNCHRONIZATION)
|
||||||
|
normalize_boolean_spelling(SWIFT_ENABLE_VOLATILE)
|
||||||
normalize_boolean_spelling(SWIFT_BUILD_REMOTE_MIRROR)
|
normalize_boolean_spelling(SWIFT_BUILD_REMOTE_MIRROR)
|
||||||
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" SWIFT_OPTIMIZED)
|
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" SWIFT_OPTIMIZED)
|
||||||
|
|
||||||
@@ -433,6 +434,10 @@ foreach(SDK ${SWIFT_SDKS})
|
|||||||
list(APPEND LIT_ARGS "--param" "synchronization")
|
list(APPEND LIT_ARGS "--param" "synchronization")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(SWIFT_ENABLE_VOLATILE)
|
||||||
|
list(APPEND LIT_ARGS "--param" "volatile")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SWIFT_BUILD_REMOTE_MIRROR)
|
if(SWIFT_BUILD_REMOTE_MIRROR)
|
||||||
list(APPEND LIT_ARGS "--param" "remote_mirror")
|
list(APPEND LIT_ARGS "--param" "remote_mirror")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ if "@SWIFT_STDLIB_ENABLE_DEBUG_PRECONDITIONS_IN_RELEASE@" == "TRUE":
|
|||||||
config.available_features.add('swift_stdlib_debug_preconditions_in_release')
|
config.available_features.add('swift_stdlib_debug_preconditions_in_release')
|
||||||
if "@SWIFT_ENABLE_SYNCHRONIZATION@" == "TRUE":
|
if "@SWIFT_ENABLE_SYNCHRONIZATION@" == "TRUE":
|
||||||
config.available_features.add('synchronization')
|
config.available_features.add('synchronization')
|
||||||
|
if "@SWIFT_ENABLE_VOLATILE@" == "TRUE":
|
||||||
|
config.available_features.add('volatile')
|
||||||
if "@SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB@" == "TRUE":
|
if "@SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB@" == "TRUE":
|
||||||
config.available_features.add('embedded_stdlib')
|
config.available_features.add('embedded_stdlib')
|
||||||
|
|
||||||
|
|||||||
@@ -1345,6 +1345,7 @@ function Build-Compilers() {
|
|||||||
SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION = "YES";
|
SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION = "YES";
|
||||||
SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES";
|
SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES";
|
||||||
SWIFT_ENABLE_SYNCHRONIZATION = "YES";
|
SWIFT_ENABLE_SYNCHRONIZATION = "YES";
|
||||||
|
SWIFT_ENABLE_VOLATILE = "YES";
|
||||||
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
|
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
|
||||||
SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = "$SourceCache\swift-syntax";
|
SWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE = "$SourceCache\swift-syntax";
|
||||||
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
|
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
|
||||||
@@ -1594,6 +1595,7 @@ function Build-Runtime([Platform]$Platform, $Arch) {
|
|||||||
SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES";
|
SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING = "YES";
|
||||||
# FIXME: re-enable after https://github.com/apple/swift/issues/74186 is fixed.
|
# FIXME: re-enable after https://github.com/apple/swift/issues/74186 is fixed.
|
||||||
SWIFT_ENABLE_SYNCHRONIZATION = if (($Platform -eq "Android") -and ($Arch -eq $AndroidARMv7)) { "NO" } else { "YES" };
|
SWIFT_ENABLE_SYNCHRONIZATION = if (($Platform -eq "Android") -and ($Arch -eq $AndroidARMv7)) { "NO" } else { "YES" };
|
||||||
|
SWIFT_ENABLE_VOLATILE = "YES";
|
||||||
SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path -Path $CompilersBinaryCache -ChildPath "bin");
|
SWIFT_NATIVE_SWIFT_TOOLS_PATH = (Join-Path -Path $CompilersBinaryCache -ChildPath "bin");
|
||||||
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
|
SWIFT_PATH_TO_LIBDISPATCH_SOURCE = "$SourceCache\swift-corelibs-libdispatch";
|
||||||
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
|
SWIFT_PATH_TO_STRING_PROCESSING_SOURCE = "$SourceCache\swift-experimental-string-processing";
|
||||||
|
|||||||
@@ -1465,6 +1465,10 @@ def create_argument_parser():
|
|||||||
default=True,
|
default=True,
|
||||||
help='Enable Swift Synchronization.')
|
help='Enable Swift Synchronization.')
|
||||||
|
|
||||||
|
option('--enable-volatile', toggle_true,
|
||||||
|
default=True,
|
||||||
|
help='Enable Volatile module.')
|
||||||
|
|
||||||
option('--enable-experimental-parser-validation', toggle_true,
|
option('--enable-experimental-parser-validation', toggle_true,
|
||||||
default=False,
|
default=False,
|
||||||
help='Enable experimental Swift Parser validation by default.')
|
help='Enable experimental Swift Parser validation by default.')
|
||||||
|
|||||||
@@ -181,6 +181,7 @@ EXPECTED_DEFAULTS = {
|
|||||||
'enable_experimental_parser_validation': False,
|
'enable_experimental_parser_validation': False,
|
||||||
'swift_enable_backtracing': True,
|
'swift_enable_backtracing': True,
|
||||||
'enable_synchronization': True,
|
'enable_synchronization': True,
|
||||||
|
'enable_volatile': True,
|
||||||
'enable_lsan': False,
|
'enable_lsan': False,
|
||||||
'enable_sanitize_coverage': False,
|
'enable_sanitize_coverage': False,
|
||||||
'disable_guaranteed_normal_arguments': False,
|
'disable_guaranteed_normal_arguments': False,
|
||||||
@@ -622,6 +623,7 @@ EXPECTED_OPTIONS = [
|
|||||||
EnableOption('--export-compile-commands'),
|
EnableOption('--export-compile-commands'),
|
||||||
EnableOption('--swift-enable-backtracing'),
|
EnableOption('--swift-enable-backtracing'),
|
||||||
EnableOption('--enable-synchronization'),
|
EnableOption('--enable-synchronization'),
|
||||||
|
EnableOption('--enable-volatile'),
|
||||||
EnableOption('--foundation', dest='build_foundation'),
|
EnableOption('--foundation', dest='build_foundation'),
|
||||||
EnableOption('--host-test'),
|
EnableOption('--host-test'),
|
||||||
EnableOption('--only-executable-test'),
|
EnableOption('--only-executable-test'),
|
||||||
|
|||||||
@@ -108,6 +108,8 @@ def create_parser():
|
|||||||
help='Enable experimental observation.')
|
help='Enable experimental observation.')
|
||||||
parser.add_argument('--enable-synchronization', action='store_true',
|
parser.add_argument('--enable-synchronization', action='store_true',
|
||||||
help='Enable Synchronization.')
|
help='Enable Synchronization.')
|
||||||
|
parser.add_argument('--enable-volatile', action='store_true',
|
||||||
|
help='Enable Volatile.')
|
||||||
parser.add_argument('-swift-version', metavar='N',
|
parser.add_argument('-swift-version', metavar='N',
|
||||||
help='the Swift version to use')
|
help='the Swift version to use')
|
||||||
parser.add_argument('-show-overlay', action='store_true',
|
parser.add_argument('-show-overlay', action='store_true',
|
||||||
|
|||||||
@@ -72,6 +72,9 @@ class Swift(product.Product):
|
|||||||
# Add synchronization flag.
|
# Add synchronization flag.
|
||||||
self.cmake_options.extend(self._enable_synchronization)
|
self.cmake_options.extend(self._enable_synchronization)
|
||||||
|
|
||||||
|
# Add volatile flag.
|
||||||
|
self.cmake_options.extend(self._enable_volatile)
|
||||||
|
|
||||||
# Add static vprintf flag
|
# Add static vprintf flag
|
||||||
self.cmake_options.extend(self._enable_stdlib_static_vprintf)
|
self.cmake_options.extend(self._enable_stdlib_static_vprintf)
|
||||||
|
|
||||||
@@ -219,6 +222,11 @@ updated without updating swift.py?")
|
|||||||
return [('SWIFT_ENABLE_SYNCHRONIZATION:BOOL',
|
return [('SWIFT_ENABLE_SYNCHRONIZATION:BOOL',
|
||||||
self.args.enable_synchronization)]
|
self.args.enable_synchronization)]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _enable_volatile(self):
|
||||||
|
return [('SWIFT_ENABLE_VOLATILE:BOOL',
|
||||||
|
self.args.enable_volatile)]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def _enable_stdlib_static_vprintf(self):
|
def _enable_stdlib_static_vprintf(self):
|
||||||
return [('SWIFT_STDLIB_STATIC_PRINT',
|
return [('SWIFT_STDLIB_STATIC_PRINT',
|
||||||
|
|||||||
@@ -110,6 +110,7 @@ class WasmStdlib(cmake_product.CMakeProduct):
|
|||||||
'swift-experimental-string-processing'))
|
'swift-experimental-string-processing'))
|
||||||
self.cmake_options.define('SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL', 'TRUE')
|
self.cmake_options.define('SWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP:BOOL', 'TRUE')
|
||||||
self.cmake_options.define('SWIFT_ENABLE_SYNCHRONIZATION:BOOL', 'TRUE')
|
self.cmake_options.define('SWIFT_ENABLE_SYNCHRONIZATION:BOOL', 'TRUE')
|
||||||
|
self.cmake_options.define('SWIFT_ENABLE_VOLATILE:BOOL', 'TRUE')
|
||||||
self.cmake_options.define('SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL', 'TRUE')
|
self.cmake_options.define('SWIFT_ENABLE_EXPERIMENTAL_OBSERVATION:BOOL', 'TRUE')
|
||||||
|
|
||||||
self.add_extra_cmake_options()
|
self.add_extra_cmake_options()
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class SwiftTestCase(unittest.TestCase):
|
|||||||
enable_experimental_parser_validation=False,
|
enable_experimental_parser_validation=False,
|
||||||
swift_enable_backtracing=False,
|
swift_enable_backtracing=False,
|
||||||
enable_synchronization=False,
|
enable_synchronization=False,
|
||||||
|
enable_volatile=False,
|
||||||
build_early_swiftsyntax=False,
|
build_early_swiftsyntax=False,
|
||||||
build_swift_stdlib_static_print=False,
|
build_swift_stdlib_static_print=False,
|
||||||
build_swift_stdlib_unicode_data=True,
|
build_swift_stdlib_unicode_data=True,
|
||||||
@@ -109,6 +110,7 @@ class SwiftTestCase(unittest.TestCase):
|
|||||||
'-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE',
|
'-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE',
|
||||||
'-DSWIFT_ENABLE_BACKTRACING:BOOL=FALSE',
|
'-DSWIFT_ENABLE_BACKTRACING:BOOL=FALSE',
|
||||||
'-DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=FALSE',
|
'-DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=FALSE',
|
||||||
|
'-DSWIFT_ENABLE_VOLATILE:BOOL=FALSE',
|
||||||
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
|
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
|
||||||
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
||||||
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
||||||
@@ -140,6 +142,7 @@ class SwiftTestCase(unittest.TestCase):
|
|||||||
'-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE',
|
'-DSWIFT_ENABLE_EXPERIMENTAL_PARSER_VALIDATION:BOOL=FALSE',
|
||||||
'-DSWIFT_ENABLE_BACKTRACING:BOOL=FALSE',
|
'-DSWIFT_ENABLE_BACKTRACING:BOOL=FALSE',
|
||||||
'-DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=FALSE',
|
'-DSWIFT_ENABLE_SYNCHRONIZATION:BOOL=FALSE',
|
||||||
|
'-DSWIFT_ENABLE_VOLATILE:BOOL=FALSE',
|
||||||
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
|
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
|
||||||
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
|
||||||
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
'-DSWIFT_STDLIB_BUILD_PRIVATE:BOOL=TRUE',
|
||||||
@@ -461,6 +464,19 @@ class SwiftTestCase(unittest.TestCase):
|
|||||||
[x for x in swift.cmake_options
|
[x for x in swift.cmake_options
|
||||||
if 'DSWIFT_ENABLE_SYNCHRONIZATION' in x])
|
if 'DSWIFT_ENABLE_SYNCHRONIZATION' in x])
|
||||||
|
|
||||||
|
def test_volatile_flags(self):
|
||||||
|
self.args.enable_volatile = True
|
||||||
|
swift = Swift(
|
||||||
|
args=self.args,
|
||||||
|
toolchain=self.toolchain,
|
||||||
|
source_dir='/path/to/src',
|
||||||
|
build_dir='/path/to/build')
|
||||||
|
self.assertEqual(
|
||||||
|
['-DSWIFT_ENABLE_VOLATILE:BOOL='
|
||||||
|
'TRUE'],
|
||||||
|
[x for x in swift.cmake_options
|
||||||
|
if 'DSWIFT_ENABLE_VOLATILE' in x])
|
||||||
|
|
||||||
def test_freestanding_is_darwin_flags(self):
|
def test_freestanding_is_darwin_flags(self):
|
||||||
self.args.swift_freestanding_is_darwin = True
|
self.args.swift_freestanding_is_darwin = True
|
||||||
swift = Swift(
|
swift = Swift(
|
||||||
|
|||||||
Reference in New Issue
Block a user