From 88d253a41bd85f01ae22118237e286b0907888df Mon Sep 17 00:00:00 2001 From: Pavel Samolysov Date: Fri, 27 Sep 2019 11:20:17 +0300 Subject: [PATCH] Adopt TVM for Windows The following changes updates tVM for Windows and allow building and using tVM on this OS: - DLL Exports are defined in the include/tvm/Visibility.hpp, core classes from tVM are marked as 'TVM_API' - Exceptions are enabled (the '/EHsc' parameter has been added) - Two string manipulation methods: and are defined. Signed-off-by: Pavel Samolysov --- CMakeLists.txt | 4 ++++ tvm-run/main.cpp | 5 +++++ tvm/CMakeLists.txt | 5 +++++ tvm/include/tvm/BytecodeParser.hpp | 5 +++-- tvm/include/tvm/Compiler.hpp | 15 +++++++++++++++ tvm/include/tvm/Module.hpp | 3 ++- tvm/include/tvm/VirtualMachine.hpp | 7 ++++--- tvm/include/tvm/Visibility.hpp | 20 ++++++++++++++++++++ tvm/include/tvm/instructions.hpp | 1 + 9 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 tvm/include/tvm/Visibility.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e2fd11..8a6e036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,5 +7,9 @@ project(tVM set(CMAKE_CXX_STANDARD 14) +if (WIN32) + set(CMAKE_CXX_FLAGS "/EHsc") +endif() + add_subdirectory(tvm) add_subdirectory(tvm-run) diff --git a/tvm-run/main.cpp b/tvm-run/main.cpp index e37e0b5..7619023 100644 --- a/tvm-run/main.cpp +++ b/tvm-run/main.cpp @@ -5,6 +5,11 @@ #include "tvm/ExecutionContext.hpp" #include "tvm/BytecodeParser.hpp" +#ifdef _MSC_VER +#define strncasecmp _strnicmp +#define strcasecmp _stricmp +#endif + /// tvm-run's usage string. Printed when run with -help. static const char* usage = "Usage: tvm-run [