Update CMakeLists.txt and compile example on CI

This commit is contained in:
Crayon2000 2025-01-11 15:03:45 -05:00 committed by Crayon
parent bc94c0f421
commit 78258b52c5
2 changed files with 37 additions and 29 deletions

View file

@ -20,6 +20,8 @@ jobs:
make -C GRRLIB clean all install make -C GRRLIB clean all install
make -C GRRLIB/GRRLIB PLATFORM=cube clean all install make -C GRRLIB/GRRLIB PLATFORM=cube clean all install
make -C examples make -C examples
/opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -S $GITHUB_WORKSPACE/examples/cmake -B /tmp/build-wii -G Ninja
cmake --build /tmp/build-wii --verbose
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:

View file

@ -1,39 +1,45 @@
# Sets DEVKIT_PRO variable to directory with devkitPro cmake_minimum_required(VERSION 3.18)
set(DEVKIT_PRO "/opt/devkitpro")
# Include needed to build with Wii toolchain
include("${DEVKIT_PRO}/cmake/Wii.cmake")
# Includes needed to find libraries needed by GRRLIB
include(FindZLIB)
include(FindJPEG)
include(FindPNG)
cmake_minimum_required(VERSION 3.5)
# Your project details
project( project(
cmake # Your project name goes here application # Your project name goes here
VERSION 0.1.0 # Your project version goes here VERSION 1.0.0 # Your project version goes here
LANGUAGES C # Or CXX if you using C++ LANGUAGES C # Or CXX if you using C++
) )
# Libraries required to link GRRLIB # Libraries required to link GRRLIB
find_package(Freetype REQUIRED) find_library(GRRLIB grrlib REQUIRED)
find_package(BZip2 REQUIRED) find_library(PNGU pngu REQUIRED)
find_package(ZLIB REQUIRED) find_library(FAT fat
find_package(JPEG REQUIRED) PATHS "${OGC_ROOT}/lib/${OGC_SUBDIR}"
find_package(PNG REQUIRED) REQUIRED
)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JPEG REQUIRED libjpeg)
pkg_check_modules(PNG REQUIRED libpng)
pkg_check_modules(FREETYPE REQUIRED freetype2)
# Finds some required libraries add_executable(${PROJECT_NAME})
file(GLOB libraries
"${DEVKIT_PRO}/portlibs/wii/lib/*.a" # GRRLIB target_compile_options(${PROJECT_NAME} PRIVATE
"${DEVKIT_PRO}/libogc/lib/wii/*.a" # libfat -Wall
) )
# GRRLIB includes target_include_directories(${PROJECT_NAME} PRIVATE
include_directories("${DEVKIT_PRO}/portlibs/wii/include") ${DEVKITPRO}/portlibs/${OGC_CONSOLE}/include
# Links the whole of libraries )
link_libraries(${libraries} ${FREETYPE_LIBRARIES} ${BZIP2_LIBRARIES} ${ZLIB_LIBRARIES} ${JPEG_LIBRARIES} ${PNG_LIBRARIES} -lfat)
target_sources(${PROJECT_NAME} PRIVATE
"src/main.c"
)
target_link_libraries(${PROJECT_NAME} PRIVATE
${GRRLIB}
${PNGU}
${PNG_LIBRARIES}
${JPEG_LIBRARIES}
${FREETYPE_LIBRARIES}
${FAT}
)
# Here we go, builds executable # Here we go, builds executable
add_executable(cmake "src/main.c") ogc_create_dol(${PROJECT_NAME})