diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml new file mode 100644 index 00000000..79c3b51e --- /dev/null +++ b/.github/workflows/linux_builds.yml @@ -0,0 +1,47 @@ +name: 🏁 Linux Builds +on: + push: + branches: [ master, main, github_actions_brook ] + +env: + BUILD_TYPE: release + +jobs: + windows-compilation: + name: Linux Compilation + runs-on: "ubuntu-20.04" + steps: + + # Checkout project + - uses: actions/checkout@v2 + + # Create a build directory to store all the CMake generated files + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{github.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Tests + working-directory: ${{github.workspace}}/build + shell: bash + run: ctest . -C $BUILD_TYPE -V + + - name: Install + working-directory: ${{github.workspace}}/build + shell: bash + run: cmake --install . --config $BUILD_TYPE --prefix bin + + - name: Upload Artifacts + uses: actions/upload-artifact@v1 + with: + name: win64 + path: build/bin/ \ No newline at end of file diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml new file mode 100644 index 00000000..23442d53 --- /dev/null +++ b/.github/workflows/macos_builds.yml @@ -0,0 +1,47 @@ +name: 🏁 MacOS Builds +on: + push: + branches: [ master, main, github_actions_brook ] + +env: + BUILD_TYPE: release + +jobs: + windows-compilation: + name: MacOS Compilation + runs-on: "macos-latest" + steps: + + # Checkout project + - uses: actions/checkout@v2 + + # Create a build directory to store all the CMake generated files + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{github.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Tests + working-directory: ${{github.workspace}}/build + shell: bash + run: ctest . -C $BUILD_TYPE -V + + - name: Install + working-directory: ${{github.workspace}}/build + shell: bash + run: cmake --install . --config $BUILD_TYPE --prefix bin + + - name: Upload Artifacts + uses: actions/upload-artifact@v1 + with: + name: win64 + path: build/bin/ \ No newline at end of file diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml new file mode 100644 index 00000000..3c1af122 --- /dev/null +++ b/.github/workflows/windows_builds.yml @@ -0,0 +1,47 @@ +name: 🏁 Windows Builds +on: + push: + branches: [ master, main, github_actions_brook ] + +env: + BUILD_TYPE: release + +jobs: + windows-compilation: + name: Windows Compilation + runs-on: "windows-latest" + steps: + + # Checkout project + - uses: actions/checkout@v2 + + # Create a build directory to store all the CMake generated files + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{github.workspace}}/build + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{github.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Tests + working-directory: ${{github.workspace}}/build + shell: bash + run: ctest . -C $BUILD_TYPE -V + + - name: Install + working-directory: ${{github.workspace}}/build + shell: bash + run: cmake --install . --config $BUILD_TYPE --prefix bin + + - name: Upload Artifacts + uses: actions/upload-artifact@v1 + with: + name: win64 + path: build/bin/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5e26d5f3..b0c621a7 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,7 @@ inkcpp_cl/*.ink Documentation/* # Output -Build/* \ No newline at end of file +Build/* +build/* +bin/ +Bin/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b601742d..47812713 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ cmake_minimum_required(VERSION 3.16) +# Testing enabled +enable_testing() + # Project setup project(inkcpp VERSION 0.1) diff --git a/inkcpp/string_table.cpp b/inkcpp/string_table.cpp index 51a602bf..29601991 100644 --- a/inkcpp/string_table.cpp +++ b/inkcpp/string_table.cpp @@ -19,7 +19,7 @@ namespace ink::runtime::internal // Add to the tree bool success = _table.insert(data, true); // TODO: Should it start as used? - assert(success, "Duplicate string pointer in the string_table. How is that possible?"); + inkAssert(success, "Duplicate string pointer in the string_table. How is that possible?"); if (!success) { delete[] data; diff --git a/inkcpp/system.cpp b/inkcpp/system.cpp index 2136f825..a2adda4b 100644 --- a/inkcpp/system.cpp +++ b/inkcpp/system.cpp @@ -26,7 +26,7 @@ namespace ink *(buf++) = 0; } - void assert(bool condition, const char* msg /*= nullptr*/) + void ink_assert(bool condition, const char* msg /*= nullptr*/) { if (!condition) throw ink_exception(msg); diff --git a/inkcpp_test/CMakeLists.txt b/inkcpp_test/CMakeLists.txt index 031667f4..7e666ab4 100644 --- a/inkcpp_test/CMakeLists.txt +++ b/inkcpp_test/CMakeLists.txt @@ -6,4 +6,6 @@ add_executable(inkcpp_test catch.hpp Main.cpp Restorable.cpp ) -target_link_libraries(inkcpp_test PUBLIC inkcpp) \ No newline at end of file +target_link_libraries(inkcpp_test PUBLIC inkcpp) + +add_test(NAME UnitTests COMMAND $) \ No newline at end of file diff --git a/shared/public/system.h b/shared/public/system.h index 7b01dad7..20197f22 100644 --- a/shared/public/system.h +++ b/shared/public/system.h @@ -13,8 +13,6 @@ #include #endif -#undef assert - namespace ink { typedef unsigned int uint32_t; @@ -97,10 +95,10 @@ namespace ink // assert #ifndef INK_ENABLE_UNREAL - void assert(bool condition, const char* msg = nullptr); - [[ noreturn ]] inline void assert(const char* msg = nullptr) { assert(false, msg); } + void ink_assert(bool condition, const char* msg = nullptr); + [[ noreturn ]] inline void ink_assert(const char* msg = nullptr) { ink_assert(false, msg); } #else - [[ noreturn ]] inline void fail(const char*) { check(false); throw nullptr; } + [[ noreturn ]] inline void ink_fail(const char*) { check(false); throw nullptr; } #endif #ifdef INK_ENABLE_STL @@ -130,9 +128,9 @@ namespace ink #ifdef INK_ENABLE_UNREAL #define inkZeroMemory(buff, len) FMemory::Memset(buff, 0, len) #define inkAssert(condition, text) checkf(condition, TEXT(text)) -#define inkFail(text) ink::fail(text) +#define inkFail(text) ink::ink_fail(text) #else #define inkZeroMemory ink::zero_memory -#define inkAssert ink::assert -#define inkFail(text) ink::assert(text) +#define inkAssert ink::ink_assert +#define inkFail(text) ink::ink_assert(text) #endif