mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Added Android support, and generalized target triple support
Added PICLevel, RelocKind DarwinCommon/LinuxCommon/AndroidCommon merged into PosixCommon Mangling changed to avoid '@'
This commit is contained in:
parent
7a27ab75bf
commit
3883a3674d
39 changed files with 3457 additions and 5636 deletions
|
@ -33,7 +33,7 @@ BF_IMPORT void BF_CALLTYPE IDEHelper_ProgramStart();
|
||||||
BF_IMPORT void BF_CALLTYPE IDEHelper_ProgramDone();
|
BF_IMPORT void BF_CALLTYPE IDEHelper_ProgramDone();
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
#ifdef TEST_CRASH
|
#ifdef TEST_CRASH
|
||||||
CrashCatcher catcher;
|
CrashCatcher catcher;
|
||||||
catcher.SetCrashReportKind(BfpCrashReportKind_GUI);
|
catcher.SetCrashReportKind(BfpCrashReportKind_GUI);
|
||||||
|
|
|
@ -57,7 +57,7 @@ BF_IMPORT void BF_CALLTYPE BfSystem_AddTypeOptions(void* bfSystem, const char* f
|
||||||
|
|
||||||
BF_IMPORT void BF_CALLTYPE BfProject_SetDisabled(void* bfProject, bool disabled);
|
BF_IMPORT void BF_CALLTYPE BfProject_SetDisabled(void* bfProject, bool disabled);
|
||||||
BF_IMPORT void BF_CALLTYPE BfProject_SetOptions(void* bfProject, int targetType, const char* startupObject, const char* preprocessorMacros,
|
BF_IMPORT void BF_CALLTYPE BfProject_SetOptions(void* bfProject, int targetType, const char* startupObject, const char* preprocessorMacros,
|
||||||
int optLevel, int ltoType, int32 flags);
|
int optLevel, int ltoType, int relocType, int picLevel, int32 flags);
|
||||||
BF_IMPORT void BF_CALLTYPE BfProject_ClearDependencies(void* bfProject);
|
BF_IMPORT void BF_CALLTYPE BfProject_ClearDependencies(void* bfProject);
|
||||||
BF_IMPORT void BF_CALLTYPE BfProject_AddDependency(void* bfProject, void* depProject);
|
BF_IMPORT void BF_CALLTYPE BfProject_AddDependency(void* bfProject, void* depProject);
|
||||||
|
|
||||||
|
@ -795,7 +795,7 @@ bool BootApp::Compile()
|
||||||
mCELibProject = BfSystem_CreateProject(mSystem, "BeefLib");
|
mCELibProject = BfSystem_CreateProject(mSystem, "BeefLib");
|
||||||
|
|
||||||
BfProjectFlags flags = BfProjectFlags_None;
|
BfProjectFlags flags = BfProjectFlags_None;
|
||||||
BfProject_SetOptions(mCELibProject, BfTargetType_BeefLib, "", mDefines.c_str(), mOptLevel, 0, flags);
|
BfProject_SetOptions(mCELibProject, BfTargetType_BeefLib, "", mDefines.c_str(), mOptLevel, 0, 0, 0, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mDefines.IsEmpty())
|
if (!mDefines.IsEmpty())
|
||||||
|
@ -815,7 +815,7 @@ bool BootApp::Compile()
|
||||||
else if (mAsmKind == BfAsmKind_Intel)
|
else if (mAsmKind == BfAsmKind_Intel)
|
||||||
flags = (BfProjectFlags)(flags | BfProjectFlags_AsmOutput);
|
flags = (BfProjectFlags)(flags | BfProjectFlags_AsmOutput);
|
||||||
}
|
}
|
||||||
BfProject_SetOptions(mProject, mTargetType, mStartupObject.c_str(), mDefines.c_str(), mOptLevel, ltoType, flags);
|
BfProject_SetOptions(mProject, mTargetType, mStartupObject.c_str(), mDefines.c_str(), mOptLevel, ltoType, 0, 0, flags);
|
||||||
|
|
||||||
if (mCELibProject != NULL)
|
if (mCELibProject != NULL)
|
||||||
BfProject_AddDependency(mProject, mCELibProject);
|
BfProject_AddDependency(mProject, mCELibProject);
|
||||||
|
|
|
@ -20,7 +20,7 @@ TargetName = "$(ProjectName)_d"
|
||||||
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib Rpcrt4.lib Ole32.lib"
|
OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib Rpcrt4.lib Ole32.lib"
|
||||||
CLibType = "Dynamic"
|
CLibType = "Dynamic"
|
||||||
BeefLibType = "DynamicDebug"
|
BeefLibType = "DynamicDebug"
|
||||||
DebugCommandArguments = "--version"
|
DebugCommandArguments = "-platform=x86_64-none-linux-android21 -workspace=C:/proj/Android/BeefTest/app/src/main/cpp/../beef/\""
|
||||||
DebugWorkingDirectory = "c:\\beef\\ide\\mintest"
|
DebugWorkingDirectory = "c:\\beef\\ide\\mintest"
|
||||||
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
|
EnvironmentVars = ["_NO_DEBUG_HEAP=1"]
|
||||||
PreprocessorMacros = ["DEBUG", "CLI"]
|
PreprocessorMacros = ["DEBUG", "CLI"]
|
||||||
|
@ -34,15 +34,6 @@ DebugCommandArguments = "-proddir=..\\ -config=Debug -platform=Win64"
|
||||||
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
PreprocessorMacros = ["DEBUG", "CLI"]
|
PreprocessorMacros = ["DEBUG", "CLI"]
|
||||||
|
|
||||||
[Configs.Release.macOS]
|
|
||||||
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
|
||||||
OtherLinkFlags = "./libBeefRT.dylib ./libIDEHelper.dylib ./libBeefySysLib.dylib ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDemangle.a -Wl,-rpath -Wl,."
|
|
||||||
CLibType = "Dynamic"
|
|
||||||
DebugCommandArguments = "-proddir=..\\ -config=Debug -platform=Win64"
|
|
||||||
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
|
||||||
PreprocessorMacros = ["CLI"]
|
|
||||||
|
|
||||||
|
|
||||||
[Configs.Debug.Linux64]
|
[Configs.Debug.Linux64]
|
||||||
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
TargetName = "$(ProjectName)_d"
|
TargetName = "$(ProjectName)_d"
|
||||||
|
@ -52,6 +43,14 @@ DebugCommandArguments = "-proddir=..\\ -config=Debug -platform=Win64"
|
||||||
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
PreprocessorMacros = ["DEBUG", "CLI"]
|
PreprocessorMacros = ["DEBUG", "CLI"]
|
||||||
|
|
||||||
|
[Configs.Release.macOS]
|
||||||
|
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
|
OtherLinkFlags = "./libBeefRT.dylib ./libIDEHelper.dylib ./libBeefySysLib.dylib ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDemangle.a -Wl,-rpath -Wl,."
|
||||||
|
CLibType = "Dynamic"
|
||||||
|
DebugCommandArguments = "-proddir=..\\ -config=Debug -platform=Win64"
|
||||||
|
DebugWorkingDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
|
PreprocessorMacros = ["CLI"]
|
||||||
|
|
||||||
[Configs.Release.Linux64]
|
[Configs.Release.Linux64]
|
||||||
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
TargetDirectory = "$(WorkspaceDir)/../IDE/dist"
|
||||||
OtherLinkFlags = "./libBeefRT.so ./libIDEHelper.so ./libBeefySysLib.so ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDemangle.a -ltinfo -Wl,-rpath -Wl,$ORIGIN"
|
OtherLinkFlags = "./libBeefRT.so ./libIDEHelper.so ./libBeefySysLib.so ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCore.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMC.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMCodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Disassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMMCDisassembler.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSupport.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Info.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Utils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86Desc.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMObject.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitReader.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTarget.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86CodeGen.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMScalarOpts.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstCombine.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMSelectionDAG.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMProfileData.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMTransformUtils.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAnalysis.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMX86AsmParser.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMAsmPrinter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBitWriter.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMVectorize.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMipo.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMInstrumentation.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoDWARF.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoPDB.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDebugInfoCodeView.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMGlobalISel.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMBinaryFormat.a ../../extern/llvm_linux_rel_8_0_0/lib/libLLVMDemangle.a -ltinfo -Wl,-rpath -Wl,$ORIGIN"
|
||||||
|
|
|
@ -50,6 +50,68 @@ if (${APPLE})
|
||||||
|
|
||||||
../BeefySysLib/platform/osx
|
../BeefySysLib/platform/osx
|
||||||
)
|
)
|
||||||
|
elseif (${ANDROID})
|
||||||
|
if (ANDROID_ABI STREQUAL "x86")
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../BeefySysLib/
|
||||||
|
../BeefySysLib/third_party
|
||||||
|
../BeefySysLib/third_party/freetype/include
|
||||||
|
../BeefySysLib/third_party/libffi/i686-pc-linux-gnu/include
|
||||||
|
../
|
||||||
|
../extern
|
||||||
|
../extern/llvm/include
|
||||||
|
../extern/llvm_linux/include
|
||||||
|
../extern/llvm/lib/Target
|
||||||
|
|
||||||
|
../BeefySysLib/platform/android
|
||||||
|
)
|
||||||
|
elseif (ANDROID_ABI STREQUAL "x86_64")
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../BeefySysLib/
|
||||||
|
../BeefySysLib/third_party
|
||||||
|
../BeefySysLib/third_party/freetype/include
|
||||||
|
../BeefySysLib/third_party/libffi/x86_64-pc-linux-gnu/include
|
||||||
|
../
|
||||||
|
../extern
|
||||||
|
../extern/llvm/include
|
||||||
|
../extern/llvm_linux/include
|
||||||
|
../extern/llvm/lib/Target
|
||||||
|
|
||||||
|
../BeefySysLib/platform/android
|
||||||
|
)
|
||||||
|
elseif (ANDROID_ABI STREQUAL "armeabi-v7a")
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../BeefySysLib/
|
||||||
|
../BeefySysLib/third_party
|
||||||
|
../BeefySysLib/third_party/freetype/include
|
||||||
|
../BeefySysLib/third_party/libffi/arm-unknown-linux-gnu/include
|
||||||
|
../
|
||||||
|
../extern
|
||||||
|
../extern/llvm/include
|
||||||
|
../extern/llvm_linux/include
|
||||||
|
../extern/llvm/lib/Target
|
||||||
|
|
||||||
|
../BeefySysLib/platform/android
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
include_directories(
|
||||||
|
.
|
||||||
|
../BeefySysLib/
|
||||||
|
../BeefySysLib/third_party
|
||||||
|
../BeefySysLib/third_party/freetype/include
|
||||||
|
../BeefySysLib/third_party/libffi/aarch64-unknown-linux-gnu/include
|
||||||
|
../
|
||||||
|
../extern
|
||||||
|
../extern/llvm/include
|
||||||
|
../extern/llvm_linux/include
|
||||||
|
../extern/llvm/lib/Target
|
||||||
|
|
||||||
|
../BeefySysLib/platform/android
|
||||||
|
)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
|
@ -135,6 +197,7 @@ file(GLOB SRC_FILES
|
||||||
../BeefySysLib/util/BeefPerf.cpp
|
../BeefySysLib/util/BeefPerf.cpp
|
||||||
../BeefySysLib/util/String.cpp
|
../BeefySysLib/util/String.cpp
|
||||||
../BeefySysLib/util/UTF8.cpp
|
../BeefySysLib/util/UTF8.cpp
|
||||||
|
../BeefySysLib/util/Hash.cpp
|
||||||
../BeefySysLib/third_party/utf8proc/utf8proc.c
|
../BeefySysLib/third_party/utf8proc/utf8proc.c
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -143,6 +206,11 @@ if (${APPLE})
|
||||||
../BeefySysLib/platform/darwin/BFPlatform.cpp
|
../BeefySysLib/platform/darwin/BFPlatform.cpp
|
||||||
../BeefySysLib/platform/darwin/DarwinCommon.cpp
|
../BeefySysLib/platform/darwin/DarwinCommon.cpp
|
||||||
)
|
)
|
||||||
|
elseif (${ANDROID})
|
||||||
|
file(GLOB SRC_FILES_OS
|
||||||
|
../BeefySysLib/platform/android/BFPlatform.cpp
|
||||||
|
../BeefySysLib/platform/android/AndroidCommon.cpp
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
file(GLOB SRC_FILES_OS
|
file(GLOB SRC_FILES_OS
|
||||||
../BeefySysLib/platform/linux/BFPlatform.cpp
|
../BeefySysLib/platform/linux/BFPlatform.cpp
|
||||||
|
@ -151,15 +219,19 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Add library to build.
|
# Add library to build.
|
||||||
add_library(${PROJECT_NAME} SHARED
|
add_library(${PROJECT_NAME} STATIC
|
||||||
${SRC_FILES}
|
${SRC_FILES}
|
||||||
${SRC_FILES_OS}
|
${SRC_FILES_OS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (${APPLE})
|
if (${APPLE})
|
||||||
set(TARGET_LIBS_OS "")
|
target_link_libraries(${PROJECT_NAME} pthread ffi)
|
||||||
|
elseif (${ANDROID})
|
||||||
|
set(TARGET_LIBS_OS "")
|
||||||
|
#target_link_libraries(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../BeefySysLib/third_party/libffi/aarch64-unknown-linux-gnu/.libs/libffi.a)
|
||||||
|
#target_link_libraries(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../BeefySysLib/third_party/libffi/i686-pc-linux-gnu/.libs/libffi.a)
|
||||||
else()
|
else()
|
||||||
set(TARGET_LIBS_OS "backtrace")
|
target_link_libraries(${PROJECT_NAME} pthread ffi backtrace)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Link with other dependencies.
|
# Link with other dependencies.
|
||||||
|
@ -167,6 +239,8 @@ if(MSVC)
|
||||||
target_link_libraries(${PROJECT_NAME} BeefySysLib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LLVMX86Disassembler.lib LLVMMCDisassembler.lib LLVMSupport.lib LLVMX86Info.lib LLVMX86Utils.lib LLVMX86AsmPrinter.lib LLVMX86Desc.lib %(AdditionalDependencies) LLVMMC.lib LLVMObject.lib LLVMCore.lib LLVMBitReader.lib LLVMAsmParser.lib LLVMMCParser.lib LLVMCodeGen.lib LLVMTarget.lib LLVMX86CodeGen.lib LLVMScalarOpts.lib LLVMInstCombine.lib LLVMSelectionDAG.lib LLVMProfileData.lib LLVMTransformUtils.lib LLVMAnalysis.lib LLVMX86AsmParser.lib LLVMAsmPrinter.lib LLVMBitWriter.lib LLVMVectorize.lib LLVMipo.lib LLVMInstrumentation.lib LLVMDebugInfoDWARF.lib LLVMDebugInfoPDB.lib LLVMDebugInfoCodeView.lib LLVMGlobalISel.lib LLVMBinaryFormat.lib libcurl_a.lib)
|
target_link_libraries(${PROJECT_NAME} BeefySysLib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib LLVMX86Disassembler.lib LLVMMCDisassembler.lib LLVMSupport.lib LLVMX86Info.lib LLVMX86Utils.lib LLVMX86AsmPrinter.lib LLVMX86Desc.lib %(AdditionalDependencies) LLVMMC.lib LLVMObject.lib LLVMCore.lib LLVMBitReader.lib LLVMAsmParser.lib LLVMMCParser.lib LLVMCodeGen.lib LLVMTarget.lib LLVMX86CodeGen.lib LLVMScalarOpts.lib LLVMInstCombine.lib LLVMSelectionDAG.lib LLVMProfileData.lib LLVMTransformUtils.lib LLVMAnalysis.lib LLVMX86AsmParser.lib LLVMAsmPrinter.lib LLVMBitWriter.lib LLVMVectorize.lib LLVMipo.lib LLVMInstrumentation.lib LLVMDebugInfoDWARF.lib LLVMDebugInfoPDB.lib LLVMDebugInfoCodeView.lib LLVMGlobalISel.lib LLVMBinaryFormat.lib libcurl_a.lib)
|
||||||
else()
|
else()
|
||||||
set(LLVM_LIB "${CMAKE_CURRENT_SOURCE_DIR}/../extern/llvm_linux/lib")
|
set(LLVM_LIB "${CMAKE_CURRENT_SOURCE_DIR}/../extern/llvm_linux/lib")
|
||||||
target_link_libraries(${PROJECT_NAME} BeefySysLib pthread dl ffi ${TARGET_LIBS_OS}
|
target_link_libraries(${PROJECT_NAME} dl
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
#pthread ffi
|
|
@ -230,9 +230,9 @@ void SetErrorString(const char* str)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
const char* prevStr = gErrorString;
|
const char* prevStr = gErrorString;
|
||||||
auto result = ::InterlockedCompareExchangePointer((void* volatile*)&gErrorString, (void*)newStr, (void*)prevStr);
|
auto result = (void*)BfpSystem_InterlockedCompareExchangePtr((uintptr*)&gErrorString, (uintptr)prevStr, (uintptr)newStr);
|
||||||
if (result != prevStr)
|
if (result != prevStr)
|
||||||
continue;
|
continue;
|
||||||
if (prevStr != NULL)
|
if (prevStr != NULL)
|
||||||
free((void*)prevStr);
|
free((void*)prevStr);
|
||||||
break;
|
break;
|
||||||
|
|
8
BeefySysLib/platform/android/AndroidCommon.cpp
Normal file
8
BeefySysLib/platform/android/AndroidCommon.cpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#include <android/log.h>
|
||||||
|
|
||||||
|
#define BFP_PRINTF(...) __android_log_print(ANDROID_LOG_INFO, "Beef", __VA_ARGS__)
|
||||||
|
#define BFP_ERRPRINTF(...) __android_log_print(ANDROID_LOG_ERROR, "Beef", __VA_ARGS__)
|
||||||
|
|
||||||
|
#define BFP_HAS_PTHREAD_GETATTR_NP
|
||||||
|
|
||||||
|
#include "../posix/PosixCommon.cpp"
|
159
BeefySysLib/platform/android/AndroidCommon.h
Normal file
159
BeefySysLib/platform/android/AndroidCommon.h
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __LP64__
|
||||||
|
#define BF64
|
||||||
|
#else
|
||||||
|
#define BF32
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BOOST_DETAIL_NO_CONTAINER_FWD
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
//#include <libkern/OSAtomic.h>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
//#define offsetof(type, member) __builtin_offsetof (type, member)
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
//#define FFI_BUILDING
|
||||||
|
//#include "third_party/libffi/x86_64-apple-darwin12.5.0/include/ffi.h"
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BF_ENDIAN_LITTLE
|
||||||
|
|
||||||
|
#define _NOEXCEPT noexcept
|
||||||
|
#define NTAPI
|
||||||
|
|
||||||
|
//#define FFI_STDCALL FFI_DEFAULT_ABI
|
||||||
|
//#define FFI_THISCALL FFI_DEFAULT_ABI
|
||||||
|
//#define FFI_FASTCALL FFI_DEFAULT_ABI
|
||||||
|
|
||||||
|
#define INVALID_SOCKET -1
|
||||||
|
|
||||||
|
typedef uint64_t uint64;
|
||||||
|
typedef uint32_t uint32;
|
||||||
|
typedef uint16_t uint16;
|
||||||
|
typedef uint8_t uint8;
|
||||||
|
typedef int64_t int64;
|
||||||
|
typedef int32_t int32;
|
||||||
|
typedef int16_t int16;
|
||||||
|
typedef int8_t int8;
|
||||||
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
//#define BF_PLATFORM_SDL
|
||||||
|
|
||||||
|
#define NOP
|
||||||
|
//#define BF_NOTHROW throw ()
|
||||||
|
//#define BF_NOTHROW noexcept
|
||||||
|
#define BF_NOTHROW
|
||||||
|
|
||||||
|
#ifdef BF64
|
||||||
|
typedef int64 intptr;
|
||||||
|
typedef uint64 uintptr;
|
||||||
|
#else
|
||||||
|
typedef int32 intptr;
|
||||||
|
typedef uint32 uintptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef wchar_t* BSTR;
|
||||||
|
typedef int HRESULT;
|
||||||
|
typedef uint8 BYTE;
|
||||||
|
typedef uint16 WORD;
|
||||||
|
typedef uint32 DWORD;
|
||||||
|
typedef int32 LONG;
|
||||||
|
|
||||||
|
typedef pthread_key_t BFTlsKey;
|
||||||
|
typedef pthread_t BF_THREADID;
|
||||||
|
typedef pthread_t BF_THREADHANDLE;
|
||||||
|
|
||||||
|
#define BF_HAS_TLS_DECLSPEC
|
||||||
|
#define BF_TLS_DECLSPEC thread_local
|
||||||
|
|
||||||
|
//:int64 abs(int64 val);
|
||||||
|
|
||||||
|
#define _stricmp stricmp
|
||||||
|
#define strnicmp strncasecmp
|
||||||
|
|
||||||
|
struct IID
|
||||||
|
{
|
||||||
|
unsigned long Data1;
|
||||||
|
unsigned short Data2;
|
||||||
|
unsigned short Data3;
|
||||||
|
unsigned char Data4[ 8 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void* HANDLE;
|
||||||
|
typedef void* HMODULE;
|
||||||
|
|
||||||
|
// We only need the stdcall attribute for x32?
|
||||||
|
//#define BFSTDCALL __attribute__((stdcall))
|
||||||
|
|
||||||
|
//#include "../notwin/NotWin.h"
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define _DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NOT_IMPL throw "Unimplemented";
|
||||||
|
|
||||||
|
//ARM
|
||||||
|
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
#define BF_FULL_MEMORY_FENCE() __asm__ __volatile__("mfence": : :"memory")
|
||||||
|
#define BF_SPINWAIT_NOP() __asm__ volatile ("pause\n" : : : "memory" );
|
||||||
|
#else
|
||||||
|
#define BF_FULL_MEMORY_FENCE() __sync_synchronize()
|
||||||
|
#define BF_SPINWAIT_NOP() ((void) 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BF_COMPILER_FENCE() __asm__ __volatile__("": : :"memory")
|
||||||
|
#define BF_THREAD_YIELD() sched_yield()
|
||||||
|
|
||||||
|
#if defined _DEBUG || defined BF_DEBUG_ASSERTS
|
||||||
|
#define BF_ASSERT(_Expression) (void)( (!!(_Expression)) || (Beefy::BFFatalError(#_Expression, __FILE__, __LINE__), 0) )
|
||||||
|
#else
|
||||||
|
#define BF_ASSERT(_Expression) (void)(0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BF_ASSERT_REL(_Expression) (void)( (!!(_Expression)) || (Beefy::BFFatalError(#_Expression, __FILE__, __LINE__), 0) )
|
||||||
|
#define BF_FATAL(msg) (void) ((Beefy::BFFatalError(msg, __FILE__, __LINE__), 0) )
|
||||||
|
|
||||||
|
#if defined _DEBUG || defined BF_DEBUG_ASSERTS
|
||||||
|
#define BF_DBG_FATAL(msg) (void) ((Beefy::BFFatalError(msg, __FILE__, __LINE__), 0) )
|
||||||
|
#else
|
||||||
|
#define BF_DBG_FATAL(msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BF_NOINLINE __attribute__ ((noinline))
|
||||||
|
#define BF_NAKED
|
||||||
|
|
||||||
|
#define stricmp strcasecmp
|
||||||
|
#define _alloca alloca
|
||||||
|
|
||||||
|
#define DIR_SEP_CHAR '/'
|
||||||
|
#define DIR_SEP_CHAR_ALT '\\'
|
||||||
|
|
||||||
|
static char* itoa(int value, char* str, int base)
|
||||||
|
{
|
||||||
|
if (base == 16)
|
||||||
|
sprintf(str, "%X", value);
|
||||||
|
else
|
||||||
|
sprintf(str, "%d", value);
|
||||||
|
return str;
|
||||||
|
}
|
13
BeefySysLib/platform/android/BFPlatform.cpp
Normal file
13
BeefySysLib/platform/android/BFPlatform.cpp
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#include "Common.h"
|
||||||
|
#include "BFPlatform.h"
|
||||||
|
//#include <CoreFoundation/CFByteOrder.h>
|
||||||
|
//#include <mach/mach_time.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
//#include <mach/clock.h>
|
||||||
|
//#include <mach/mach.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
24
BeefySysLib/platform/android/BFPlatform.h
Normal file
24
BeefySysLib/platform/android/BFPlatform.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define BFSTDCALL
|
||||||
|
|
||||||
|
#include "AndroidCommon.h"
|
||||||
|
|
||||||
|
#define BF_PLATFORM_ANDROID
|
||||||
|
#define BF_PLATFORM_POSIX
|
||||||
|
#define BF_PLATFORM_NAME "BF_PLATFORM_ANDROID"
|
||||||
|
|
||||||
|
#define BF_IMPORT extern "C"
|
||||||
|
|
||||||
|
#ifdef BFSYSLIB_DYNAMIC
|
||||||
|
#define BF_EXPORT extern "C"
|
||||||
|
#define BF_CALLTYPE
|
||||||
|
#else
|
||||||
|
#define BF_EXPORT extern "C"
|
||||||
|
#define BF_CALLTYPE
|
||||||
|
#define BF_RESOURCES_REL_DIR "../Resources"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define BF_DEBUG_BREAK()
|
||||||
|
|
||||||
|
#include "../PlatformInterface.h"
|
9
BeefySysLib/platform/android/PlatformApp.h
Normal file
9
BeefySysLib/platform/android/PlatformApp.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "../../HeadlessApp.h"
|
||||||
|
|
||||||
|
NS_BF_BEGIN;
|
||||||
|
|
||||||
|
typedef HeadlessApp PlatformBFApp;
|
||||||
|
|
||||||
|
NS_BF_END;
|
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BF_PLATFORM_IOS
|
#define BF_PLATFORM_IOS
|
||||||
|
#define BF_PLATFORM_POSIX
|
||||||
#define BF_PLATFORM_OPENGL_ES2
|
#define BF_PLATFORM_OPENGL_ES2
|
||||||
#define BF_PLATFORM_FULLSCREEN
|
#define BF_PLATFORM_FULLSCREEN
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,6 +6,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define BF_PLATFORM_MACOS
|
#define BF_PLATFORM_MACOS
|
||||||
|
#define BF_PLATFORM_POSIX
|
||||||
|
#define BF_PLATFORM_DARWIN
|
||||||
#define BF_PLATFORM_NAME "BF_PLATFORM_MACOS"
|
#define BF_PLATFORM_NAME "BF_PLATFORM_MACOS"
|
||||||
|
|
||||||
#define BF_IMPORT extern "C"
|
#define BF_IMPORT extern "C"
|
||||||
|
|
2341
BeefySysLib/platform/posix/PosixCommon.cpp
Normal file
2341
BeefySysLib/platform/posix/PosixCommon.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -21,16 +21,14 @@ typedef fd_set FD_SET;
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <mach/error.h>
|
#include <mach/error.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <cerrno>
|
|
||||||
//#define errno (*__error())
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include <rpcdce.h>
|
#ifdef BF_PLATFORM_POSIX
|
||||||
|
#include <cerrno>
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma comment(lib,"wsock32.lib")
|
#pragma comment(lib,"wsock32.lib")
|
||||||
|
|
||||||
//#include "Hash.h"
|
|
||||||
|
|
||||||
#pragma warning(disable:4996)
|
#pragma warning(disable:4996)
|
||||||
|
|
||||||
USING_NS_BF;
|
USING_NS_BF;
|
||||||
|
|
|
@ -1356,7 +1356,9 @@ static int gDbgVizIdx = 0;
|
||||||
|
|
||||||
HashContext::~HashContext()
|
HashContext::~HashContext()
|
||||||
{
|
{
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
delete mDbgVizStream;
|
delete mDbgVizStream;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void HashContext::Reset()
|
void HashContext::Reset()
|
||||||
|
@ -1378,6 +1380,7 @@ void HashContext::Mixin(const void* data, int size)
|
||||||
{
|
{
|
||||||
int addBytes = std::min(size, 1024 - mBufSize);
|
int addBytes = std::min(size, 1024 - mBufSize);
|
||||||
|
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
if (mDbgViz)
|
if (mDbgViz)
|
||||||
{
|
{
|
||||||
int findIdx = 0x2cc159;
|
int findIdx = 0x2cc159;
|
||||||
|
@ -1386,6 +1389,7 @@ void HashContext::Mixin(const void* data, int size)
|
||||||
NOP;
|
NOP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpy(&mBuf[mBufSize], data, addBytes);
|
memcpy(&mBuf[mBufSize], data, addBytes);
|
||||||
mBufSize += addBytes;
|
mBufSize += addBytes;
|
||||||
|
@ -1417,6 +1421,7 @@ void HashContext::MixinStr(const StringImpl& str)
|
||||||
|
|
||||||
Val128 HashContext::Finish128()
|
Val128 HashContext::Finish128()
|
||||||
{
|
{
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
if (mDbgViz)
|
if (mDbgViz)
|
||||||
{
|
{
|
||||||
// String dbg = "HashContext Dbg";
|
// String dbg = "HashContext Dbg";
|
||||||
|
@ -1441,6 +1446,7 @@ Val128 HashContext::Finish128()
|
||||||
if ((mDbgVizStream != NULL) && (mDbgVizStream->IsOpen()))
|
if ((mDbgVizStream != NULL) && (mDbgVizStream->IsOpen()))
|
||||||
mDbgVizStream->Write(mBuf, mBufSize);
|
mDbgVizStream->Write(mBuf, mBufSize);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mBufSize <= 16)
|
if (mBufSize <= 16)
|
||||||
{
|
{
|
||||||
|
@ -1459,6 +1465,7 @@ Val128 HashContext::Finish128()
|
||||||
|
|
||||||
uint64 HashContext::Finish64()
|
uint64 HashContext::Finish64()
|
||||||
{
|
{
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
if (mDbgViz)
|
if (mDbgViz)
|
||||||
{
|
{
|
||||||
// String dbg = "HashContext Dbg";
|
// String dbg = "HashContext Dbg";
|
||||||
|
@ -1476,6 +1483,7 @@ uint64 HashContext::Finish64()
|
||||||
}
|
}
|
||||||
mDbgVizStream->Write(mBuf, mBufSize);
|
mDbgVizStream->Write(mBuf, mBufSize);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (mBufSize <= 8)
|
if (mBufSize <= 8)
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,16 +109,20 @@ public:
|
||||||
uint8 mBuf[1024];
|
uint8 mBuf[1024];
|
||||||
int mBufSize;
|
int mBufSize;
|
||||||
int mBufOffset;
|
int mBufOffset;
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
bool mDbgViz;
|
bool mDbgViz;
|
||||||
FileStream* mDbgVizStream;
|
FileStream* mDbgVizStream;
|
||||||
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HashContext()
|
HashContext()
|
||||||
{
|
{
|
||||||
mBufOffset = 0;
|
mBufOffset = 0;
|
||||||
mBufSize = 0;
|
mBufSize = 0;
|
||||||
|
#ifdef BF_PLATFORM_WINDOWS
|
||||||
mDbgViz = false;
|
mDbgViz = false;
|
||||||
mDbgVizStream = NULL;
|
mDbgVizStream = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
~HashContext();
|
~HashContext();
|
||||||
|
|
|
@ -157,9 +157,91 @@ namespace IDE
|
||||||
return didCommands ? .HadCommands : .NoCommands;
|
return didCommands ? .HadCommands : .NoCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QueueProjectGNUArchive(Project project, String targetPath, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
||||||
|
{
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
|
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
|
||||||
|
IDEUtils.FixFilePath(llvmDir);
|
||||||
|
llvmDir.Append("llvm/");
|
||||||
|
#else
|
||||||
|
String llvmDir = "";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//String error = scope String();
|
||||||
|
|
||||||
|
TestManager.ProjectInfo testProjectInfo = null;
|
||||||
|
if (gApp.mTestManager != null)
|
||||||
|
testProjectInfo = gApp.mTestManager.GetProjectInfo(project);
|
||||||
|
|
||||||
|
bool isExe = (project.mGeneralOptions.mTargetType != Project.TargetType.BeefLib) || (testProjectInfo != null);
|
||||||
|
if (!isExe)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
String arCmds = scope String(""); //-O2 -Rpass=inline
|
||||||
|
//(doClangCPP ? "-lc++abi " : "") +
|
||||||
|
|
||||||
|
arCmds.AppendF("CREATE {}\n", targetPath);
|
||||||
|
|
||||||
|
for (let obj in objectsArg.Split(' '))
|
||||||
|
{
|
||||||
|
if (!obj.IsEmpty)
|
||||||
|
{
|
||||||
|
arCmds.AppendF("ADDMOD {}\n", obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
arCmds.AppendF("SAVE\n");
|
||||||
|
|
||||||
|
if (project.mNeedsTargetRebuild)
|
||||||
|
{
|
||||||
|
if (File.Delete(targetPath) case .Err)
|
||||||
|
{
|
||||||
|
gApp.OutputLine("Failed to delete {0}", targetPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String arPath = scope .();
|
||||||
|
#if BF_PLATFORM_WINDOWS
|
||||||
|
arPath.Clear();
|
||||||
|
arPath.Append(gApp.mInstallDir);
|
||||||
|
arPath.Append(@"llvm\bin\llvm-ar.exe");
|
||||||
|
#else
|
||||||
|
arPath.Append("/usr/bin/ar");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
String workingDir = scope String();
|
||||||
|
workingDir.Append(gApp.mInstallDir);
|
||||||
|
|
||||||
|
String scriptPath = scope .();
|
||||||
|
if (Path.GetTempFileName(scriptPath) case .Err)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (File.WriteAllText(scriptPath, arCmds) case .Err)
|
||||||
|
{
|
||||||
|
gApp.OutputLine("Failed to write archive script {0}", scriptPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String cmdLine = scope .();
|
||||||
|
cmdLine.AppendF("-M");
|
||||||
|
|
||||||
|
var runCmd = gApp.QueueRun(arPath, cmdLine, workingDir, .UTF8);
|
||||||
|
runCmd.mOnlyIfNotFailed = true;
|
||||||
|
runCmd.mStdInData = new .(arCmds);
|
||||||
|
var tagetCompletedCmd = new IDEApp.TargetCompletedCmd(project);
|
||||||
|
tagetCompletedCmd.mOnlyIfNotFailed = true;
|
||||||
|
gApp.mExecutionQueue.Add(tagetCompletedCmd);
|
||||||
|
|
||||||
|
project.mLastDidBuild = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool QueueProjectGNULink(Project project, String targetPath, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
bool QueueProjectGNULink(Project project, String targetPath, Workspace.Options workspaceOptions, Project.Options options, String objectsArg)
|
||||||
{
|
{
|
||||||
bool isDebug = gApp.mConfigName.IndexOf("Debug", true) != -1;
|
bool isDebug = gApp.mConfigName.IndexOf("Debug", true) != -1;
|
||||||
|
|
||||||
|
|
||||||
#if BF_PLATFORM_WINDOWS
|
#if BF_PLATFORM_WINDOWS
|
||||||
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
|
String llvmDir = scope String(IDEApp.sApp.mInstallDir);
|
||||||
|
@ -1070,7 +1152,12 @@ namespace IDE
|
||||||
|
|
||||||
if (workspaceOptions.mToolsetType == .GNU)
|
if (workspaceOptions.mToolsetType == .GNU)
|
||||||
{
|
{
|
||||||
if (!QueueProjectGNULink(project, targetPath, workspaceOptions, options, objectsArg))
|
if ((options.mBuildOptions.mBuildKind == .StaticLib) || (options.mBuildOptions.mBuildKind == .DynamicLib))
|
||||||
|
{
|
||||||
|
if (!QueueProjectGNUArchive(project, targetPath, workspaceOptions, options, objectsArg))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (!QueueProjectGNULink(project, targetPath, workspaceOptions, options, objectsArg))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else // MS
|
else // MS
|
||||||
|
|
|
@ -45,6 +45,25 @@ namespace IDE
|
||||||
return (this != .Og) && (this != .OgPlus) && (this != .O0);
|
return (this != .Og) && (this != .OgPlus) && (this != .O0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum RelocType
|
||||||
|
{
|
||||||
|
NotSet,
|
||||||
|
Static,
|
||||||
|
PIC,
|
||||||
|
DynamicNoPIC,
|
||||||
|
ROPI,
|
||||||
|
RWPI,
|
||||||
|
ROPI_RWPI
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PICLevel
|
||||||
|
{
|
||||||
|
NotSet,
|
||||||
|
Not,
|
||||||
|
Small,
|
||||||
|
Big
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DistinctBuildOptions
|
public class DistinctBuildOptions
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||||
using Beefy.widgets;
|
using Beefy.widgets;
|
||||||
using Beefy;
|
using Beefy;
|
||||||
using Beefy.utils;
|
using Beefy.utils;
|
||||||
|
using IDE.Util;
|
||||||
|
|
||||||
namespace IDE.Compiler
|
namespace IDE.Compiler
|
||||||
{
|
{
|
||||||
|
@ -465,7 +466,10 @@ namespace IDE.Compiler
|
||||||
|
|
||||||
var options = IDEApp.sApp.GetCurWorkspaceOptions();
|
var options = IDEApp.sApp.GetCurWorkspaceOptions();
|
||||||
String targetTriple = scope .();
|
String targetTriple = scope .();
|
||||||
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, options.mToolsetType, targetTriple);
|
if (TargetTriple.IsTargetTriple(gApp.mPlatformName))
|
||||||
|
targetTriple.Set(gApp.mPlatformName);
|
||||||
|
else
|
||||||
|
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, options.mToolsetType, targetTriple);
|
||||||
|
|
||||||
bool enableObjectDebugFlags = options.mEnableObjectDebugFlags;
|
bool enableObjectDebugFlags = options.mEnableObjectDebugFlags;
|
||||||
bool emitObjectAccessCheck = options.mEmitObjectAccessCheck && enableObjectDebugFlags;
|
bool emitObjectAccessCheck = options.mEmitObjectAccessCheck && enableObjectDebugFlags;
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace IDE.Compiler
|
||||||
|
|
||||||
[StdCall, CLink]
|
[StdCall, CLink]
|
||||||
extern static void BfProject_SetOptions(void* nativeBfProject, int32 targetType, char8* startupObject, char8* preprocessorMacros,
|
extern static void BfProject_SetOptions(void* nativeBfProject, int32 targetType, char8* startupObject, char8* preprocessorMacros,
|
||||||
int32 optLevel, int32 ltoType, Flags flags);
|
int32 optLevel, int32 ltoType, int32 relocType, int32 picLevel, Flags flags);
|
||||||
|
|
||||||
public void* mNativeBfProject;
|
public void* mNativeBfProject;
|
||||||
public bool mDisabled;
|
public bool mDisabled;
|
||||||
|
@ -61,7 +61,8 @@ namespace IDE.Compiler
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetOptions(Project.TargetType targetType, String startupObject, List<String> preprocessorMacros,
|
public void SetOptions(Project.TargetType targetType, String startupObject, List<String> preprocessorMacros,
|
||||||
BuildOptions.BfOptimizationLevel optLevel, BuildOptions.LTOType ltoType, bool mergeFunctions, bool combineLoads, bool vectorizeLoops, bool vectorizeSLP)
|
BuildOptions.BfOptimizationLevel optLevel, BuildOptions.LTOType ltoType, BuildOptions.RelocType relocType, BuildOptions.PICLevel picLevel,
|
||||||
|
bool mergeFunctions, bool combineLoads, bool vectorizeLoops, bool vectorizeSLP)
|
||||||
{
|
{
|
||||||
Flags flags = default;
|
Flags flags = default;
|
||||||
void SetFlags(bool val, Flags flag)
|
void SetFlags(bool val, Flags flag)
|
||||||
|
@ -77,7 +78,7 @@ namespace IDE.Compiler
|
||||||
String macrosStr = scope String();
|
String macrosStr = scope String();
|
||||||
macrosStr.Join("\n", preprocessorMacros.GetEnumerator());
|
macrosStr.Join("\n", preprocessorMacros.GetEnumerator());
|
||||||
BfProject_SetOptions(mNativeBfProject, (int32)targetType, startupObject, macrosStr,
|
BfProject_SetOptions(mNativeBfProject, (int32)targetType, startupObject, macrosStr,
|
||||||
(int32)optLevel, (int32)ltoType, flags);
|
(int32)optLevel, (int32)ltoType, (int32)relocType, (int32)picLevel, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -420,6 +420,7 @@ namespace IDE
|
||||||
public ArgsFileKind mUseArgsFile;
|
public ArgsFileKind mUseArgsFile;
|
||||||
public int32 mParallelGroup = -1;
|
public int32 mParallelGroup = -1;
|
||||||
public bool mIsTargetRun;
|
public bool mIsTargetRun;
|
||||||
|
public String mStdInData ~ delete _;
|
||||||
}
|
}
|
||||||
public List<ExecutionCmd> mExecutionQueue = new List<ExecutionCmd>() ~ DeleteContainerAndItems!(_);
|
public List<ExecutionCmd> mExecutionQueue = new List<ExecutionCmd>() ~ DeleteContainerAndItems!(_);
|
||||||
|
|
||||||
|
@ -435,9 +436,11 @@ namespace IDE
|
||||||
public Task<String> mErrorTask /*~ delete _*/;
|
public Task<String> mErrorTask /*~ delete _*/;
|
||||||
public Action<Task<String>> mOnErrorTaskComplete /*~ delete _*/;
|
public Action<Task<String>> mOnErrorTaskComplete /*~ delete _*/;
|
||||||
public Monitor mMonitor = new Monitor() ~ delete _;
|
public Monitor mMonitor = new Monitor() ~ delete _;
|
||||||
|
public String mStdInData ~ delete _;
|
||||||
|
|
||||||
public Thread mOutputThread;
|
public Thread mOutputThread;
|
||||||
public Thread mErrorThread;
|
public Thread mErrorThread;
|
||||||
|
public Thread mInputThread;
|
||||||
|
|
||||||
public int? mExitCode;
|
public int? mExitCode;
|
||||||
public bool mAutoDelete = true;
|
public bool mAutoDelete = true;
|
||||||
|
@ -450,12 +453,17 @@ namespace IDE
|
||||||
/*if (mProcess != null)
|
/*if (mProcess != null)
|
||||||
mProcess.Close();*/
|
mProcess.Close();*/
|
||||||
|
|
||||||
|
if (mInputThread != null)
|
||||||
|
mInputThread.Join();
|
||||||
|
delete mInputThread;
|
||||||
|
|
||||||
if (mOutputThread != null)
|
if (mOutputThread != null)
|
||||||
mOutputThread.Join();
|
mOutputThread.Join();
|
||||||
delete mOutputThread;
|
delete mOutputThread;
|
||||||
|
|
||||||
if (mErrorThread != null)
|
if (mErrorThread != null)
|
||||||
mErrorThread.Join();
|
mErrorThread.Join();
|
||||||
delete mErrorThread;
|
delete mErrorThread;
|
||||||
|
|
||||||
delete mReadTask;
|
delete mReadTask;
|
||||||
delete mOnReadTaskComplete;
|
delete mOnReadTaskComplete;
|
||||||
|
@ -7092,6 +7100,26 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WriteInputThread(Object obj)
|
||||||
|
{
|
||||||
|
ExecutionInstance executionInstance = (ExecutionInstance)obj;
|
||||||
|
|
||||||
|
FileStream fileStream = scope FileStream();
|
||||||
|
if (executionInstance.mProcess.AttachStandardInput(fileStream) case .Err)
|
||||||
|
return;
|
||||||
|
|
||||||
|
while (!executionInstance.mStdInData.IsEmpty)
|
||||||
|
{
|
||||||
|
switch (fileStream.TryWrite(.((.)executionInstance.mStdInData.Ptr, executionInstance.mStdInData.Length)))
|
||||||
|
{
|
||||||
|
case .Ok(int len):
|
||||||
|
executionInstance.mStdInData.Remove(0, len);
|
||||||
|
case .Err:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ReadOutputThread(Object obj)
|
static void ReadOutputThread(Object obj)
|
||||||
{
|
{
|
||||||
ExecutionInstance executionInstance = (ExecutionInstance)obj;
|
ExecutionInstance executionInstance = (ExecutionInstance)obj;
|
||||||
|
@ -7131,7 +7159,7 @@ namespace IDE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExecutionInstance DoRun(String inFileName, String args, String workingDir, ArgsFileKind useArgsFile, Dictionary<String, String> envVars = null)
|
public ExecutionInstance DoRun(String inFileName, String args, String workingDir, ArgsFileKind useArgsFile, Dictionary<String, String> envVars = null, String stdInData = null)
|
||||||
{
|
{
|
||||||
//Debug.Assert(executionInstance == null);
|
//Debug.Assert(executionInstance == null);
|
||||||
|
|
||||||
|
@ -7146,6 +7174,8 @@ namespace IDE
|
||||||
startInfo.SetArguments(args);
|
startInfo.SetArguments(args);
|
||||||
startInfo.RedirectStandardOutput = true;
|
startInfo.RedirectStandardOutput = true;
|
||||||
startInfo.RedirectStandardError = true;
|
startInfo.RedirectStandardError = true;
|
||||||
|
if (stdInData != null)
|
||||||
|
startInfo.RedirectStandardInput = true;
|
||||||
startInfo.CreateNoWindow = true;
|
startInfo.CreateNoWindow = true;
|
||||||
if (envVars != null)
|
if (envVars != null)
|
||||||
{
|
{
|
||||||
|
@ -7224,6 +7254,13 @@ namespace IDE
|
||||||
executionInstance.mErrorThread = new Thread(new => ReadErrorThread);
|
executionInstance.mErrorThread = new Thread(new => ReadErrorThread);
|
||||||
executionInstance.mErrorThread.Start(executionInstance, false);
|
executionInstance.mErrorThread.Start(executionInstance, false);
|
||||||
|
|
||||||
|
if (stdInData != null)
|
||||||
|
{
|
||||||
|
executionInstance.mStdInData = new String(stdInData);
|
||||||
|
executionInstance.mInputThread = new Thread(new => WriteInputThread);
|
||||||
|
executionInstance.mInputThread.Start(executionInstance, false);
|
||||||
|
}
|
||||||
|
|
||||||
return executionInstance;
|
return executionInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7502,7 +7539,7 @@ namespace IDE
|
||||||
else if (next is ExecutionQueueCmd)
|
else if (next is ExecutionQueueCmd)
|
||||||
{
|
{
|
||||||
var executionQueueCmd = (ExecutionQueueCmd)next;
|
var executionQueueCmd = (ExecutionQueueCmd)next;
|
||||||
var executionInstance = DoRun(executionQueueCmd.mFileName, executionQueueCmd.mArgs, executionQueueCmd.mWorkingDir, executionQueueCmd.mUseArgsFile, executionQueueCmd.mEnvVars);
|
var executionInstance = DoRun(executionQueueCmd.mFileName, executionQueueCmd.mArgs, executionQueueCmd.mWorkingDir, executionQueueCmd.mUseArgsFile, executionQueueCmd.mEnvVars, executionQueueCmd.mStdInData);
|
||||||
executionInstance.mParallelGroup = executionQueueCmd.mParallelGroup;
|
executionInstance.mParallelGroup = executionQueueCmd.mParallelGroup;
|
||||||
executionInstance.mIsTargetRun = executionQueueCmd.mIsTargetRun;
|
executionInstance.mIsTargetRun = executionQueueCmd.mIsTargetRun;
|
||||||
}
|
}
|
||||||
|
@ -7903,12 +7940,23 @@ namespace IDE
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (options.mBuildOptions.mBuildKind == .StaticLib)
|
||||||
|
{
|
||||||
|
if (project.mGeneralOptions.mTargetType.IsBeefApplication)
|
||||||
|
targetType = .BeefApplication_StaticLib;
|
||||||
|
}
|
||||||
|
else if (options.mBuildOptions.mBuildKind == .DynamicLib)
|
||||||
|
{
|
||||||
|
if (project.mGeneralOptions.mTargetType.IsBeefApplication)
|
||||||
|
targetType = .BeefApplication_DynamicLib;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bfProject.SetOptions(targetType,
|
bfProject.SetOptions(targetType,
|
||||||
project.mBeefGlobalOptions.mStartupObject,
|
project.mBeefGlobalOptions.mStartupObject,
|
||||||
preprocessorMacros.mDefines,
|
preprocessorMacros.mDefines,
|
||||||
optimizationLevel, ltoType, options.mBeefOptions.mMergeFunctions, options.mBeefOptions.mCombineLoads,
|
optimizationLevel, ltoType, options.mBeefOptions.mRelocType, options.mBeefOptions.mPICLevel,
|
||||||
|
options.mBeefOptions.mMergeFunctions, options.mBeefOptions.mCombineLoads,
|
||||||
options.mBeefOptions.mVectorizeLoops, options.mBeefOptions.mVectorizeSLP);
|
options.mBeefOptions.mVectorizeLoops, options.mBeefOptions.mVectorizeSLP);
|
||||||
|
|
||||||
List<Project> depProjectList = scope List<Project>();
|
List<Project> depProjectList = scope List<Project>();
|
||||||
|
@ -8378,21 +8426,43 @@ namespace IDE
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
||||||
switch (platformType)
|
|
||||||
|
if (options.mBuildOptions.mBuildKind.IsApplicationLib)
|
||||||
{
|
{
|
||||||
case .Windows:
|
switch (platformType)
|
||||||
if (project.mGeneralOptions.mTargetType == .BeefLib)
|
{
|
||||||
newString.Append(".lib");
|
case .Windows:
|
||||||
else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
|
newString.Append(".lib");
|
||||||
newString.Append(".dll");
|
case .iOS:
|
||||||
else if (project.mGeneralOptions.mTargetType != .CustomBuild)
|
if (options.mBuildOptions.mBuildKind == .DynamicLib)
|
||||||
newString.Append(".exe");
|
newString.Append(".dylib");
|
||||||
case .macOS:
|
else
|
||||||
if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
|
newString.Append(".a");
|
||||||
newString.Append(".dylib");
|
default:
|
||||||
default:
|
if (options.mBuildOptions.mBuildKind == .DynamicLib)
|
||||||
if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
|
newString.Append(".so");
|
||||||
newString.Append(".so");
|
else
|
||||||
|
newString.Append(".a");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
switch (platformType)
|
||||||
|
{
|
||||||
|
case .Windows:
|
||||||
|
if (project.mGeneralOptions.mTargetType == .BeefLib)
|
||||||
|
newString.Append(".lib");
|
||||||
|
else if (project.mGeneralOptions.mTargetType == .BeefDynLib)
|
||||||
|
newString.Append(".dll");
|
||||||
|
else if (project.mGeneralOptions.mTargetType != .CustomBuild)
|
||||||
|
newString.Append(".exe");
|
||||||
|
case .macOS:
|
||||||
|
if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
|
||||||
|
newString.Append(".dylib");
|
||||||
|
default:
|
||||||
|
if (project.mGeneralOptions.mTargetType == Project.TargetType.BeefLib)
|
||||||
|
newString.Append(".so");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "ProjectDir":
|
case "ProjectDir":
|
||||||
|
@ -8633,7 +8703,10 @@ namespace IDE
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clangOptions.Append("--target=");
|
clangOptions.Append("--target=");
|
||||||
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, workspaceOptions.mToolsetType, clangOptions);
|
if (TargetTriple.IsTargetTriple(gApp.mPlatformName))
|
||||||
|
clangOptions.Append(gApp.mPlatformName);
|
||||||
|
else
|
||||||
|
Workspace.PlatformType.GetTargetTripleByName(gApp.mPlatformName, workspaceOptions.mToolsetType, clangOptions);
|
||||||
clangOptions.Append(" ");
|
clangOptions.Append(" ");
|
||||||
|
|
||||||
if (workspaceOptions.mToolsetType == .GNU)
|
if (workspaceOptions.mToolsetType == .GNU)
|
||||||
|
|
|
@ -792,6 +792,16 @@ namespace IDE
|
||||||
{
|
{
|
||||||
case Normal;
|
case Normal;
|
||||||
case Test;
|
case Test;
|
||||||
|
case StaticLib;
|
||||||
|
case DynamicLib;
|
||||||
|
|
||||||
|
public bool IsApplicationLib
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (this == .StaticLib) || (this == .DynamicLib);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum COptimizationLevel
|
public enum COptimizationLevel
|
||||||
|
@ -838,20 +848,39 @@ namespace IDE
|
||||||
CustomBuild,
|
CustomBuild,
|
||||||
C_ConsoleApplication,
|
C_ConsoleApplication,
|
||||||
C_WindowsApplication,
|
C_WindowsApplication,
|
||||||
BeefTest;
|
BeefTest,
|
||||||
|
BeefApplication_StaticLib,
|
||||||
|
BeefApplication_DynamicLib;
|
||||||
|
|
||||||
public bool IsBeef
|
public bool IsBeef
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
switch (this)
|
switch (this)
|
||||||
{
|
{
|
||||||
case BeefConsoleApplication,
|
case BeefConsoleApplication,
|
||||||
BeefWindowsApplication,
|
BeefWindowsApplication,
|
||||||
BeefLib,
|
BeefLib,
|
||||||
BeefDynLib,
|
BeefDynLib,
|
||||||
BeefTest: return true;
|
BeefTest:
|
||||||
default: return false;
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsBeefApplication
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
switch (this)
|
||||||
|
{
|
||||||
|
case BeefConsoleApplication,
|
||||||
|
BeefWindowsApplication:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1005,6 +1034,10 @@ namespace IDE
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public List<String> mPreprocessorMacros = new List<String>() ~ DeleteContainerAndItems!(_);
|
public List<String> mPreprocessorMacros = new List<String>() ~ DeleteContainerAndItems!(_);
|
||||||
[Reflect]
|
[Reflect]
|
||||||
|
public BuildOptions.RelocType mRelocType;
|
||||||
|
[Reflect]
|
||||||
|
public BuildOptions.PICLevel mPICLevel;
|
||||||
|
[Reflect]
|
||||||
public BuildOptions.BfOptimizationLevel? mOptimizationLevel;
|
public BuildOptions.BfOptimizationLevel? mOptimizationLevel;
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public BuildOptions.LTOType? mLTOType;
|
public BuildOptions.LTOType? mLTOType;
|
||||||
|
@ -1103,6 +1136,8 @@ namespace IDE
|
||||||
Set!(newOptions.mBeefOptions.mPreprocessorMacros, mBeefOptions.mPreprocessorMacros);
|
Set!(newOptions.mBeefOptions.mPreprocessorMacros, mBeefOptions.mPreprocessorMacros);
|
||||||
Set!(newOptions.mBeefOptions.mOptimizationLevel, mBeefOptions.mOptimizationLevel);
|
Set!(newOptions.mBeefOptions.mOptimizationLevel, mBeefOptions.mOptimizationLevel);
|
||||||
Set!(newOptions.mBeefOptions.mLTOType, mBeefOptions.mLTOType);
|
Set!(newOptions.mBeefOptions.mLTOType, mBeefOptions.mLTOType);
|
||||||
|
Set!(newOptions.mBeefOptions.mRelocType, mBeefOptions.mRelocType);
|
||||||
|
Set!(newOptions.mBeefOptions.mPICLevel, mBeefOptions.mPICLevel);
|
||||||
Set!(newOptions.mBeefOptions.mMergeFunctions, mBeefOptions.mMergeFunctions);
|
Set!(newOptions.mBeefOptions.mMergeFunctions, mBeefOptions.mMergeFunctions);
|
||||||
Set!(newOptions.mBeefOptions.mCombineLoads, mBeefOptions.mCombineLoads);
|
Set!(newOptions.mBeefOptions.mCombineLoads, mBeefOptions.mCombineLoads);
|
||||||
Set!(newOptions.mBeefOptions.mVectorizeLoops, mBeefOptions.mVectorizeLoops);
|
Set!(newOptions.mBeefOptions.mVectorizeLoops, mBeefOptions.mVectorizeLoops);
|
||||||
|
@ -1522,6 +1557,8 @@ namespace IDE
|
||||||
data.Add(macro);
|
data.Add(macro);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.ConditionalAdd("RelocType", options.mBeefOptions.mRelocType, .NotSet);
|
||||||
|
data.ConditionalAdd("PICLevel", options.mBeefOptions.mPICLevel, .NotSet);
|
||||||
data.ConditionalAdd("OptimizationLevel", options.mBeefOptions.mOptimizationLevel);
|
data.ConditionalAdd("OptimizationLevel", options.mBeefOptions.mOptimizationLevel);
|
||||||
data.ConditionalAdd("LTOType", options.mBeefOptions.mLTOType);
|
data.ConditionalAdd("LTOType", options.mBeefOptions.mLTOType);
|
||||||
data.ConditionalAdd("MergeFunctions", options.mBeefOptions.mMergeFunctions);
|
data.ConditionalAdd("MergeFunctions", options.mBeefOptions.mMergeFunctions);
|
||||||
|
@ -1826,6 +1863,8 @@ namespace IDE
|
||||||
options.mBeefOptions.mPreprocessorMacros.Add(new String("TEST"));
|
options.mBeefOptions.mPreprocessorMacros.Add(new String("TEST"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.mBeefOptions.mRelocType = data.GetEnum<BuildOptions.RelocType>("RelocType");
|
||||||
|
options.mBeefOptions.mPICLevel = data.GetEnum<BuildOptions.PICLevel>("PICLevel");
|
||||||
if (data.Contains("OptimizationLevel"))
|
if (data.Contains("OptimizationLevel"))
|
||||||
options.mBeefOptions.mOptimizationLevel = data.GetEnum<BuildOptions.BfOptimizationLevel>("OptimizationLevel");
|
options.mBeefOptions.mOptimizationLevel = data.GetEnum<BuildOptions.BfOptimizationLevel>("OptimizationLevel");
|
||||||
if (data.Contains("LTOType"))
|
if (data.Contains("LTOType"))
|
||||||
|
@ -2135,6 +2174,7 @@ namespace IDE
|
||||||
bool isParanoid = configName.Contains("Paranoid");
|
bool isParanoid = configName.Contains("Paranoid");
|
||||||
bool isDebug = isParanoid || configName.Contains("Debug");
|
bool isDebug = isParanoid || configName.Contains("Debug");
|
||||||
bool isTest = configName.Contains("Test");
|
bool isTest = configName.Contains("Test");
|
||||||
|
let platformType = Workspace.PlatformType.GetFromName(platformName);
|
||||||
|
|
||||||
if (isRelease)
|
if (isRelease)
|
||||||
options.mBeefOptions.mPreprocessorMacros.Add(new String("RELEASE"));
|
options.mBeefOptions.mPreprocessorMacros.Add(new String("RELEASE"));
|
||||||
|
@ -2149,7 +2189,20 @@ namespace IDE
|
||||||
options.mBuildOptions.mBeefLibType = isRelease ? .Static : .Dynamic;
|
options.mBuildOptions.mBeefLibType = isRelease ? .Static : .Dynamic;
|
||||||
options.mBuildOptions.mStackSize = 0;
|
options.mBuildOptions.mStackSize = 0;
|
||||||
|
|
||||||
options.mBuildOptions.mBuildKind = isTest ? .Test : .Normal;
|
switch (platformType)
|
||||||
|
{
|
||||||
|
case .Linux,
|
||||||
|
.Windows,
|
||||||
|
.macOS:
|
||||||
|
options.mBuildOptions.mBuildKind = isTest ? .Test : .Normal;
|
||||||
|
default:
|
||||||
|
options.mBuildOptions.mBuildKind = .StaticLib;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (platformType == .Android)
|
||||||
|
{
|
||||||
|
options.mBeefOptions.mRelocType = .PIC;
|
||||||
|
}
|
||||||
|
|
||||||
options.mBuildOptions.mOtherLinkFlags.Set("$(LinkFlags)");
|
options.mBuildOptions.mOtherLinkFlags.Set("$(LinkFlags)");
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ namespace IDE
|
||||||
case Linux;
|
case Linux;
|
||||||
case macOS;
|
case macOS;
|
||||||
case iOS;
|
case iOS;
|
||||||
|
case Android;
|
||||||
|
|
||||||
public static PlatformType GetFromName(String name)
|
public static PlatformType GetFromName(String name)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +37,8 @@ namespace IDE
|
||||||
case "Linux32", "Linux64": return .Linux;
|
case "Linux32", "Linux64": return .Linux;
|
||||||
case "macOS": return .macOS;
|
case "macOS": return .macOS;
|
||||||
case "iOS": return .iOS;
|
case "iOS": return .iOS;
|
||||||
default: return .Unknown;
|
default:
|
||||||
|
return TargetTriple.GetPlatformType(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +62,11 @@ namespace IDE
|
||||||
|
|
||||||
public static int GetPtrSizeByName(String name)
|
public static int GetPtrSizeByName(String name)
|
||||||
{
|
{
|
||||||
if (name.EndsWith("32"))
|
if ((name.EndsWith("32")) && (!TargetTriple.IsTargetTriple(name)))
|
||||||
|
return 4;
|
||||||
|
if (name.StartsWith("armv"))
|
||||||
|
return 4;
|
||||||
|
if (name.StartsWith("i686-"))
|
||||||
return 4;
|
return 4;
|
||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +86,7 @@ namespace IDE
|
||||||
case "macOS":
|
case "macOS":
|
||||||
outTriple.Append("x86_64-apple-macosx10.14.0");
|
outTriple.Append("x86_64-apple-macosx10.14.0");
|
||||||
case "iOS":
|
case "iOS":
|
||||||
outTriple.Append("aarch64-apple-ios");
|
outTriple.Append("arm64-apple-ios");
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -167,6 +173,8 @@ namespace IDE
|
||||||
{
|
{
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public List<String> mPreprocessorMacros = new List<String>() ~ DeleteContainerAndItems!(_);
|
public List<String> mPreprocessorMacros = new List<String>() ~ DeleteContainerAndItems!(_);
|
||||||
|
/*[Reflect]
|
||||||
|
public String mTargetTriple = new .() ~ delete _;*/
|
||||||
[Reflect]
|
[Reflect]
|
||||||
public List<DistinctBuildOptions> mDistinctBuildOptions = new List<DistinctBuildOptions>() ~ DeleteContainerAndItems!(_);
|
public List<DistinctBuildOptions> mDistinctBuildOptions = new List<DistinctBuildOptions>() ~ DeleteContainerAndItems!(_);
|
||||||
}
|
}
|
||||||
|
@ -505,6 +513,7 @@ namespace IDE
|
||||||
if (mStartupProject != null)
|
if (mStartupProject != null)
|
||||||
data.Add("StartupProject", mStartupProject.mProjectName);
|
data.Add("StartupProject", mStartupProject.mProjectName);
|
||||||
WriteStrings("PreprocessorMacros", mBeefGlobalOptions.mPreprocessorMacros);
|
WriteStrings("PreprocessorMacros", mBeefGlobalOptions.mPreprocessorMacros);
|
||||||
|
//data.ConditionalAdd("TargetTriple", mBeefGlobalOptions.mTargetTriple, "");
|
||||||
WriteDistinctOptions(mBeefGlobalOptions.mDistinctBuildOptions);
|
WriteDistinctOptions(mBeefGlobalOptions.mDistinctBuildOptions);
|
||||||
data.RemoveIfEmpty();
|
data.RemoveIfEmpty();
|
||||||
}
|
}
|
||||||
|
@ -697,15 +706,20 @@ namespace IDE
|
||||||
bool isTest = configName.Contains("Test");
|
bool isTest = configName.Contains("Test");
|
||||||
let platformType = PlatformType.GetFromName(platformName);
|
let platformType = PlatformType.GetFromName(platformName);
|
||||||
|
|
||||||
|
/*if (TargetTriple.IsTargetTriple(platformName))
|
||||||
|
{
|
||||||
|
options.mToolsetType = .None;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
options.mBfOptimizationLevel = isRelease ? .O2 : .O0;
|
||||||
options.mBfSIMDSetting = .SSE2;
|
options.mBfSIMDSetting = .SSE2;
|
||||||
if (platformType == .Windows)
|
if (platformType == .Windows)
|
||||||
{
|
{
|
||||||
options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0;
|
options.mBfOptimizationLevel = isRelease ? .O2 : (platformName == "Win64") ? .OgPlus : .O0;
|
||||||
options.mToolsetType = .Microsoft;
|
options.mToolsetType = .Microsoft;
|
||||||
}
|
}
|
||||||
else
|
else if ((platformType == .macOS) == (platformType == .Linux))
|
||||||
{
|
{
|
||||||
options.mBfOptimizationLevel = isRelease ? .O2 : .O0;
|
|
||||||
options.mToolsetType = .GNU;
|
options.mToolsetType = .GNU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,6 +771,7 @@ namespace IDE
|
||||||
data.GetCurString(str);
|
data.GetCurString(str);
|
||||||
mBeefGlobalOptions.mPreprocessorMacros.Add(str);
|
mBeefGlobalOptions.mPreprocessorMacros.Add(str);
|
||||||
}
|
}
|
||||||
|
//data.GetString("TargetTriple", mBeefGlobalOptions.mTargetTriple);
|
||||||
|
|
||||||
for (data.Enumerate("DistinctOptions"))
|
for (data.Enumerate("DistinctOptions"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -823,7 +823,9 @@ namespace IDE.ui
|
||||||
|
|
||||||
(category, propEntry) = AddPropertiesItem(root, "Code Generation");
|
(category, propEntry) = AddPropertiesItem(root, "Code Generation");
|
||||||
category.mIsBold = true;
|
category.mIsBold = true;
|
||||||
category.mTextColor = cHeaderColor;
|
category.mTextColor = cHeaderColor;
|
||||||
|
AddPropertiesItem(category, "Reloc Model", "mBeefOptions.mRelocType");
|
||||||
|
AddPropertiesItem(category, "PIC Level", "mBeefOptions.mPICLevel");
|
||||||
AddPropertiesItem(category, "Optimization Level", "mBeefOptions.mOptimizationLevel",
|
AddPropertiesItem(category, "Optimization Level", "mBeefOptions.mOptimizationLevel",
|
||||||
scope String[] { "O0", "O1", "O2", "O3", "Og", "Og+" }); // -O0 .. -O3, -Os, -Ofast, -Og
|
scope String[] { "O0", "O1", "O2", "O3", "Og", "Og+" }); // -O0 .. -O3, -Os, -Ofast, -Og
|
||||||
AddPropertiesItem(category, "LTO", "mBeefOptions.mLTOType");
|
AddPropertiesItem(category, "LTO", "mBeefOptions.mLTOType");
|
||||||
|
|
|
@ -724,17 +724,20 @@ namespace IDE.ui
|
||||||
void PopulateBeefGlobalOptions()
|
void PopulateBeefGlobalOptions()
|
||||||
{
|
{
|
||||||
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
var root = (DarkListViewItem)mPropPage.mPropertiesListView.GetRoot();
|
||||||
var (category, ?) = AddPropertiesItem(root, "General");
|
/*var (category, ?) = AddPropertiesItem(root, "General");
|
||||||
category.mIsBold = true;
|
category.mIsBold = true;
|
||||||
category.mTextColor = 0xFFE8E8E8;
|
category.mTextColor = 0xFFE8E8E8;*/
|
||||||
|
|
||||||
AddPropertiesItem(category, "Preprocessor Macros", "mPreprocessorMacros");
|
AddPropertiesItem(root, "Preprocessor Macros", "mPreprocessorMacros");
|
||||||
DistinctOptionBuilder dictinctOptionBuilder = scope .(this);
|
DistinctOptionBuilder dictinctOptionBuilder = scope .(this);
|
||||||
dictinctOptionBuilder.Add(gApp.mWorkspace.mBeefGlobalOptions.mDistinctBuildOptions);
|
dictinctOptionBuilder.Add(gApp.mWorkspace.mBeefGlobalOptions.mDistinctBuildOptions);
|
||||||
dictinctOptionBuilder.Finish();
|
dictinctOptionBuilder.Finish();
|
||||||
|
|
||||||
|
//AddPropertiesItem(root, "Target Triple", "mTargetTriple");
|
||||||
|
|
||||||
AddNewDistinctBuildOptions();
|
AddNewDistinctBuildOptions();
|
||||||
//parent.MakeParent();
|
//parent.MakeParent();
|
||||||
category.Open(true, true);
|
//category.Open(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PopulateBeefTargetedOptions()
|
void PopulateBeefTargetedOptions()
|
||||||
|
|
55
IDE/src/util/TargetTriple.bf
Normal file
55
IDE/src/util/TargetTriple.bf
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace IDE.Util
|
||||||
|
{
|
||||||
|
class TargetTriple
|
||||||
|
{
|
||||||
|
public static bool IsTargetTriple(StringView str)
|
||||||
|
{
|
||||||
|
int dashCount = 0;
|
||||||
|
for (let c in str.RawChars)
|
||||||
|
if (c == '-')
|
||||||
|
dashCount++;
|
||||||
|
return dashCount >= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Workspace.PlatformType GetPlatformType(StringView str)
|
||||||
|
{
|
||||||
|
var str;
|
||||||
|
|
||||||
|
// Remove version from the end
|
||||||
|
while (!str.IsEmpty)
|
||||||
|
{
|
||||||
|
char8 c = str[str.Length - 1];
|
||||||
|
if ((c.IsDigit) || (c == '.'))
|
||||||
|
str.RemoveFromEnd(1);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasLinux = false;
|
||||||
|
|
||||||
|
for (let elem in str.Split('-'))
|
||||||
|
{
|
||||||
|
switch (elem)
|
||||||
|
{
|
||||||
|
case "linux":
|
||||||
|
hasLinux = true;
|
||||||
|
case "windows":
|
||||||
|
return .Windows;
|
||||||
|
case "macosx":
|
||||||
|
return .macOS;
|
||||||
|
case "ios":
|
||||||
|
return .iOS;
|
||||||
|
case "android",
|
||||||
|
"androideabi":
|
||||||
|
return .Android;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasLinux)
|
||||||
|
return .Linux;
|
||||||
|
return .Unknown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1582,7 +1582,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
BfIRFunctionType mainFuncType;
|
BfIRFunctionType mainFuncType;
|
||||||
BfIRFunction mainFunc;
|
BfIRFunction mainFunc;
|
||||||
if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefTest))
|
if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefTest))
|
||||||
{
|
{
|
||||||
SmallVector<BfIRType, 2> paramTypes;
|
SmallVector<BfIRType, 2> paramTypes;
|
||||||
paramTypes.push_back(int32Type);
|
paramTypes.push_back(int32Type);
|
||||||
paramTypes.push_back(nullPtrType);
|
paramTypes.push_back(nullPtrType);
|
||||||
|
@ -1598,7 +1598,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
paramTypes.push_back(nullPtrType); // lpvReserved
|
paramTypes.push_back(nullPtrType); // lpvReserved
|
||||||
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
||||||
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "DllMain");
|
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "DllMain");
|
||||||
if (mSystem->mPtrSize == 4)
|
if (mOptions.mMachineType == BfMachineType_x86)
|
||||||
bfModule->mBfIRBuilder->SetFuncCallingConv(mainFunc, BfIRCallingConv_StdCall);
|
bfModule->mBfIRBuilder->SetFuncCallingConv(mainFunc, BfIRCallingConv_StdCall);
|
||||||
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
||||||
}
|
}
|
||||||
|
@ -1611,7 +1611,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
paramTypes.push_back(int32Type); // nCmdShow
|
paramTypes.push_back(int32Type); // nCmdShow
|
||||||
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
||||||
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "WinMain");
|
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "WinMain");
|
||||||
if (mSystem->mPtrSize == 4)
|
if (mOptions.mMachineType == BfMachineType_x86)
|
||||||
bfModule->mBfIRBuilder->SetFuncCallingConv(mainFunc, BfIRCallingConv_StdCall);
|
bfModule->mBfIRBuilder->SetFuncCallingConv(mainFunc, BfIRCallingConv_StdCall);
|
||||||
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1620,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
SmallVector<BfIRType, 2> paramTypes;
|
SmallVector<BfIRType, 2> paramTypes;
|
||||||
paramTypes.push_back(int32Type);
|
paramTypes.push_back(int32Type);
|
||||||
paramTypes.push_back(nullPtrType);
|
paramTypes.push_back(nullPtrType);
|
||||||
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(voidType, paramTypes, false);
|
mainFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
||||||
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "BeefMain");
|
mainFunc = bfModule->mBfIRBuilder->CreateFunction(mainFuncType, BfIRLinkageType_External, "BeefMain");
|
||||||
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
bfModule->SetupIRMethod(NULL, mainFunc, false);
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1711,8 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
}
|
}
|
||||||
|
|
||||||
BfIRValue retValue;
|
BfIRValue retValue;
|
||||||
if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefWindowsApplication))
|
if ((project->mTargetType == BfTargetType_BeefConsoleApplication) || (project->mTargetType == BfTargetType_BeefWindowsApplication) ||
|
||||||
|
(project->mTargetType == BfTargetType_BeefApplication_StaticLib) || (project->mTargetType == BfTargetType_BeefApplication_DynamicLib))
|
||||||
{
|
{
|
||||||
bool hadRet = false;
|
bool hadRet = false;
|
||||||
|
|
||||||
|
@ -1785,7 +1786,7 @@ void BfCompiler::CreateVData(BfVDataModule* bfModule)
|
||||||
}
|
}
|
||||||
BfIRFunctionType thunkFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
BfIRFunctionType thunkFuncType = bfModule->mBfIRBuilder->CreateFunctionType(int32Type, paramTypes, false);
|
||||||
|
|
||||||
BfIRFunction thunkMainFunc = bfModule->mBfIRBuilder->CreateFunction(thunkFuncType, BfIRLinkageType_External, "BeefMain");
|
BfIRFunction thunkMainFunc = bfModule->mBfIRBuilder->CreateFunction(thunkFuncType, BfIRLinkageType_External, "BeefStartProgram");
|
||||||
bfModule->SetupIRMethod(NULL, thunkMainFunc, false);
|
bfModule->SetupIRMethod(NULL, thunkMainFunc, false);
|
||||||
bfModule->mBfIRBuilder->SetActiveFunction(thunkMainFunc);
|
bfModule->mBfIRBuilder->SetActiveFunction(thunkMainFunc);
|
||||||
|
|
||||||
|
@ -5879,7 +5880,8 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
|
||||||
if ((bfProject->mTargetType != BfTargetType_BeefConsoleApplication) && (bfProject->mTargetType != BfTargetType_BeefWindowsApplication) &&
|
if ((bfProject->mTargetType != BfTargetType_BeefConsoleApplication) && (bfProject->mTargetType != BfTargetType_BeefWindowsApplication) &&
|
||||||
(bfProject->mTargetType != BfTargetType_BeefDynLib) &&
|
(bfProject->mTargetType != BfTargetType_BeefDynLib) &&
|
||||||
(bfProject->mTargetType != BfTargetType_C_ConsoleApplication) && (bfProject->mTargetType != BfTargetType_C_WindowsApplication) &&
|
(bfProject->mTargetType != BfTargetType_C_ConsoleApplication) && (bfProject->mTargetType != BfTargetType_C_WindowsApplication) &&
|
||||||
(bfProject->mTargetType != BfTargetType_BeefTest))
|
(bfProject->mTargetType != BfTargetType_BeefTest) &&
|
||||||
|
(bfProject->mTargetType != BfTargetType_BeefApplication_StaticLib) && (bfProject->mTargetType != BfTargetType_BeefApplication_DynamicLib))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (bfProject->mTargetType == BfTargetType_BeefTest)
|
if (bfProject->mTargetType == BfTargetType_BeefTest)
|
||||||
|
@ -8122,6 +8124,38 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_HotResolve_Finish(BfCompiler* bfCom
|
||||||
return outString.c_str();
|
return outString.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static BfPlatformType GetPlatform(StringView str)
|
||||||
|
{
|
||||||
|
while (!str.IsEmpty())
|
||||||
|
{
|
||||||
|
char c = str[str.mLength - 1];
|
||||||
|
if (((c >= '0') && (c <= '9')) || (c == '.'))
|
||||||
|
str.RemoveFromEnd(1);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hasLinux = false;
|
||||||
|
|
||||||
|
for (auto elem : str.Split('-'))
|
||||||
|
{
|
||||||
|
if (elem == "linux")
|
||||||
|
hasLinux = true;
|
||||||
|
else if (elem == "windows")
|
||||||
|
return BfPlatformType_Windows;
|
||||||
|
else if (elem == "macosx")
|
||||||
|
return BfPlatformType_macOS;
|
||||||
|
else if (elem == "ios")
|
||||||
|
return BfPlatformType_iOS;
|
||||||
|
else if ((elem == "android") || (elem == "androideabi"))
|
||||||
|
return BfPlatformType_Android;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasLinux)
|
||||||
|
return BfPlatformType_Linux;
|
||||||
|
return BfPlatformType_Unknown;
|
||||||
|
}
|
||||||
|
|
||||||
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProject* hotProject, int hotIdx,
|
BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProject* hotProject, int hotIdx,
|
||||||
const char* targetTriple, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
const char* targetTriple, int toolsetType, int simdSetting, int allocStackCount, int maxWorkerThreads,
|
||||||
BfCompilerOptionFlags optionFlags, char* mallocLinkName, char* freeLinkName)
|
BfCompilerOptionFlags optionFlags, char* mallocLinkName, char* freeLinkName)
|
||||||
|
@ -8141,9 +8175,22 @@ BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProje
|
||||||
options->mMachineType = BfMachineType_x64;
|
options->mMachineType = BfMachineType_x64;
|
||||||
else if (options->mTargetTriple.StartsWith("i686-"))
|
else if (options->mTargetTriple.StartsWith("i686-"))
|
||||||
options->mMachineType = BfMachineType_x86;
|
options->mMachineType = BfMachineType_x86;
|
||||||
|
else if ((options->mTargetTriple.StartsWith("arm64")) || (options->mTargetTriple.StartsWith("aarch64")))
|
||||||
|
options->mMachineType = BfMachineType_AArch64;
|
||||||
|
else if (options->mTargetTriple.StartsWith("armv"))
|
||||||
|
options->mMachineType = BfMachineType_ARM;
|
||||||
else
|
else
|
||||||
options->mMachineType = BfMachineType_x64; // Default
|
options->mMachineType = BfMachineType_x64; // Default
|
||||||
|
|
||||||
|
options->mPlatformType = GetPlatform(options->mTargetTriple);
|
||||||
|
|
||||||
|
options->mCLongSize = 4;
|
||||||
|
if ((options->mMachineType == BfMachineType_AArch64) || (options->mMachineType == BfMachineType_x64))
|
||||||
|
{
|
||||||
|
if ((options->mPlatformType == BfPlatformType_macOS) || (options->mPlatformType == BfPlatformType_iOS) || (options->mPlatformType == BfPlatformType_Android))
|
||||||
|
options->mCLongSize = 8;
|
||||||
|
}
|
||||||
|
|
||||||
bfCompiler->mCodeGen.SetMaxThreads(maxWorkerThreads);
|
bfCompiler->mCodeGen.SetMaxThreads(maxWorkerThreads);
|
||||||
|
|
||||||
if (!bfCompiler->mIsResolveOnly)
|
if (!bfCompiler->mIsResolveOnly)
|
||||||
|
@ -8169,15 +8216,15 @@ BF_EXPORT void BF_CALLTYPE BfCompiler_SetOptions(BfCompiler* bfCompiler, BfProje
|
||||||
options->mOmitDebugHelpers = (optionFlags & BfCompilerOptionFlag_OmitDebugHelpers) != 0;
|
options->mOmitDebugHelpers = (optionFlags & BfCompilerOptionFlag_OmitDebugHelpers) != 0;
|
||||||
|
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
if (options->mToolsetType == BfToolsetType_GNU)
|
// if (options->mToolsetType == BfToolsetType_GNU)
|
||||||
{
|
// {
|
||||||
options->mErrorString = "Toolset 'GNU' is not available on this platform. Consider changing 'Workspace/General/Toolset'.";
|
// options->mErrorString = "Toolset 'GNU' is not available on this platform. Consider changing 'Workspace/General/Toolset'.";
|
||||||
}
|
// }
|
||||||
#else
|
#else
|
||||||
if (options->mToolsetType == BfToolsetType_Microsoft)
|
// if (options->mToolsetType == BfToolsetType_Microsoft)
|
||||||
{
|
// {
|
||||||
options->mErrorString = "Toolset 'Microsoft' is not available on this platform. Consider changing 'Workspace/General/Toolset'.";
|
// options->mErrorString = "Toolset 'Microsoft' is not available on this platform. Consider changing 'Workspace/General/Toolset'.";
|
||||||
}
|
// }
|
||||||
BF_ASSERT(!options->mEnableRealtimeLeakCheck);
|
BF_ASSERT(!options->mEnableRealtimeLeakCheck);
|
||||||
#endif
|
#endif
|
||||||
options->mEmitObjectAccessCheck = (optionFlags & BfCompilerOptionFlag_EmitDebugInfo) != 0;
|
options->mEmitObjectAccessCheck = (optionFlags & BfCompilerOptionFlag_EmitDebugInfo) != 0;
|
||||||
|
|
|
@ -94,13 +94,15 @@ public:
|
||||||
int32 mForceRebuildIdx;
|
int32 mForceRebuildIdx;
|
||||||
BfCompileOnDemandKind mCompileOnDemandKind;
|
BfCompileOnDemandKind mCompileOnDemandKind;
|
||||||
String mTargetTriple;
|
String mTargetTriple;
|
||||||
|
BfPlatformType mPlatformType;
|
||||||
BfMachineType mMachineType;
|
BfMachineType mMachineType;
|
||||||
|
int mCLongSize;
|
||||||
BfToolsetType mToolsetType;
|
BfToolsetType mToolsetType;
|
||||||
BfSIMDSetting mSIMDSetting;
|
BfSIMDSetting mSIMDSetting;
|
||||||
int mMaxWorkerThreads;
|
int mMaxWorkerThreads;
|
||||||
String mMallocLinkName;
|
String mMallocLinkName;
|
||||||
String mFreeLinkName;
|
String mFreeLinkName;
|
||||||
bool mIncrementalBuild;
|
bool mIncrementalBuild;
|
||||||
|
|
||||||
bool mEmitDebugInfo;
|
bool mEmitDebugInfo;
|
||||||
bool mEmitLineInfo;
|
bool mEmitLineInfo;
|
||||||
|
@ -140,7 +142,9 @@ public:
|
||||||
mHotCompileIdx = 0;
|
mHotCompileIdx = 0;
|
||||||
mForceRebuildIdx = 0;
|
mForceRebuildIdx = 0;
|
||||||
mCompileOnDemandKind = BfCompileOnDemandKind_AlwaysInclude;
|
mCompileOnDemandKind = BfCompileOnDemandKind_AlwaysInclude;
|
||||||
|
mPlatformType = BfPlatformType_Unknown;
|
||||||
mMachineType = BfMachineType_x86;
|
mMachineType = BfMachineType_x86;
|
||||||
|
mCLongSize = 4;
|
||||||
mToolsetType = BfToolsetType_Microsoft;
|
mToolsetType = BfToolsetType_Microsoft;
|
||||||
mSIMDSetting = BfSIMDSetting_None;
|
mSIMDSetting = BfSIMDSetting_None;
|
||||||
mHotProject = NULL;
|
mHotProject = NULL;
|
||||||
|
|
|
@ -1632,7 +1632,8 @@ void BfContext::UpdateRevisedTypes()
|
||||||
BP_ZONE("BfContext::UpdateRevisedTypes");
|
BP_ZONE("BfContext::UpdateRevisedTypes");
|
||||||
|
|
||||||
int wantPtrSize;
|
int wantPtrSize;
|
||||||
if (mCompiler->mOptions.mMachineType == BfMachineType_x86)
|
if ((mCompiler->mOptions.mMachineType == BfMachineType_x86) |
|
||||||
|
(mCompiler->mOptions.mMachineType == BfMachineType_ARM))
|
||||||
wantPtrSize = 4;
|
wantPtrSize = 4;
|
||||||
else
|
else
|
||||||
wantPtrSize = 8;
|
wantPtrSize = 8;
|
||||||
|
@ -1788,9 +1789,12 @@ void BfContext::UpdateRevisedTypes()
|
||||||
|
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
|
AutoCrit autoCrit(mSystem->mDataLock);
|
||||||
|
|
||||||
auto options = &mCompiler->mOptions;
|
auto options = &mCompiler->mOptions;
|
||||||
HashContext workspaceConfigHashCtx;
|
HashContext workspaceConfigHashCtx;
|
||||||
|
|
||||||
|
workspaceConfigHashCtx.MixinStr(options->mTargetTriple);
|
||||||
workspaceConfigHashCtx.Mixin(options->mForceRebuildIdx);
|
workspaceConfigHashCtx.Mixin(options->mForceRebuildIdx);
|
||||||
|
|
||||||
workspaceConfigHashCtx.Mixin(options->mMachineType);
|
workspaceConfigHashCtx.Mixin(options->mMachineType);
|
||||||
|
@ -1813,6 +1817,8 @@ void BfContext::UpdateRevisedTypes()
|
||||||
workspaceConfigHashCtx.Mixin(options->mEnableCustodian);
|
workspaceConfigHashCtx.Mixin(options->mEnableCustodian);
|
||||||
workspaceConfigHashCtx.Mixin(options->mEnableSideStack);
|
workspaceConfigHashCtx.Mixin(options->mEnableSideStack);
|
||||||
workspaceConfigHashCtx.Mixin(options->mHasVDataExtender);
|
workspaceConfigHashCtx.Mixin(options->mHasVDataExtender);
|
||||||
|
workspaceConfigHashCtx.Mixin(options->mDebugAlloc);
|
||||||
|
workspaceConfigHashCtx.Mixin(options->mOmitDebugHelpers);
|
||||||
|
|
||||||
workspaceConfigHashCtx.Mixin(options->mUseDebugBackingParams);
|
workspaceConfigHashCtx.Mixin(options->mUseDebugBackingParams);
|
||||||
|
|
||||||
|
@ -1821,6 +1827,7 @@ void BfContext::UpdateRevisedTypes()
|
||||||
|
|
||||||
workspaceConfigHashCtx.Mixin(options->mAllocStackCount);
|
workspaceConfigHashCtx.Mixin(options->mAllocStackCount);
|
||||||
workspaceConfigHashCtx.Mixin(options->mExtraResolveChecks);
|
workspaceConfigHashCtx.Mixin(options->mExtraResolveChecks);
|
||||||
|
workspaceConfigHashCtx.Mixin(options->mMaxSplatRegs);
|
||||||
workspaceConfigHashCtx.MixinStr(options->mMallocLinkName);
|
workspaceConfigHashCtx.MixinStr(options->mMallocLinkName);
|
||||||
workspaceConfigHashCtx.MixinStr(options->mFreeLinkName);
|
workspaceConfigHashCtx.MixinStr(options->mFreeLinkName);
|
||||||
|
|
||||||
|
@ -1842,6 +1849,11 @@ void BfContext::UpdateRevisedTypes()
|
||||||
workspaceConfigHashCtx.Mixin(typeOptions.mAllocStackTraceDepth);
|
workspaceConfigHashCtx.Mixin(typeOptions.mAllocStackTraceDepth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for (auto project : mSystem->mProjects)
|
||||||
|
// {
|
||||||
|
// workspaceConfigHashCtx.MixinStr(project->mName);
|
||||||
|
// }
|
||||||
|
|
||||||
Val128 workspaceConfigHash = workspaceConfigHashCtx.Finish128();
|
Val128 workspaceConfigHash = workspaceConfigHashCtx.Finish128();
|
||||||
|
|
||||||
mSystem->mWorkspaceConfigChanged = mSystem->mWorkspaceConfigHash != workspaceConfigHash;
|
mSystem->mWorkspaceConfigChanged = mSystem->mWorkspaceConfigHash != workspaceConfigHash;
|
||||||
|
@ -1852,8 +1864,7 @@ void BfContext::UpdateRevisedTypes()
|
||||||
mSystem->mMergedTypeOptions.Clear();
|
mSystem->mMergedTypeOptions.Clear();
|
||||||
mSystem->mWorkspaceConfigHash = workspaceConfigHash;
|
mSystem->mWorkspaceConfigHash = workspaceConfigHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoCrit autoCrit(mSystem->mDataLock);
|
|
||||||
for (auto project : mSystem->mProjects)
|
for (auto project : mSystem->mProjects)
|
||||||
{
|
{
|
||||||
HashContext buildConfigHashCtx;
|
HashContext buildConfigHashCtx;
|
||||||
|
@ -1861,11 +1872,14 @@ void BfContext::UpdateRevisedTypes()
|
||||||
|
|
||||||
if (!mCompiler->mIsResolveOnly)
|
if (!mCompiler->mIsResolveOnly)
|
||||||
{
|
{
|
||||||
auto& codeGenOptions = project->mCodeGenOptions;
|
auto& codeGenOptions = project->mCodeGenOptions;
|
||||||
|
|
||||||
|
buildConfigHashCtx.Mixin(project->mAlwaysIncludeAll);
|
||||||
|
buildConfigHashCtx.Mixin(project->mSingleModule);
|
||||||
|
|
||||||
bool isTestConfig = project->mTargetType == BfTargetType_BeefTest;
|
bool isTestConfig = project->mTargetType == BfTargetType_BeefTest;
|
||||||
buildConfigHashCtx.Mixin(isTestConfig);
|
buildConfigHashCtx.Mixin(isTestConfig);
|
||||||
|
|
||||||
buildConfigHashCtx.Mixin(codeGenOptions.mOptLevel);
|
buildConfigHashCtx.Mixin(codeGenOptions.mOptLevel);
|
||||||
buildConfigHashCtx.Mixin(codeGenOptions.mSizeLevel);
|
buildConfigHashCtx.Mixin(codeGenOptions.mSizeLevel);
|
||||||
buildConfigHashCtx.Mixin(codeGenOptions.mUseCFLAA);
|
buildConfigHashCtx.Mixin(codeGenOptions.mUseCFLAA);
|
||||||
|
@ -1888,6 +1902,7 @@ void BfContext::UpdateRevisedTypes()
|
||||||
buildConfigHashCtx.Mixin(codeGenOptions.mRunSLPAfterLoopVectorization);
|
buildConfigHashCtx.Mixin(codeGenOptions.mRunSLPAfterLoopVectorization);
|
||||||
buildConfigHashCtx.Mixin(codeGenOptions.mUseGVNAfterVectorization);
|
buildConfigHashCtx.Mixin(codeGenOptions.mUseGVNAfterVectorization);
|
||||||
}
|
}
|
||||||
|
buildConfigHashCtx.Mixin(project->mDisabled);
|
||||||
buildConfigHashCtx.Mixin(project->mTargetType);
|
buildConfigHashCtx.Mixin(project->mTargetType);
|
||||||
|
|
||||||
for (auto dep : project->mDependencies)
|
for (auto dep : project->mDependencies)
|
||||||
|
@ -2226,6 +2241,12 @@ String BfContext::GenerateModuleName(BfTypeInstance* typeInst)
|
||||||
name.RemoveToEnd(80);
|
name.RemoveToEnd(80);
|
||||||
name += "__";
|
name += "__";
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < (int)name.length(); i++)
|
||||||
|
{
|
||||||
|
char c = name[i];
|
||||||
|
if (c == '@')
|
||||||
|
name[i] = '_';
|
||||||
|
}
|
||||||
|
|
||||||
String tryName = name;
|
String tryName = name;
|
||||||
for (int i = 2; true; i++)
|
for (int i = 2; true; i++)
|
||||||
|
|
|
@ -2110,7 +2110,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
||||||
String prefix = typeDef->mProject->mName + ".";
|
String prefix = typeDef->mProject->mName + ".";
|
||||||
StringT<128> mangledName;
|
StringT<128> mangledName;
|
||||||
mangledName += prefix;
|
mangledName += prefix;
|
||||||
BfMangler::Mangle(mangledName, mModule->mCompiler->GetMangleKind(), typeInstance);
|
BfMangler::Mangle(mangledName, mModule->mCompiler->GetMangleKind(), typeInstance, typeInstance->mModule);
|
||||||
BfIRType irStructType = CreateStructType(mangledName);
|
BfIRType irStructType = CreateStructType(mangledName);
|
||||||
if (type->IsObjectOrInterface())
|
if (type->IsObjectOrInterface())
|
||||||
{
|
{
|
||||||
|
@ -4748,7 +4748,7 @@ BfIRValue BfIRBuilder::DbgLifetimeEnd(BfIRMDNode varInfo)
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfIRBuilder::DbgCreateGlobalVariable(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNumber, BfIRMDNode type, bool isLocalToUnit, BfIRValue val, BfIRMDNode decl)
|
void BfIRBuilder::DbgCreateGlobalVariable(BfIRMDNode context, const StringImpl& name, const StringImpl& linkageName, BfIRMDNode file, int lineNumber, BfIRMDNode type, bool isLocalToUnit, BfIRValue val, BfIRMDNode decl)
|
||||||
{
|
{
|
||||||
WriteCmd(BfIRCmd_DbgCreateGlobalVariable, context, name, linkageName, file, lineNumber, type, isLocalToUnit, val, decl);
|
WriteCmd(BfIRCmd_DbgCreateGlobalVariable, context, name, linkageName, file, lineNumber, type, isLocalToUnit, val, decl);
|
||||||
NEW_CMD_INSERTED;
|
NEW_CMD_INSERTED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4009,9 +4009,44 @@ bool BfIRCodeGen::WriteObjectFile(const StringImpl& outFileName, const BfCodeGen
|
||||||
llvm::Optional<llvm::Reloc::Model> relocModel;
|
llvm::Optional<llvm::Reloc::Model> relocModel;
|
||||||
llvm::CodeModel::Model cmModel = llvm::CodeModel::Small;
|
llvm::CodeModel::Model cmModel = llvm::CodeModel::Small;
|
||||||
|
|
||||||
|
switch (codeGenOptions.mRelocType)
|
||||||
|
{
|
||||||
|
case BfRelocType_Static:
|
||||||
|
relocModel = llvm::Reloc::Model::DynamicNoPIC;
|
||||||
|
break;
|
||||||
|
case BfRelocType_PIC:
|
||||||
|
relocModel = llvm::Reloc::Model::PIC_;
|
||||||
|
break;
|
||||||
|
case BfRelocType_DynamicNoPIC:
|
||||||
|
relocModel = llvm::Reloc::Model::DynamicNoPIC;
|
||||||
|
break;
|
||||||
|
case BfRelocType_ROPI:
|
||||||
|
relocModel = llvm::Reloc::Model::ROPI;
|
||||||
|
break;
|
||||||
|
case BfRelocType_RWPI:
|
||||||
|
relocModel = llvm::Reloc::Model::RWPI;
|
||||||
|
break;
|
||||||
|
case BfRelocType_ROPI_RWPI:
|
||||||
|
relocModel = llvm::Reloc::Model::ROPI_RWPI;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (codeGenOptions.mPICLevel)
|
||||||
|
{
|
||||||
|
case BfPICLevel_Not:
|
||||||
|
mLLVMModule->setPICLevel(llvm::PICLevel::Level::NotPIC);
|
||||||
|
break;
|
||||||
|
case BfPICLevel_Small:
|
||||||
|
mLLVMModule->setPICLevel(llvm::PICLevel::Level::SmallPIC);
|
||||||
|
break;
|
||||||
|
case BfPICLevel_Big:
|
||||||
|
mLLVMModule->setPICLevel(llvm::PICLevel::Level::BigPIC);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<llvm::TargetMachine> target(
|
std::unique_ptr<llvm::TargetMachine> target(
|
||||||
theTarget->createTargetMachine(theTriple.getTriple(), cpuName.c_str(), featuresStr.c_str(),
|
theTarget->createTargetMachine(theTriple.getTriple(), cpuName.c_str(), featuresStr.c_str(),
|
||||||
Options, relocModel, cmModel, optLvl));
|
Options, relocModel, cmModel, optLvl));
|
||||||
|
|
||||||
std::error_code EC;
|
std::error_code EC;
|
||||||
llvm::sys::fs::OpenFlags OpenFlags = llvm::sys::fs::F_None;
|
llvm::sys::fs::OpenFlags OpenFlags = llvm::sys::fs::F_None;
|
||||||
|
@ -4188,6 +4223,11 @@ void BfIRCodeGen::StaticInit()
|
||||||
LLVMInitializeX86AsmParser();
|
LLVMInitializeX86AsmParser();
|
||||||
LLVMInitializeX86Disassembler();
|
LLVMInitializeX86Disassembler();
|
||||||
|
|
||||||
|
LLVMInitializeARMTargetInfo();
|
||||||
|
LLVMInitializeARMTarget();
|
||||||
|
LLVMInitializeARMTargetMC();
|
||||||
|
LLVMInitializeARMAsmPrinter();
|
||||||
|
|
||||||
LLVMInitializeAArch64TargetInfo();
|
LLVMInitializeAArch64TargetInfo();
|
||||||
LLVMInitializeAArch64Target();
|
LLVMInitializeAArch64Target();
|
||||||
LLVMInitializeAArch64TargetMC();
|
LLVMInitializeAArch64TargetMC();
|
||||||
|
|
|
@ -56,13 +56,10 @@ BfTypeCode BfGNUMangler::GetPrimTypeAt(MangleContext& mangleContext, StringImpl&
|
||||||
case 't': return BfTypeCode_UInt16;
|
case 't': return BfTypeCode_UInt16;
|
||||||
case 'i': return BfTypeCode_Int32;
|
case 'i': return BfTypeCode_Int32;
|
||||||
case 'j': return BfTypeCode_UInt32;
|
case 'j': return BfTypeCode_UInt32;
|
||||||
#if __SIZEOF_LONG__ == 8
|
|
||||||
case 'l': return BfTypeCode_Int64;
|
case 'l': return BfTypeCode_Int64;
|
||||||
case 'm': return BfTypeCode_UInt64;
|
case 'm': return BfTypeCode_UInt64;
|
||||||
#else
|
|
||||||
case 'x': return BfTypeCode_Int64;
|
case 'x': return BfTypeCode_Int64;
|
||||||
case 'y': return BfTypeCode_UInt64;
|
case 'y': return BfTypeCode_UInt64;
|
||||||
#endif
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (name[strIdx + 1] == '3')
|
if (name[strIdx + 1] == '3')
|
||||||
return BfTypeCode_IntPtr;
|
return BfTypeCode_IntPtr;
|
||||||
|
@ -234,9 +231,9 @@ void BfGNUMangler::FindOrCreateNameSub(MangleContext& mangleContext, StringImpl&
|
||||||
else
|
else
|
||||||
name += "4";
|
name += "4";
|
||||||
if (genericParamType->mGenericParamKind == BfGenericParamKind_Method)
|
if (genericParamType->mGenericParamKind == BfGenericParamKind_Method)
|
||||||
name += "@M";
|
name += "`M";
|
||||||
else
|
else
|
||||||
name += "@T";
|
name += "`T";
|
||||||
itoa(genericParamType->mGenericParamIdx, str, 10);
|
itoa(genericParamType->mGenericParamIdx, str, 10);
|
||||||
name += str;
|
name += str;
|
||||||
}
|
}
|
||||||
|
@ -274,7 +271,7 @@ void BfGNUMangler::FindOrCreateNameSub(MangleContext& mangleContext, StringImpl&
|
||||||
}
|
}
|
||||||
|
|
||||||
void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInstance, bool* isEndOpen)
|
void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name, BfTypeInstance* typeInst, BfTypeInstance* postfixTypeInstance, bool* isEndOpen)
|
||||||
{
|
{
|
||||||
static int sCallCount = 0;
|
static int sCallCount = 0;
|
||||||
sCallCount++;
|
sCallCount++;
|
||||||
|
|
||||||
|
@ -289,7 +286,7 @@ void BfGNUMangler::MangleTypeInst(MangleContext& mangleContext, StringImpl& name
|
||||||
BfFieldDef* fieldDef = fieldInstance->GetFieldDef();
|
BfFieldDef* fieldDef = fieldInstance->GetFieldDef();
|
||||||
String fieldName = fieldDef->mName;
|
String fieldName = fieldDef->mName;
|
||||||
if ((fieldName[0] < '0') || (fieldName[0] > '9'))
|
if ((fieldName[0] < '0') || (fieldName[0] > '9'))
|
||||||
name += StrFormat("U%d@%s", fieldName.length() + 1, fieldName.c_str());
|
name += StrFormat("U%d`%s", fieldName.length() + 1, fieldName.c_str());
|
||||||
Mangle(mangleContext, name, fieldInstance->mResolvedType, postfixTypeInstance);
|
Mangle(mangleContext, name, fieldInstance->mResolvedType, postfixTypeInstance);
|
||||||
}
|
}
|
||||||
name += "E";
|
name += "E";
|
||||||
|
@ -444,25 +441,25 @@ void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType
|
||||||
name += "i"; return;
|
name += "i"; return;
|
||||||
case BfTypeCode_UInt32:
|
case BfTypeCode_UInt32:
|
||||||
name += "j"; return;
|
name += "j"; return;
|
||||||
#if __SIZEOF_LONG__ == 8
|
|
||||||
case BfTypeCode_Int64:
|
case BfTypeCode_Int64:
|
||||||
name += "l"; return;
|
if (mangleContext.mModule->mCompiler->mOptions.mCLongSize == 8)
|
||||||
|
name += "l";
|
||||||
|
else
|
||||||
|
name += "x";
|
||||||
|
return;
|
||||||
case BfTypeCode_UInt64:
|
case BfTypeCode_UInt64:
|
||||||
name += "m"; return;
|
if (mangleContext.mModule->mCompiler->mOptions.mCLongSize == 8)
|
||||||
#else
|
name += "m";
|
||||||
case BfTypeCode_Int64:
|
else
|
||||||
name += "x"; return;
|
name += "y";
|
||||||
case BfTypeCode_UInt64:
|
return;
|
||||||
name += "y"; return;
|
|
||||||
#endif
|
|
||||||
case BfTypeCode_UIntPtr:
|
case BfTypeCode_UIntPtr:
|
||||||
if ((mangleContext.mCCompat) || (mangleContext.mInArgs))
|
if ((mangleContext.mCCompat) || (mangleContext.mInArgs))
|
||||||
{
|
{
|
||||||
#if __SIZEOF_LONG__ == 8
|
if (mangleContext.mModule->mCompiler->mOptions.mCLongSize == 8)
|
||||||
name += (primType->mSize == 8) ? "m" : "j";
|
name += (primType->mSize == 8) ? "m" : "j";
|
||||||
#else
|
else
|
||||||
name += (primType->mSize == 8) ? "y" : "j";
|
name += (primType->mSize == 8) ? "y" : "j";
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name += "u4uint";
|
name += "u4uint";
|
||||||
|
@ -470,11 +467,10 @@ void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType
|
||||||
case BfTypeCode_IntPtr:
|
case BfTypeCode_IntPtr:
|
||||||
if ((mangleContext.mCCompat) || (mangleContext.mInArgs))
|
if ((mangleContext.mCCompat) || (mangleContext.mInArgs))
|
||||||
{
|
{
|
||||||
#if __SIZEOF_LONG__ == 8
|
if (mangleContext.mModule->mCompiler->mOptions.mCLongSize == 8)
|
||||||
name += (primType->mSize == 8) ? "l" : "i";
|
name += (primType->mSize == 8) ? "l" : "i";
|
||||||
#else
|
else
|
||||||
name += (primType->mSize == 8) ? "x" : "i";
|
name += (primType->mSize == 8) ? "x" : "i";
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name += "u3int";
|
name += "u3int";
|
||||||
|
@ -635,7 +631,7 @@ void BfGNUMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfType
|
||||||
}
|
}
|
||||||
|
|
||||||
name += strP;
|
name += strP;
|
||||||
name += '@';
|
name += '`';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -834,7 +830,7 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
{
|
{
|
||||||
if (methodInst->mMangleWithIdx)
|
if (methodInst->mMangleWithIdx)
|
||||||
{
|
{
|
||||||
methodName += StrFormat("@%d", methodInst->mMethodDef->mIdx);
|
methodName += StrFormat("`%d", methodInst->mMethodDef->mIdx);
|
||||||
mangledMethodIdx = true;
|
mangledMethodIdx = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,9 +838,9 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (methodDef->mCheckedKind == BfCheckedKind_Checked)
|
if (methodDef->mCheckedKind == BfCheckedKind_Checked)
|
||||||
name += "@CHK";
|
name += "`CHK";
|
||||||
else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked)
|
else if (methodDef->mCheckedKind == BfCheckedKind_Unchecked)
|
||||||
name += "@UCHK";
|
name += "`UCHK";
|
||||||
|
|
||||||
if ((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (!methodInst->mIsForeignMethodDef))
|
if ((methodInst->mMethodDef->mDeclaringType->mPartialIdx != -1) && (!methodInst->mIsForeignMethodDef))
|
||||||
{
|
{
|
||||||
|
@ -877,14 +873,14 @@ String BfGNUMangler::Mangle(BfMethodInstance* methodInst)
|
||||||
|
|
||||||
if ((methodInst->mMangleWithIdx) && (!mangledMethodIdx))
|
if ((methodInst->mMangleWithIdx) && (!mangledMethodIdx))
|
||||||
{
|
{
|
||||||
methodName += StrFormat("@%d", methodInst->mMethodDef->mIdx);
|
methodName += StrFormat("`%d", methodInst->mMethodDef->mIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
if ((prefixLen) && (methodInst->mMethodInstanceGroup->mOwner->mTypeDef->IsGlobalsContainer()) && (methodInst->mMethodDef->mMethodDeclaration == NULL))
|
if ((prefixLen) && (methodInst->mMethodInstanceGroup->mOwner->mTypeDef->IsGlobalsContainer()) && (methodInst->mMethodDef->mMethodDeclaration == NULL))
|
||||||
{
|
{
|
||||||
methodName += '@';
|
methodName += '`';
|
||||||
methodName += methodInst->mMethodInstanceGroup->mOwner->mTypeDef->mProject->mName;
|
methodName += methodInst->mMethodInstanceGroup->mOwner->mTypeDef->mProject->mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4319,12 +4319,12 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
{
|
{
|
||||||
BfMangler::MangleStaticFieldName(typeDataName, mCompiler->GetMangleKind(), typeInstance, "sBfTypeData");
|
BfMangler::MangleStaticFieldName(typeDataName, mCompiler->GetMangleKind(), typeInstance, "sBfTypeData");
|
||||||
if (typeInstance->mTypeDef->IsGlobalsContainer())
|
if (typeInstance->mTypeDef->IsGlobalsContainer())
|
||||||
typeDataName += "@" + typeInstance->mTypeDef->mProject->mName;
|
typeDataName += "`G`" + typeInstance->mTypeDef->mProject->mName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
typeDataName += "sBfTypeData.";
|
typeDataName += "sBfTypeData.";
|
||||||
BfMangler::Mangle(typeDataName, mCompiler->GetMangleKind(), type);
|
BfMangler::Mangle(typeDataName, mCompiler->GetMangleKind(), type, mContext->mScratchModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
int typeCode = BfTypeCode_None;
|
int typeCode = BfTypeCode_None;
|
||||||
|
@ -4460,7 +4460,7 @@ BfIRValue BfModule::CreateTypeData(BfType* type, Dictionary<int, int>& usedStrin
|
||||||
|
|
||||||
BfTypeDef* typeDef = typeInstance->mTypeDef;
|
BfTypeDef* typeDef = typeInstance->mTypeDef;
|
||||||
StringT<128> mangledName;
|
StringT<128> mangledName;
|
||||||
BfMangler::Mangle(mangledName, mCompiler->GetMangleKind(), typeInstance);
|
BfMangler::Mangle(mangledName, mCompiler->GetMangleKind(), typeInstance, typeInstance->mModule);
|
||||||
|
|
||||||
for (int methodIdx = 0; methodIdx < (int)typeDef->mMethods.size(); methodIdx++)
|
for (int methodIdx = 0; methodIdx < (int)typeDef->mMethods.size(); methodIdx++)
|
||||||
{
|
{
|
||||||
|
@ -13619,8 +13619,8 @@ void BfModule::CreateDllImportMethod()
|
||||||
|
|
||||||
BfIRCallingConv BfModule::GetCallingConvention(BfTypeInstance* typeInst, BfMethodDef* methodDef)
|
BfIRCallingConv BfModule::GetCallingConvention(BfTypeInstance* typeInst, BfMethodDef* methodDef)
|
||||||
{
|
{
|
||||||
if (mSystem->mPtrSize == 8)
|
if ((mCompiler->mOptions.mMachineType != BfMachineType_x86) || (mCompiler->mOptions.mPlatformType != BfPlatformType_Windows))
|
||||||
return BfIRCallingConv_CDecl;
|
return BfIRCallingConv_CDecl;
|
||||||
if (methodDef->mCallingConvention == BfCallingConvention_Stdcall)
|
if (methodDef->mCallingConvention == BfCallingConvention_Stdcall)
|
||||||
return BfIRCallingConv_StdCall;
|
return BfIRCallingConv_StdCall;
|
||||||
if ((!methodDef->mIsStatic) && (!typeInst->IsValuelessType()) &&
|
if ((!methodDef->mIsStatic) && (!typeInst->IsValuelessType()) &&
|
||||||
|
|
|
@ -3592,8 +3592,8 @@ BF_EXPORT void BF_CALLTYPE BfProject_SetDisabled(BfProject* bfProject, bool disa
|
||||||
bfProject->mDisabled = disabled;
|
bfProject->mDisabled = disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
BF_EXPORT void BF_CALLTYPE BfProject_SetOptions(BfProject* bfProject, int targetType, const char* startupObject, const char* preprocessorMacros,
|
BF_EXPORT void BF_CALLTYPE BfProject_SetOptions(BfProject* bfProject, int targetType, const char* startupObject, const char* preprocessorMacros,
|
||||||
int optLevel, int ltoType, BfProjectFlags flags)
|
int optLevel, int ltoType, int relocType, int picLevel, BfProjectFlags flags)
|
||||||
{
|
{
|
||||||
bfProject->mTargetType = (BfTargetType)targetType;
|
bfProject->mTargetType = (BfTargetType)targetType;
|
||||||
bfProject->mStartupObject = startupObject;
|
bfProject->mStartupObject = startupObject;
|
||||||
|
@ -3601,6 +3601,8 @@ BF_EXPORT void BF_CALLTYPE BfProject_SetOptions(BfProject* bfProject, int target
|
||||||
BfCodeGenOptions codeGenOptions;
|
BfCodeGenOptions codeGenOptions;
|
||||||
codeGenOptions.mOptLevel = (BfOptLevel)optLevel;
|
codeGenOptions.mOptLevel = (BfOptLevel)optLevel;
|
||||||
codeGenOptions.mLTOType = (BfLTOType)ltoType;
|
codeGenOptions.mLTOType = (BfLTOType)ltoType;
|
||||||
|
codeGenOptions.mRelocType = (BfRelocType)relocType;
|
||||||
|
codeGenOptions.mPICLevel = (BfPICLevel)picLevel;
|
||||||
codeGenOptions.mMergeFunctions = (flags & BfProjectFlags_MergeFunctions) != 0;
|
codeGenOptions.mMergeFunctions = (flags & BfProjectFlags_MergeFunctions) != 0;
|
||||||
codeGenOptions.mLoadCombine = (flags & BfProjectFlags_CombineLoads) != 0;
|
codeGenOptions.mLoadCombine = (flags & BfProjectFlags_CombineLoads) != 0;
|
||||||
codeGenOptions.mLoopVectorize = (flags & BfProjectFlags_VectorizeLoops) != 0;
|
codeGenOptions.mLoopVectorize = (flags & BfProjectFlags_VectorizeLoops) != 0;
|
||||||
|
|
|
@ -204,11 +204,22 @@ enum BfCustomAttributeFlags
|
||||||
BfCustomAttributeFlags_AlwaysIncludeTarget = 8
|
BfCustomAttributeFlags_AlwaysIncludeTarget = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BfPlatformType
|
||||||
|
{
|
||||||
|
BfPlatformType_Unknown,
|
||||||
|
BfPlatformType_Windows,
|
||||||
|
BfPlatformType_Linux,
|
||||||
|
BfPlatformType_macOS,
|
||||||
|
BfPlatformType_iOS,
|
||||||
|
BfPlatformType_Android,
|
||||||
|
};
|
||||||
|
|
||||||
enum BfMachineType
|
enum BfMachineType
|
||||||
{
|
{
|
||||||
BfMachineType_Unknown,
|
BfMachineType_Unknown,
|
||||||
BfMachineType_x86,
|
BfMachineType_x86,
|
||||||
BfMachineType_x64,
|
BfMachineType_x64,
|
||||||
|
BfMachineType_ARM,
|
||||||
BfMachineType_AArch64
|
BfMachineType_AArch64
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -265,6 +276,25 @@ enum BfCFLAAType
|
||||||
BfCFLAAType_Both
|
BfCFLAAType_Both
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum BfRelocType
|
||||||
|
{
|
||||||
|
BfRelocType_NotSet,
|
||||||
|
BfRelocType_Static,
|
||||||
|
BfRelocType_PIC,
|
||||||
|
BfRelocType_DynamicNoPIC,
|
||||||
|
BfRelocType_ROPI,
|
||||||
|
BfRelocType_RWPI,
|
||||||
|
BfRelocType_ROPI_RWPI
|
||||||
|
};
|
||||||
|
|
||||||
|
enum BfPICLevel
|
||||||
|
{
|
||||||
|
BfPICLevel_NotSet,
|
||||||
|
BfPICLevel_Not,
|
||||||
|
BfPICLevel_Small,
|
||||||
|
BfPICLevel_Big
|
||||||
|
};
|
||||||
|
|
||||||
struct BfCodeGenOptions
|
struct BfCodeGenOptions
|
||||||
{
|
{
|
||||||
bool mIsHotCompile;
|
bool mIsHotCompile;
|
||||||
|
@ -277,6 +307,8 @@ struct BfCodeGenOptions
|
||||||
int16 mVirtualMethodOfs;
|
int16 mVirtualMethodOfs;
|
||||||
int16 mDynSlotOfs;
|
int16 mDynSlotOfs;
|
||||||
|
|
||||||
|
BfRelocType mRelocType;
|
||||||
|
BfPICLevel mPICLevel;
|
||||||
BfSIMDSetting mSIMDSetting;
|
BfSIMDSetting mSIMDSetting;
|
||||||
BfOptLevel mOptLevel;
|
BfOptLevel mOptLevel;
|
||||||
BfLTOType mLTOType;
|
BfLTOType mLTOType;
|
||||||
|
@ -327,7 +359,9 @@ struct BfCodeGenOptions
|
||||||
mWriteLLVMIR = false;
|
mWriteLLVMIR = false;
|
||||||
mVirtualMethodOfs = 0;
|
mVirtualMethodOfs = 0;
|
||||||
mDynSlotOfs = 0;
|
mDynSlotOfs = 0;
|
||||||
|
|
||||||
|
mRelocType = BfRelocType_NotSet;
|
||||||
|
mPICLevel = BfPICLevel_NotSet;
|
||||||
mSIMDSetting = BfSIMDSetting_None;
|
mSIMDSetting = BfSIMDSetting_None;
|
||||||
mOptLevel = BfOptLevel_O0;
|
mOptLevel = BfOptLevel_O0;
|
||||||
mLTOType = BfLTOType_None;
|
mLTOType = BfLTOType_None;
|
||||||
|
@ -378,6 +412,8 @@ struct BfCodeGenOptions
|
||||||
hashCtx.Mixin(mVirtualMethodOfs);
|
hashCtx.Mixin(mVirtualMethodOfs);
|
||||||
hashCtx.Mixin(mDynSlotOfs);
|
hashCtx.Mixin(mDynSlotOfs);
|
||||||
|
|
||||||
|
hashCtx.Mixin(mRelocType);
|
||||||
|
hashCtx.Mixin(mPICLevel);
|
||||||
hashCtx.Mixin(mSIMDSetting);
|
hashCtx.Mixin(mSIMDSetting);
|
||||||
hashCtx.Mixin(mOptLevel);
|
hashCtx.Mixin(mOptLevel);
|
||||||
hashCtx.Mixin(mLTOType);
|
hashCtx.Mixin(mLTOType);
|
||||||
|
@ -950,7 +986,9 @@ enum BfTargetType
|
||||||
BfTargetType_CustomBuild,
|
BfTargetType_CustomBuild,
|
||||||
BfTargetType_C_ConsoleApplication,
|
BfTargetType_C_ConsoleApplication,
|
||||||
BfTargetType_C_WindowsApplication,
|
BfTargetType_C_WindowsApplication,
|
||||||
BfTargetType_BeefTest
|
BfTargetType_BeefTest,
|
||||||
|
BfTargetType_BeefApplication_StaticLib,
|
||||||
|
BfTargetType_BeefApplication_DynamicLib
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BfProjectFlags
|
enum BfProjectFlags
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
<GenerateDebugInformation>DebugFull</GenerateDebugInformation>
|
||||||
<OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
|
<OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
|
||||||
<AdditionalDependencies>rpcrt4.lib;cabinet.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;libcurl_a.lib;wininet.lib;LLVMMCDisassembler.lib;LLVMSupport.lib;LLVMMC.lib;LLVMObject.lib;LLVMCore.lib;LLVMBitReader.lib;LLVMAsmParser.lib;LLVMMCParser.lib;LLVMCodeGen.lib;LLVMTarget.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMSelectionDAG.lib;LLVMProfileData.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMAsmPrinter.lib;LLVMBitWriter.lib;LLVMVectorize.lib;LLVMipo.lib;LLVMInstrumentation.lib;LLVMDebugInfoDWARF.lib;LLVMDebugInfoPDB.lib;LLVMDebugInfoCodeView.lib;LLVMGlobalISel.lib;LLVMBinaryFormat.lib;LLVMLTO.lib;LLVMPasses.lib;LLVMLinker.lib;LLVMIRReader.lib;LLVMDemangle.lib;LLVMAggressiveInstCombine.lib;LLVMX86Info.lib;LLVMX86Utils.lib;LLVMX86AsmPrinter.lib;LLVMX86Desc.lib;LLVMX86CodeGen.lib;LLVMX86AsmParser.lib;LLVMX86Disassembler.lib;LLVMAArch64Info.lib;LLVMAArch64Utils.lib;LLVMAArch64AsmPrinter.lib;LLVMAArch64Desc.lib;LLVMAArch64CodeGen.lib;LLVMAArch64AsmParser.lib;LLVMAArch64Disassembler.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>rpcrt4.lib;cabinet.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;libcurl_a.lib;wininet.lib;LLVMMCDisassembler.lib;LLVMSupport.lib;LLVMMC.lib;LLVMObject.lib;LLVMCore.lib;LLVMBitReader.lib;LLVMAsmParser.lib;LLVMMCParser.lib;LLVMCodeGen.lib;LLVMTarget.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMSelectionDAG.lib;LLVMProfileData.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMAsmPrinter.lib;LLVMBitWriter.lib;LLVMVectorize.lib;LLVMipo.lib;LLVMInstrumentation.lib;LLVMDebugInfoDWARF.lib;LLVMDebugInfoPDB.lib;LLVMDebugInfoCodeView.lib;LLVMGlobalISel.lib;LLVMBinaryFormat.lib;LLVMLTO.lib;LLVMPasses.lib;LLVMLinker.lib;LLVMIRReader.lib;LLVMDemangle.lib;LLVMAggressiveInstCombine.lib;LLVMX86Info.lib;LLVMX86Utils.lib;LLVMX86AsmPrinter.lib;LLVMX86Desc.lib;LLVMX86CodeGen.lib;LLVMX86AsmParser.lib;LLVMX86Disassembler.lib;LLVMAArch64Info.lib;LLVMAArch64Utils.lib;LLVMAArch64AsmPrinter.lib;LLVMAArch64Desc.lib;LLVMAArch64CodeGen.lib;LLVMAArch64AsmParser.lib;LLVMAArch64Disassembler.lib;LLVMARMInfo.lib;LLVMARMUtils.lib;LLVMARMAsmPrinter.lib;LLVMARMDesc.lib;LLVMARMCodeGen.lib;LLVMARMAsmParser.lib;LLVMARMDisassembler.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>..\extern\llvm_win64_8_0_1\Debug\lib; ..\extern\curl\builds\libcurl-vc15-x64-release-static-zlib-static-ipv6-sspi-winssl\lib;..\extern\curl\deps\lib;..\extern\jemalloc_win\x64\debug</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\extern\llvm_win64_8_0_1\Debug\lib; ..\extern\curl\builds\libcurl-vc15-x64-release-static-zlib-static-ipv6-sspi-winssl\lib;..\extern\curl\deps\lib;..\extern\jemalloc_win\x64\debug</AdditionalLibraryDirectories>
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
<ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
|
<ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
<OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
|
<OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
|
||||||
<AdditionalLibraryDirectories>..\extern\llvm_win64_8_0_1\Release\lib; ..\extern\curl\builds\libcurl-vc15-x64-release-static-zlib-static-ipv6-sspi-winssl\lib;..\extern\curl\deps\lib;..\extern\jemalloc_win\x64\release</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>..\extern\llvm_win64_8_0_1\Release\lib; ..\extern\curl\builds\libcurl-vc15-x64-release-static-zlib-static-ipv6-sspi-winssl\lib;..\extern\curl\deps\lib;..\extern\jemalloc_win\x64\release</AdditionalLibraryDirectories>
|
||||||
<AdditionalDependencies>rpcrt4.lib;cabinet.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;libcurl_a.lib;wininet.lib;LLVMMCDisassembler.lib;LLVMSupport.lib;LLVMMC.lib;LLVMObject.lib;LLVMCore.lib;LLVMBitReader.lib;LLVMAsmParser.lib;LLVMMCParser.lib;LLVMCodeGen.lib;LLVMTarget.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMSelectionDAG.lib;LLVMProfileData.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMAsmPrinter.lib;LLVMBitWriter.lib;LLVMVectorize.lib;LLVMipo.lib;LLVMInstrumentation.lib;LLVMDebugInfoDWARF.lib;LLVMDebugInfoPDB.lib;LLVMDebugInfoCodeView.lib;LLVMGlobalISel.lib;LLVMBinaryFormat.lib;LLVMLTO.lib;LLVMPasses.lib;LLVMLinker.lib;LLVMIRReader.lib;LLVMDemangle.lib;LLVMAggressiveInstCombine.lib;LLVMX86Info.lib;LLVMX86Utils.lib;LLVMX86AsmPrinter.lib;LLVMX86Desc.lib;LLVMX86CodeGen.lib;LLVMX86AsmParser.lib;LLVMX86Disassembler.lib;LLVMAArch64Info.lib;LLVMAArch64Utils.lib;LLVMAArch64AsmPrinter.lib;LLVMAArch64Desc.lib;LLVMAArch64CodeGen.lib;LLVMAArch64AsmParser.lib;LLVMAArch64Disassembler.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>rpcrt4.lib;cabinet.lib;winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;libcurl_a.lib;wininet.lib;LLVMMCDisassembler.lib;LLVMSupport.lib;LLVMMC.lib;LLVMObject.lib;LLVMCore.lib;LLVMBitReader.lib;LLVMAsmParser.lib;LLVMMCParser.lib;LLVMCodeGen.lib;LLVMTarget.lib;LLVMScalarOpts.lib;LLVMInstCombine.lib;LLVMSelectionDAG.lib;LLVMProfileData.lib;LLVMTransformUtils.lib;LLVMAnalysis.lib;LLVMAsmPrinter.lib;LLVMBitWriter.lib;LLVMVectorize.lib;LLVMipo.lib;LLVMInstrumentation.lib;LLVMDebugInfoDWARF.lib;LLVMDebugInfoPDB.lib;LLVMDebugInfoCodeView.lib;LLVMGlobalISel.lib;LLVMBinaryFormat.lib;LLVMLTO.lib;LLVMPasses.lib;LLVMLinker.lib;LLVMIRReader.lib;LLVMDemangle.lib;LLVMAggressiveInstCombine.lib;LLVMX86Info.lib;LLVMX86Utils.lib;LLVMX86AsmPrinter.lib;LLVMX86Desc.lib;LLVMX86CodeGen.lib;LLVMX86AsmParser.lib;LLVMX86Disassembler.lib;LLVMAArch64Info.lib;LLVMAArch64Utils.lib;LLVMAArch64AsmPrinter.lib;LLVMAArch64Desc.lib;LLVMAArch64CodeGen.lib;LLVMAArch64AsmParser.lib;LLVMAArch64Disassembler.lib;LLVMARMInfo.lib;LLVMARMUtils.lib;LLVMARMAsmPrinter.lib;LLVMARMDesc.lib;LLVMARMCodeGen.lib;LLVMARMAsmParser.lib;LLVMARMDisassembler.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||||
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
<FullProgramDatabaseFile>true</FullProgramDatabaseFile>
|
||||||
<ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
|
<ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
|
||||||
|
|
210
bin/build_android.bat
Normal file
210
bin/build_android.bat
Normal file
|
@ -0,0 +1,210 @@
|
||||||
|
PUSHD %~dp0..\
|
||||||
|
|
||||||
|
SET NDK=C:\Users\Brian\AppData\Local\Android\Sdk\ndk\20.0.5594570
|
||||||
|
SET NINJA=C:\Users\Brian\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe
|
||||||
|
@REM SET NDK=C:\NVPACK\android-ndk-r14b
|
||||||
|
|
||||||
|
@REM i686-none-linux-android16
|
||||||
|
@REM i686-linux-android armv7-none-linux-androideabi16
|
||||||
|
|
||||||
|
cd builds
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
|
||||||
|
@IF EXIST android_x86 GOTO DO_BUILD
|
||||||
|
|
||||||
|
mkdir android_x86_d
|
||||||
|
cd android_x86_d
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=x86 ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=x86 ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_x86
|
||||||
|
cd android_x86
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=x86 ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=x86 ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_x86_64_d
|
||||||
|
cd android_x86_64_d
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=x86_64 ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=x86_64 ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_x86_64
|
||||||
|
cd android_x86_64
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=x86_64 ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=x86_64 ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_arm_d
|
||||||
|
cd android_arm_d
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=armeabi-v7a ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_arm
|
||||||
|
cd android_arm
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=armeabi-v7a ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-16 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=armeabi-v7a ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=16 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_arm64_d
|
||||||
|
cd android_arm64_d
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=arm64-v8a ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-21 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=21 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
mkdir android_arm64
|
||||||
|
cd android_arm64
|
||||||
|
cmake -GNinja ^
|
||||||
|
-DANDROID_ABI:UNINITIALIZED=arm64-v8a ^
|
||||||
|
-DANDROID_NDK=%NDK% ^
|
||||||
|
-DANDROID_PLATFORM=android-21 ^
|
||||||
|
-DCMAKE_ANDROID_ARCH_ABI=arm64-v8a ^
|
||||||
|
-DCMAKE_ANDROID_NDK=%NDK% ^
|
||||||
|
-DCMAKE_SYSTEM_NAME=Android ^
|
||||||
|
-DCMAKE_SYSTEM_VERSION=21 ^
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=%NDK%\build\cmake\android.toolchain.cmake ^
|
||||||
|
-DCMAKE_MAKE_PROGRAM=%NINJA% ^
|
||||||
|
-DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
..\..\BeefRT
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
:DO_BUILD
|
||||||
|
|
||||||
|
cd android_x86_d
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_x86
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_x86_64_d
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_x86_64
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_arm_d
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_arm
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_arm64_d
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cd android_arm64
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cmake --build .
|
||||||
|
@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
:SUCCESS
|
||||||
|
@ECHO SUCCESS!
|
||||||
|
@POPD
|
||||||
|
@EXIT /b 0
|
||||||
|
|
||||||
|
:HADERROR
|
||||||
|
@ECHO =================FAILED=================
|
||||||
|
@POPD
|
||||||
|
@EXIT /b %ERRORLEVEL%
|
Loading…
Add table
Add a link
Reference in a new issue