[K/N] Add -Xforce-compiler-driver=(static, dynamic) flag
Useful for development purposes when one wants to compare the outputs of different drivers.
This commit is contained in:
committed by
Space Team
parent
6ef4277d89
commit
d7fff3ca01
@@ -370,6 +370,7 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
||||
arguments.testDumpOutputPath?.let { put(TEST_DUMP_OUTPUT_PATH, it) }
|
||||
put(PARTIAL_LINKAGE, arguments.partialLinkage)
|
||||
put(OMIT_FRAMEWORK_BINARY, arguments.omitFrameworkBinary)
|
||||
putIfNotNull(FORCE_COMPILER_DRIVER, arguments.forceCompilerDriver)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -177,6 +177,7 @@ class KonanConfigKeys {
|
||||
val PARTIAL_LINKAGE: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("allows some symbols in klibs be missed")
|
||||
val TEST_DUMP_OUTPUT_PATH: CompilerConfigurationKey<String?> = CompilerConfigurationKey.create("path to a file to dump the list of all available tests")
|
||||
val OMIT_FRAMEWORK_BINARY: CompilerConfigurationKey<Boolean> = CompilerConfigurationKey.create("do not generate binary in framework")
|
||||
val FORCE_COMPILER_DRIVER: CompilerConfigurationKey<String?> = CompilerConfigurationKey.create("explicitly pick compiler driver")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-2
@@ -38,7 +38,7 @@ class KonanDriver(val project: Project, val environment: KotlinCoreEnvironment,
|
||||
|
||||
val konanConfig = KonanConfig(project, configuration)
|
||||
ensureModuleName(konanConfig)
|
||||
pickCompilerDriver().run(konanConfig, environment)
|
||||
pickCompilerDriver(konanConfig).run(konanConfig, environment)
|
||||
}
|
||||
|
||||
private fun ensureModuleName(config: KonanConfig) {
|
||||
@@ -53,7 +53,14 @@ class KonanDriver(val project: Project, val environment: KotlinCoreEnvironment,
|
||||
}
|
||||
}
|
||||
|
||||
private fun pickCompilerDriver(): CompilerDriver {
|
||||
private fun pickCompilerDriver(config: KonanConfig): CompilerDriver {
|
||||
config.configuration[KonanConfigKeys.FORCE_COMPILER_DRIVER]?.let {
|
||||
return when (it) {
|
||||
"dynamic" -> DynamicCompilerDriver()
|
||||
"static" -> StaticCompilerDriver()
|
||||
else -> error("Unknown compiler driver. Possible values: dynamic, static")
|
||||
}
|
||||
}
|
||||
// Dynamic driver is WIP, so it might not support all possible configurations.
|
||||
return if (DynamicCompilerDriver.supportsConfig()) {
|
||||
DynamicCompilerDriver()
|
||||
|
||||
Reference in New Issue
Block a user