Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: added windows and osx builds as well as tests to the github pipelines #57

Merged
merged 5 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,33 @@ on:
- master

jobs:
linux:
runs-on: ubuntu-latest
build:
runs-on: ${{ matrix.platform.os }}
name: ${{ matrix.platform.name }}

steps:
- uses: actions/checkout@v3

- name: Linux
- name: Build
run: |
g++ -Wall -Wextra -pedantic apps/vox2fbx.cpp
g++ -Wall -Wextra -pedantic apps/vox2obj.cpp
g++ -Wall -Wextra -pedantic apps/voxmerge.cpp
g++ -Wall -Wextra -pedantic apps/voxseparate.cpp
cmake .
cmake --build . --config Release
cmake --install . --prefix opengametools-install

- name: Test
run: |
ctest -V -C Release .

- name: Upload the build artifacts
uses: actions/upload-artifact@v3
with:
name: opengametools-${{ matrix.platform.name }}
path: opengametools-install

strategy:
fail-fast: false
matrix:
platform:
- { name: Windows, os: windows-2022 }
- { name: Ubuntu, os: ubuntu-latest }
- { name: MacOS, os: macos-latest }
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/vox2fbx
/vox2obj
/voxmerge
/voxseparate
/build

25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
project(opengametools CXX)

set(APPS
apps/vox2fbx.cpp
apps/vox2obj.cpp
apps/voxmerge.cpp
apps/voxseparate.cpp
demo/demo_vox.cpp
)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED on)

foreach (app ${APPS})
get_filename_component(APP_NAME ${app} NAME_WE)
add_executable(${APP_NAME} ${app})
target_compile_options(${APP_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4>
$<$<CXX_COMPILER_ID:GNU>:-Wall -Wextra -Wpedantic>
)
install(TARGETS ${APP_NAME} DESTINATION bin)
endforeach()

include(CTest)
add_test(NAME test_multiple_model_scene COMMAND $<TARGET_FILE:demo_vox> ${CMAKE_CURRENT_SOURCE_DIR}/demo/vox/test_multiple_model_scene.vox)
18 changes: 15 additions & 3 deletions demo/demo_vox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ uint32_t count_solid_voxels_in_model(const ogt_vox_model* model)
return solid_voxel_count;
}

void demo_load_and_save()
bool demo_load_and_save(const char *filename)
{
const ogt_vox_scene* scene = load_vox_scene_with_groups("vox/test_groups.vox");
const ogt_vox_scene* scene = load_vox_scene_with_groups(filename);
if (scene)
{
printf("#layers: %u\n", scene->num_layers);
Expand Down Expand Up @@ -170,7 +170,10 @@ void demo_load_and_save()
save_vox_scene("saved.vox", scene);

ogt_vox_destroy_scene(scene);
return true;
}
fprintf(stderr, "Failed to load %s\n", filename);
return false;
}

// demonstrates merging multiple scenes together
Expand Down Expand Up @@ -216,8 +219,17 @@ void demo_merge_scenes()

int main(int argc, char** argv)
{
demo_load_and_save();
const char *filename = "vox/test_groups.vox";
if (argc == 2)
{
filename = argv[1];
}
if (!demo_load_and_save(filename))
{
return 1;
}
demo_merge_scenes();
return 0;
}

/* -------------------------------------------------------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions src/ogt_vox.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@
#include <inttypes.h>
#elif __APPLE__
// general Apple compiler
#include <stdint.h>
#include <limits.h>
#include <stdlib.h> // for size_t
#elif defined(__GNUC__)
// any GCC*
#include <inttypes.h>
Expand Down