mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-05 09:31:03 +03:00
Export LDC_RuntimeCompilation version when runtime compilation is enabled
This commit is contained in:
parent
0ef4edb0fb
commit
482b822d73
4 changed files with 18 additions and 1 deletions
|
@ -946,6 +946,10 @@ void registerPredefinedVersions() {
|
|||
VersionCondition::addPredefinedGlobalIdent("D_ObjectiveC");
|
||||
}
|
||||
|
||||
if (global.params.enableRuntimeCompile) {
|
||||
VersionCondition::addPredefinedGlobalIdent("LDC_RuntimeCompilation");
|
||||
}
|
||||
|
||||
// Define sanitizer versions.
|
||||
if (opts::isSanitizerEnabled(opts::AddressSanitizer)) {
|
||||
VersionCondition::addPredefinedGlobalIdent("LDC_AddressSanitizer");
|
||||
|
|
|
@ -53,7 +53,7 @@ if(LDC_RUNTIME_COMPILE)
|
|||
|
||||
set(jitrt_d_o "")
|
||||
set(jitrt_d_bc "")
|
||||
compile_jit_rt_D("${d_flags}" "" "${path_suffix}" "${COMPILE_ALL_D_FILES_AT_ONCE}" jitrt_d_o jitrt_d_bc)
|
||||
compile_jit_rt_D("-enable-runtime-compile;${d_flags}" "" "${path_suffix}" "${COMPILE_ALL_D_FILES_AT_ONCE}" jitrt_d_o jitrt_d_bc)
|
||||
|
||||
add_library(ldc-jit-rt${target_suffix} STATIC ${jitrt_d_o} ${LDC_JITRT_CXX})
|
||||
set_target_properties(
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
module ldc.runtimecompile;
|
||||
|
||||
version(LDC_RuntimeCompilation)
|
||||
{
|
||||
|
||||
struct CompilerSettings
|
||||
{
|
||||
uint optLevel = 0;
|
||||
|
@ -69,3 +72,5 @@ align(1):
|
|||
}
|
||||
extern void rtCompileProcessImpl(const ref Context context, size_t contextSize);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,14 @@ import std.stdio;
|
|||
import ldc.attributes;
|
||||
import ldc.runtimecompile;
|
||||
|
||||
version(LDC_RuntimeCompilation)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
static assert(false, "LDC_RuntimeCompilation is not defined");
|
||||
}
|
||||
|
||||
@runtimeCompile int foo()
|
||||
{
|
||||
return 5;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue