From ece9c1f5eb99c1d46d53418b33b25945ab99ac24 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sun, 11 Aug 2019 16:05:14 +0200 Subject: [PATCH] Support for Windows builds --- .drone.yml | 16 ++++++++++------ CMakeLists.txt | 5 +++++ src/Binder/BoundExpressions/BoundExpression.hpp | 2 +- src/Binder/BoundStatements/BoundStatement.hpp | 2 +- src/Diagnostics/DiagnosticCode.hpp | 2 +- src/EvaluateResult.hpp | 4 ++-- src/ScriptOptions.cpp | 5 +++-- src/UserData/UserDataStorage.hpp | 2 +- 8 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9813489..d03ed23 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,9 +17,13 @@ steps: - build-release/PorygonLangTests -s --durations yes --use-colour yes - valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --leak-resolution=med --track-origins=yes --vgdb=no --error-exitcode=1 build-release/PorygonLangTests -# - name: test-release-windows -# image: deukhoofd/dockcross-windows -# commands: -# - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release -# - cmake --build build-release --target all -- -j 4 -# - build-release/PorygonLangTests -s + - name: test-release-windows + image: deukhoofd/windowsbuilder + commands: + - update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix + - update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix + - update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix + - update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix + - cmake -DCMAKE_BUILD_TYPE=Release . -B build-release -D + - cmake --build build-release-windows --target all -- -j 4 + - wine build-release-windows/PorygonLangTests.exe -s diff --git a/CMakeLists.txt b/CMakeLists.txt index c9bf979..dbdc163 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,4 +14,9 @@ add_executable(PorygonLangTests ${SRC_FILES} ${TEST_FILES}) +if (WINDOWS) + target_link_libraries(PorygonLang -static) + target_link_libraries(PorygonLangTests -static) +endif(WINDOWS) + target_compile_definitions(PorygonLangTests PRIVATE TESTS_BUILD) \ No newline at end of file diff --git a/src/Binder/BoundExpressions/BoundExpression.hpp b/src/Binder/BoundExpressions/BoundExpression.hpp index aed00cc..e1b75b3 100644 --- a/src/Binder/BoundExpressions/BoundExpression.hpp +++ b/src/Binder/BoundExpressions/BoundExpression.hpp @@ -12,7 +12,7 @@ using namespace std; namespace Porygon::Binder { - enum class BoundExpressionKind : u_int8_t { + enum class BoundExpressionKind : uint8_t { Bad, LiteralInteger, diff --git a/src/Binder/BoundStatements/BoundStatement.hpp b/src/Binder/BoundStatements/BoundStatement.hpp index 8cdb96f..b0e5534 100644 --- a/src/Binder/BoundStatements/BoundStatement.hpp +++ b/src/Binder/BoundStatements/BoundStatement.hpp @@ -10,7 +10,7 @@ using namespace std; namespace Porygon::Binder { - enum class BoundStatementKind : u_int8_t { + enum class BoundStatementKind : uint8_t { Bad, Break, Script, diff --git a/src/Diagnostics/DiagnosticCode.hpp b/src/Diagnostics/DiagnosticCode.hpp index 38ee2cb..8a4464c 100644 --- a/src/Diagnostics/DiagnosticCode.hpp +++ b/src/Diagnostics/DiagnosticCode.hpp @@ -3,7 +3,7 @@ #define PORYGONLANG_DIAGNOSTICCODE_HPP namespace Porygon::Diagnostics { - enum class DiagnosticCode : u_int8_t { + enum class DiagnosticCode : uint8_t { // Lex diagnostics UnexpectedCharacter, InvalidStringControlCharacter, diff --git a/src/EvaluateResult.hpp b/src/EvaluateResult.hpp index 7de7447..1b9a4b3 100644 --- a/src/EvaluateResult.hpp +++ b/src/EvaluateResult.hpp @@ -9,7 +9,7 @@ namespace Porygon{ struct EvaluateResult{ const Evaluation::EvalValue* _value; - const u_int8_t _result; + const uint8_t _result; char * _errorMessage; const size_t _errorSize; public: @@ -38,7 +38,7 @@ namespace Porygon{ return _value; } - [[nodiscard]] u_int8_t GetResult() const{ + [[nodiscard]] uint8_t GetResult() const{ return _result; } diff --git a/src/ScriptOptions.cpp b/src/ScriptOptions.cpp index 1d3987c..88d9316 100644 --- a/src/ScriptOptions.cpp +++ b/src/ScriptOptions.cpp @@ -1,6 +1,6 @@ #include -#include #include +#include #include "ScriptOptions.hpp" #include "Utilities/StringUtils.hpp" #include "Script.hpp" @@ -15,7 +15,8 @@ void Porygon::ScriptOptions::DefaultPrint(const char16_t *s) { } bool Porygon::ScriptOptions::DefaultModuleExists(const std::string& moduleName) { - return std::filesystem::exists(moduleName); + struct stat buffer; + return (stat (moduleName.c_str(), &buffer) == 0); } Porygon::Script *Porygon::ScriptOptions::DefaultResolveModule(const std::string& moduleName) { diff --git a/src/UserData/UserDataStorage.hpp b/src/UserData/UserDataStorage.hpp index e266177..605125a 100644 --- a/src/UserData/UserDataStorage.hpp +++ b/src/UserData/UserDataStorage.hpp @@ -3,8 +3,8 @@ #define PORYGONLANG_USERDATASTORAGE_HPP #include -#include #include "UserData.hpp" +#include namespace Porygon::UserData { class UserDataStorage {