Compare commits

..

11 commits

Author SHA1 Message Date
Crayon2000
b1fdc58bed Add comments 2024-10-19 23:30:42 -04:00
Crayon2000
1b5e30cb51 Add comments 2024-10-19 23:30:41 -04:00
Crayon2000
ef1a5a1350 Allow different texture format 2024-10-19 23:30:41 -04:00
Crayon2000
b8bf87f9e8 Remove useless loop 2024-10-19 23:30:41 -04:00
Crayon2000
b1d7144ad2 Add id parameter to GRRLIB_LoadTextureTPL 2024-10-19 23:30:40 -04:00
Crayon2000
1510e5326b Use less memory allocation 2024-10-19 23:30:40 -04:00
Crayon2000
f80bf532ff Align TPL code with GRRLIB 2024-10-19 23:30:40 -04:00
Crayon2000
ffb08c5764 First limited TPL implementation 2024-10-19 23:30:39 -04:00
Crayon2000
35ddfba78a Update GitHub workflows 2024-10-19 16:49:24 -04:00
Crayon2000
da0423c76d Remove repeated steps 2024-10-19 16:34:24 -04:00
Crayon2000
013da78dde Allow compilation and installation with cmake 2024-10-19 16:22:45 -04:00
5 changed files with 96 additions and 22 deletions

View file

@ -17,9 +17,9 @@ jobs:
- name: Build library and examples - name: Build library and examples
run: | run: |
(cd GRRLIB && make clean all install) make -C GRRLIB clean all install
(cd GRRLIB/GRRLIB && make PLATFORM=cube clean all install) make -C GRRLIB/GRRLIB PLATFORM=cube clean all install
(cd examples && make) make -C examples
- uses: actions/upload-artifact@master - uses: actions/upload-artifact@master
with: with:

View file

@ -18,7 +18,7 @@ jobs:
- name: Install doxygen - name: Install doxygen
run: | run: |
wget https://www.doxygen.nl/files/doxygen-1.10.0.linux.bin.tar.gz -O - | tar -xzv --directory=/tmp/ wget https://www.doxygen.nl/files/doxygen-1.12.0.linux.bin.tar.gz -O - | tar -xzv --directory=/tmp/
cd /tmp/doxygen-* cd /tmp/doxygen-*
sudo make install sudo make install
sudo apt-get update sudo apt-get update

View file

@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased][] ## [Unreleased][]
- Allow compilation and installation with cmake.
- Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format. - Added `GRRLIB_CreateEmptyTextureFmt()` to create an empty texture with a given format.
## [4.5.1][] - 2024-03-02 ## [4.5.1][] - 2024-03-02

66
CMakeLists.txt Normal file
View file

@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.18)
project(grrlib)
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PNG REQUIRED libpng)
pkg_check_modules(FREETYPE REQUIRED freetype2)
pkg_check_modules(JPEG REQUIRED libjpeg)
add_library(pngu STATIC)
target_sources(pngu
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/lib/pngu/pngu.c"
)
target_include_directories(pngu
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/lib/pngu>"
PRIVATE
${PNG_INCLUDE_DIRS}
)
target_link_libraries(pngu PUBLIC
${PNG_LIBRARIES}
)
add_library(grrlib STATIC)
target_compile_options(grrlib
PRIVATE
-Wall
-Wshadow
-Wunused
)
file(GLOB_RECURSE GRRLIB_SRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/*.c")
target_sources(grrlib
PRIVATE
"${GRRLIB_SRC_FILES}"
)
target_include_directories(grrlib
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB>"
PRIVATE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/grrlib>"
${FREETYPE_INCLUDE_DIRS}
${JPEG_INCLUDE_DIRS}
)
target_link_libraries(grrlib PUBLIC
pngu
)
install(
DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/GRRLIB/GRRLIB/"
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(TARGETS pngu grrlib
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

View file

@ -82,14 +82,31 @@ libjpeg is supplied via devkitPro pacman (ppc-libjpeg-turbo)
libfat is supplied via devkitPro pacman (libfat-ogc) libfat is supplied via devkitPro pacman (libfat-ogc)
``` ```
The easy way is to install GRRLIB and all the required libraries with a few First, you need to make sure that all required library dependencies are installed.
commands: Install them with a single command:
```bash
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
```
Go to the directory where the code was downloaded:
```bash ```bash
c: c:
cd \grr\GRRLIB cd \grr
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo ```
make clean all install
To install GRRLIB with Make in a single command:
```bash
make -C GRRLIB clean all install
```
If you prefer to use CMake, it can also be installed with a few commands:
```bash
/opt/devkitpro/portlibs/wii/bin/powerpc-eabi-cmake -B build
cmake --build build --target install
``` ```
This process may take some time depending on the speed of your PC. This process may take some time depending on the speed of your PC.
@ -97,36 +114,26 @@ This process may take some time depending on the speed of your PC.
If you used the method above the following steps are not required, GRRLIB is If you used the method above the following steps are not required, GRRLIB is
installed and you are ready to start developing Wii homebrew games. installed and you are ready to start developing Wii homebrew games.
If you want, you could install the libfat, libpng,
libfreetype and libjpeg with there dependencies in a single command:
```bash
pacman --sync --needed --noconfirm libfat-ogc ppc-libpng ppc-freetype ppc-libjpeg-turbo
```
Each library could also be installed individually: Each library could also be installed individually:
To install libpngu: To install libpngu:
```bash ```bash
c: cd GRRLIB\lib\pngu
cd \grr\GRRLIB\lib\pngu
make clean all install make clean all install
``` ```
To install libgrrlib for Wii: To install libgrrlib for Wii:
```bash ```bash
c: cd GRRLIB\GRRLIB
cd \grr\GRRLIB\GRRLIB
make clean all install make clean all install
``` ```
To install libgrrlib for GameCube: To install libgrrlib for GameCube:
```bash ```bash
c: cd GRRLIB\GRRLIB
cd \grr\GRRLIB\GRRLIB
make PLATFORM=cube clean all install make PLATFORM=cube clean all install
``` ```