diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c00a474..cc2b211 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,9 +8,11 @@ jobs: steps: - uses: actions/checkout@v3 + with: + lfs: 'true' - name: Install Deps - run: sudo apt-get install -y ninja-build libsdl2-dev + run: sudo apt-get install -y ninja-build libsdl2-dev xxd - name: Configure CMake run: cmake --preset dev-host @@ -19,7 +21,7 @@ jobs: run: cmake --build build/host - name: Test - run: ctest --test-dir build/host + run: ctest --test-dir build/host --output-on-failure build: runs-on: ubuntu-latest @@ -27,7 +29,12 @@ jobs: image: ghcr.io/toltec-dev/base:v2.3 steps: - - uses: actions/checkout@v2 + - name: Install Deps + run: apt-get update && apt-get install -y git + + - uses: actions/checkout@v3 + with: + lfs: 'true' - name: Configure CMake run: cmake --preset release-toltec diff --git a/libs/rMlib/CMakeLists.txt b/libs/rMlib/CMakeLists.txt index 676b08f..4651cff 100644 --- a/libs/rMlib/CMakeLists.txt +++ b/libs/rMlib/CMakeLists.txt @@ -50,7 +50,7 @@ endif() target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) if (EMULATE) - target_link_libraries(${PROJECT_NAME} PRIVATE NotoFont) + target_link_libraries(${PROJECT_NAME} PRIVATE NotoFont::font) find_package(SDL2 REQUIRED) if (TARGET SDL2::SDL2) diff --git a/libs/rMlib/Canvas.cpp b/libs/rMlib/Canvas.cpp index c1190b8..fae8487 100644 --- a/libs/rMlib/Canvas.cpp +++ b/libs/rMlib/Canvas.cpp @@ -55,10 +55,13 @@ getFont() { } const auto* data = fontBuffer.data(); #else - const auto* data = noto_sans_mono_font; + const auto* data = NotoSansMono_Regular_ttf; #endif - stbtt_InitFont(&font, data, 0); + if (!stbtt_InitFont(&font, data, 0)) { + std::cerr << "Error initializing font!\n"; + std::exit(EXIT_FAILURE); + } #ifndef EMULATE fclose(fp); // NOLINT diff --git a/vendor/noto/CMakeLists.txt b/vendor/noto/CMakeLists.txt index 2026c03..eee34b1 100644 --- a/vendor/noto/CMakeLists.txt +++ b/vendor/noto/CMakeLists.txt @@ -1,4 +1,9 @@ -find_program(XXD xxd REQUIRED) +find_program(XXD xxd) + +if ("${XXD}" STREQUAL "XXD-NOTFOUND") + message(WARNING "XXD not found, skipping font include") + return() +endif() set(BUILD_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include") set(FONT_HEADER "${BUILD_INCLUDE_DIR}/noto-sans-mono.h") @@ -6,9 +11,11 @@ add_custom_command( OUTPUT "${FONT_HEADER}" COMMAND "${CMAKE_COMMAND}" -E make_directory "${BUILD_INCLUDE_DIR}" COMMAND - ${XXD} -n "noto_sans_mono_font" - -i "${CMAKE_CURRENT_SOURCE_DIR}/NotoSansMono-Regular.ttf" - "${FONT_HEADER}") + ${XXD} -i "NotoSansMono-Regular.ttf" + "${FONT_HEADER}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") add_library(NotoFont INTERFACE "${FONT_HEADER}") target_include_directories(NotoFont INTERFACE "${BUILD_INCLUDE_DIR}") + +add_library(NotoFont::font ALIAS NotoFont)