diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000..57b93ed --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,21 @@ +name: CMake + +on: + push: + pull_request: + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: Build + run: ci/build.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 36510d2..8a74978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,4 +8,6 @@ include_directories( . ) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror") + add_subdirectory(examples) diff --git a/ci/build.sh b/ci/build.sh new file mode 100755 index 0000000..de0c0fa --- /dev/null +++ b/ci/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cmake -S . -B build +cmake --build build -j diff --git a/examples/c/character.cmake b/examples/c/character.cmake index bcbea53..9b9bf2e 100644 --- a/examples/c/character.cmake +++ b/examples/c/character.cmake @@ -1,3 +1,6 @@ add_executable( character - character.c) + character.c +) + +target_link_libraries(character m) diff --git a/examples/c/geometry.cmake b/examples/c/geometry.cmake index 109983c..eb8ec0a 100644 --- a/examples/c/geometry.cmake +++ b/examples/c/geometry.cmake @@ -1,3 +1,6 @@ add_executable( geometry - geometry.c) + geometry.c +) + +target_link_libraries(geometry m) diff --git a/examples/c/logo.c b/examples/c/logo.c index 2ae6595..c225288 100644 --- a/examples/c/logo.c +++ b/examples/c/logo.c @@ -322,7 +322,7 @@ int main() { } uint64_t end = time_ms(); - printf("render time: %llums", end - start); + printf("render time: %lums", end - start); diff --git a/examples/c/logo.cmake b/examples/c/logo.cmake index 44eb065..5ddcc64 100644 --- a/examples/c/logo.cmake +++ b/examples/c/logo.cmake @@ -2,3 +2,5 @@ add_executable( logo logo.c ) + +target_link_libraries(logo m) diff --git a/pretty-poly.h b/pretty-poly.h index 7890a6c..647b3c8 100644 --- a/pretty-poly.h +++ b/pretty-poly.h @@ -260,7 +260,7 @@ pp_rect_t pp_polygon_bounds(pp_poly_t *p) { // buffer that each tile is rendered into before callback // allocate one extra byte to allow a small optimization in the row renderer const uint32_t tile_buffer_size = PP_TILE_BUFFER_SIZE; -uint8_t tile_buffer[tile_buffer_size + 1]; +uint8_t tile_buffer[PP_TILE_BUFFER_SIZE + 1]; // polygon node buffer handles at most 16 line intersections per scanline // is this enough for cjk/emoji? (requires a 2kB buffer)