NimScript: added buildOS and buildCPU constants
This commit is contained in:
parent
ae7fe5087f
commit
5298a72f34
3 changed files with 12 additions and 1 deletions
|
|
@ -631,7 +631,7 @@ type
|
||||||
mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc,
|
mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc,
|
||||||
mVoidType, mPNimrodNode, mShared, mGuarded, mLock, mSpawn, mDeepCopy,
|
mVoidType, mPNimrodNode, mShared, mGuarded, mLock, mSpawn, mDeepCopy,
|
||||||
mIsMainModule, mCompileDate, mCompileTime, mProcCall,
|
mIsMainModule, mCompileDate, mCompileTime, mProcCall,
|
||||||
mCpuEndian, mHostOS, mHostCPU, mAppType,
|
mCpuEndian, mHostOS, mHostCPU, mBuildOS, mBuildCPU, mAppType,
|
||||||
mNaN, mInf, mNegInf,
|
mNaN, mInf, mNegInf,
|
||||||
mCompileOption, mCompileOptionArg,
|
mCompileOption, mCompileOptionArg,
|
||||||
mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, mNKind,
|
mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, mNKind,
|
||||||
|
|
|
||||||
|
|
@ -616,6 +616,8 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
|
||||||
of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
|
of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
|
||||||
of mHostOS: result = newStrNodeT(toLowerAscii(platform.OS[targetOS].name), n)
|
of mHostOS: result = newStrNodeT(toLowerAscii(platform.OS[targetOS].name), n)
|
||||||
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLowerAscii, n)
|
of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLowerAscii, n)
|
||||||
|
of mBuildOS: result = newStrNodeT(toLowerAscii(platform.OS[platform.hostOS].name), n)
|
||||||
|
of mBuildCPU: result = newStrNodeT(platform.CPU[platform.hostCPU].name.toLowerAscii, n)
|
||||||
of mAppType: result = getAppType(n)
|
of mAppType: result = getAppType(n)
|
||||||
of mNaN: result = newFloatNodeT(NaN, n)
|
of mNaN: result = newFloatNodeT(NaN, n)
|
||||||
of mInf: result = newFloatNodeT(Inf, n)
|
of mInf: result = newFloatNodeT(Inf, n)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,15 @@
|
||||||
# Nim's configuration system now uses Nim for scripting. This module provides
|
# Nim's configuration system now uses Nim for scripting. This module provides
|
||||||
# a few things that are required for this to work.
|
# a few things that are required for this to work.
|
||||||
|
|
||||||
|
const
|
||||||
|
buildOS* {.magic: "BuildOS".}: string = ""
|
||||||
|
## The OS this build is running on. Can be different from ``system.hostOS``
|
||||||
|
## for cross compilations.
|
||||||
|
|
||||||
|
buildCPU* {.magic: "BuildCPU".}: string = ""
|
||||||
|
## The CPU this build is running on. Can be different from ``system.hostCPU``
|
||||||
|
## for cross compilations.
|
||||||
|
|
||||||
template builtin = discard
|
template builtin = discard
|
||||||
|
|
||||||
# We know the effects better than the compiler:
|
# We know the effects better than the compiler:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue