From 34351b1e25daad7b58d2823aea219b4020569b7a Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 11:25:25 -0800 Subject: [PATCH 1/8] Testing CMake windows build --- .github/workflows/windows_builds.yml | 31 ++++++++++++++++++++++++++++ .gitignore | 3 ++- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/windows_builds.yml diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml new file mode 100644 index 00000000..49681872 --- /dev/null +++ b/.github/workflows/windows_builds.yml @@ -0,0 +1,31 @@ +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 diff --git a/.gitignore b/.gitignore index 5e26d5f3..1ddc3184 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ inkcpp_cl/*.ink Documentation/* # Output -Build/* \ No newline at end of file +Build/* +build/* \ No newline at end of file From a5293533922ad05291f98ae2e028b8e7d9f92d21 Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 11:37:06 -0800 Subject: [PATCH 2/8] Artifacts test for Windows --- .github/workflows/windows_builds.yml | 11 +++++++++++ .gitignore | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 49681872..d632b8ef 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -29,3 +29,14 @@ jobs: shell: bash # Execute the build. You can specify a specific target with "--target " run: cmake --build . --config $BUILD_TYPE + + - name: Install + working-directory: ${{github.workspace}}/build + shell: bash + run: cmake --install . --config $BUILD_TYPE --prefix ${{github.workspace}}/bin + + - name: Upload Artifacts + uses: actions/upload-artifacts@v1 + with: + name: win64 + path: bin/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1ddc3184..b0c621a7 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ Documentation/* # Output Build/* -build/* \ No newline at end of file +build/* +bin/ +Bin/ \ No newline at end of file From b6e42c0066a4b0c6721a5c3ba12138f40238df3c Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 11:38:58 -0800 Subject: [PATCH 3/8] Typo in action --- .github/workflows/windows_builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index d632b8ef..5c9bce0f 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -36,7 +36,7 @@ jobs: run: cmake --install . --config $BUILD_TYPE --prefix ${{github.workspace}}/bin - name: Upload Artifacts - uses: actions/upload-artifacts@v1 + uses: actions/upload-artifact@v1 with: name: win64 path: bin/ \ No newline at end of file From 06e92e77dfb6e4f034a1c8157fabd635a1d5a537 Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 11:42:34 -0800 Subject: [PATCH 4/8] Trying to fix install path --- .github/workflows/windows_builds.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 5c9bce0f..05bbb165 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -33,10 +33,10 @@ jobs: - name: Install working-directory: ${{github.workspace}}/build shell: bash - run: cmake --install . --config $BUILD_TYPE --prefix ${{github.workspace}}/bin + run: cmake --install . --config $BUILD_TYPE --prefix bin - name: Upload Artifacts uses: actions/upload-artifact@v1 with: name: win64 - path: bin/ \ No newline at end of file + path: build/bin/ \ No newline at end of file From 9331e866eec33ace4284701d4b77eb77a52e4c4d Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 11:49:19 -0800 Subject: [PATCH 5/8] Linux and MacOS builds --- .github/workflows/linux_builds.yml | 42 ++++++++++++++++++++++++++++++ .github/workflows/macos_builds.yml | 42 ++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 .github/workflows/linux_builds.yml create mode 100644 .github/workflows/macos_builds.yml diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml new file mode 100644 index 00000000..7aa372c0 --- /dev/null +++ b/.github/workflows/linux_builds.yml @@ -0,0 +1,42 @@ +name: 🏁 Linux Builds +on: + push: + branches: [ master, main, github_actions_brook ] + +env: + BUILD_TYPE: release + +jobs: + windows-compilation: + name: Linux Compilation + runs-on: "ubuntu-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: 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..fb3014d9 --- /dev/null +++ b/.github/workflows/macos_builds.yml @@ -0,0 +1,42 @@ +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: 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 From 392228488e0a227b126b1787efb777877c00bf1d Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 12:01:59 -0800 Subject: [PATCH 6/8] Testing in Github Actions --- .github/workflows/linux_builds.yml | 5 +++++ .github/workflows/macos_builds.yml | 5 +++++ .github/workflows/windows_builds.yml | 5 +++++ CMakeLists.txt | 3 +++ inkcpp_test/CMakeLists.txt | 4 +++- 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index 7aa372c0..ce107075 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -30,6 +30,11 @@ jobs: # 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 diff --git a/.github/workflows/macos_builds.yml b/.github/workflows/macos_builds.yml index fb3014d9..23442d53 100644 --- a/.github/workflows/macos_builds.yml +++ b/.github/workflows/macos_builds.yml @@ -30,6 +30,11 @@ jobs: # 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 diff --git a/.github/workflows/windows_builds.yml b/.github/workflows/windows_builds.yml index 05bbb165..3c1af122 100644 --- a/.github/workflows/windows_builds.yml +++ b/.github/workflows/windows_builds.yml @@ -30,6 +30,11 @@ jobs: # 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 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_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 From c0982c6452da99957df02d0916e6d7a6f42aa081 Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 12:18:36 -0800 Subject: [PATCH 7/8] Changed name of assert function to avoid mac errors --- .github/workflows/linux_builds.yml | 2 +- inkcpp/string_table.cpp | 2 +- inkcpp/system.cpp | 2 +- shared/public/system.h | 12 ++++++------ 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux_builds.yml b/.github/workflows/linux_builds.yml index ce107075..79c3b51e 100644 --- a/.github/workflows/linux_builds.yml +++ b/.github/workflows/linux_builds.yml @@ -9,7 +9,7 @@ env: jobs: windows-compilation: name: Linux Compilation - runs-on: "ubuntu-latest" + runs-on: "ubuntu-20.04" steps: # Checkout project 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/shared/public/system.h b/shared/public/system.h index 7b01dad7..b74fce8c 100644 --- a/shared/public/system.h +++ b/shared/public/system.h @@ -97,10 +97,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 +130,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 From ab79afa74898bc5ae0c1ad4bb55a7adf6db6acf7 Mon Sep 17 00:00:00 2001 From: Brook Warner Jensen Date: Thu, 4 Feb 2021 12:18:56 -0800 Subject: [PATCH 8/8] removing undef --- shared/public/system.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/shared/public/system.h b/shared/public/system.h index b74fce8c..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;