aboutsummaryrefslogtreecommitdiff
path: root/examples/graphics
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2021-10-15 09:22:45 +0800
committerGitHub <noreply@github.com>2021-10-15 09:22:45 +0800
commitdd0f088aaa4c6bf013643be2d1d8621dbffdb000 (patch)
treed848d6ce007d8bb9357c8b99d6a0a39ec41d244e /examples/graphics
parent9e08d1047fa8deeb3ccb3ce9bb11d69e25a52d56 (diff)
parenteb719a424e6a16fb64209139a32c9f8a7235a929 (diff)
downloadpsn00bsdk-dd0f088aaa4c6bf013643be2d1d8621dbffdb000.tar.gz
Merge pull request #38 from spicyjpeg/cmake
Full CMake support (in place of makefiles)
Diffstat (limited to 'examples/graphics')
-rw-r--r--examples/graphics/balls/CMakeLists.txt22
-rw-r--r--examples/graphics/balls/makefile65
-rw-r--r--examples/graphics/billboard/CMakeLists.txt28
-rw-r--r--examples/graphics/billboard/makefile65
-rw-r--r--examples/graphics/billboard/tim.s.template (renamed from examples/graphics/rgb24/tim.s)3
-rw-r--r--examples/graphics/fpscam/CMakeLists.txt22
-rw-r--r--examples/graphics/fpscam/makefile65
-rw-r--r--examples/graphics/gte/CMakeLists.txt22
-rw-r--r--examples/graphics/gte/makefile65
-rw-r--r--examples/graphics/hdtv/CMakeLists.txt22
-rw-r--r--examples/graphics/hdtv/makefile65
-rw-r--r--examples/graphics/render2tex/CMakeLists.txt28
-rw-r--r--examples/graphics/render2tex/makefile65
-rw-r--r--examples/graphics/render2tex/texture.s.template (renamed from examples/graphics/render2tex/texture.s)3
-rw-r--r--examples/graphics/rgb24/CMakeLists.txt28
-rw-r--r--examples/graphics/rgb24/makefile65
-rw-r--r--examples/graphics/rgb24/tim.s.template (renamed from examples/graphics/billboard/tim.s)3
17 files changed, 175 insertions, 461 deletions
diff --git a/examples/graphics/balls/CMakeLists.txt b/examples/graphics/balls/CMakeLists.txt
new file mode 100644
index 0000000..b063425
--- /dev/null
+++ b/examples/graphics/balls/CMakeLists.txt
@@ -0,0 +1,22 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ balls
+ LANGUAGES C
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK sprites example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(balls STATIC ${_sources})
+#psn00bsdk_add_cd_image(balls_iso balls iso.xml DEPENDS balls)
+
+install(FILES ${PROJECT_BINARY_DIR}/balls.exe DESTINATION .)
diff --git a/examples/graphics/balls/makefile b/examples/graphics/balls/makefile
deleted file mode 100644
index 44d3d71..0000000
--- a/examples/graphics/balls/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = balls
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/billboard/CMakeLists.txt b/examples/graphics/billboard/CMakeLists.txt
new file mode 100644
index 0000000..bf73297
--- /dev/null
+++ b/examples/graphics/billboard/CMakeLists.txt
@@ -0,0 +1,28 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ billboard
+ LANGUAGES C ASM
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK billboard sprite example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+configure_file(tim.s.template tim.s)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(
+ billboard STATIC
+ ${_sources}
+ ${PROJECT_BINARY_DIR}/tim.s
+)
+#psn00bsdk_add_cd_image(billboard_iso billboard iso.xml DEPENDS billboard)
+
+install(FILES ${PROJECT_BINARY_DIR}/billboard.exe DESTINATION .)
diff --git a/examples/graphics/billboard/makefile b/examples/graphics/billboard/makefile
deleted file mode 100644
index 462e73c..0000000
--- a/examples/graphics/billboard/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = billboard
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/rgb24/tim.s b/examples/graphics/billboard/tim.s.template
index a4432d9..fbe7522 100644
--- a/examples/graphics/rgb24/tim.s
+++ b/examples/graphics/billboard/tim.s.template
@@ -3,5 +3,4 @@
.global tim_image
.type tim_image, @object
tim_image:
- .incbin "bunpattern.tim"
- \ No newline at end of file
+ .incbin "${PROJECT_SOURCE_DIR}/texture64.tim"
diff --git a/examples/graphics/fpscam/CMakeLists.txt b/examples/graphics/fpscam/CMakeLists.txt
new file mode 100644
index 0000000..8fa66f2
--- /dev/null
+++ b/examples/graphics/fpscam/CMakeLists.txt
@@ -0,0 +1,22 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ hello
+ LANGUAGES C
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK 3D camera controls example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(fpscam STATIC ${_sources})
+#psn00bsdk_add_cd_image(fpscam_iso fpscam iso.xml DEPENDS fpscam)
+
+install(FILES ${PROJECT_BINARY_DIR}/fpscam.exe DESTINATION .)
diff --git a/examples/graphics/fpscam/makefile b/examples/graphics/fpscam/makefile
deleted file mode 100644
index 2ddb7fd..0000000
--- a/examples/graphics/fpscam/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = fpscam
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/gte/CMakeLists.txt b/examples/graphics/gte/CMakeLists.txt
new file mode 100644
index 0000000..3cdf2ff
--- /dev/null
+++ b/examples/graphics/gte/CMakeLists.txt
@@ -0,0 +1,22 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ hello
+ LANGUAGES C
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK GTE 3D cube example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(gte STATIC ${_sources})
+#psn00bsdk_add_cd_image(gte_iso gte iso.xml DEPENDS gte)
+
+install(FILES ${PROJECT_BINARY_DIR}/gte.exe DESTINATION .)
diff --git a/examples/graphics/gte/makefile b/examples/graphics/gte/makefile
deleted file mode 100644
index f44e72b..0000000
--- a/examples/graphics/gte/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = gte
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/hdtv/CMakeLists.txt b/examples/graphics/hdtv/CMakeLists.txt
new file mode 100644
index 0000000..98a0b3f
--- /dev/null
+++ b/examples/graphics/hdtv/CMakeLists.txt
@@ -0,0 +1,22 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ hdtv
+ LANGUAGES C
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK HDTV widescreen example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(hdtv STATIC ${_sources})
+#psn00bsdk_add_cd_image(hdtv_iso hdtv iso.xml DEPENDS hdtv)
+
+install(FILES ${PROJECT_BINARY_DIR}/hdtv.exe DESTINATION .)
diff --git a/examples/graphics/hdtv/makefile b/examples/graphics/hdtv/makefile
deleted file mode 100644
index 6659c98..0000000
--- a/examples/graphics/hdtv/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = hdtv
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/render2tex/CMakeLists.txt b/examples/graphics/render2tex/CMakeLists.txt
new file mode 100644
index 0000000..42a063b
--- /dev/null
+++ b/examples/graphics/render2tex/CMakeLists.txt
@@ -0,0 +1,28 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ render2tex
+ LANGUAGES C ASM
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK render-to-texture example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+configure_file(texture.s.template texture.s)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(
+ render2tex STATIC
+ ${_sources}
+ ${PROJECT_BINARY_DIR}/texture.s
+)
+#psn00bsdk_add_cd_image(render2tex_iso render2tex iso.xml DEPENDS render2tex)
+
+install(FILES ${PROJECT_BINARY_DIR}/render2tex.exe DESTINATION .)
diff --git a/examples/graphics/render2tex/makefile b/examples/graphics/render2tex/makefile
deleted file mode 100644
index bb0ef3c..0000000
--- a/examples/graphics/render2tex/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = render2tex
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/render2tex/texture.s b/examples/graphics/render2tex/texture.s.template
index e786dce..8b09ad8 100644
--- a/examples/graphics/render2tex/texture.s
+++ b/examples/graphics/render2tex/texture.s.template
@@ -5,5 +5,4 @@
.global tim_blendpattern
.type tim_blendpattern, @object
tim_blendpattern:
- .incbin "blendpattern-16c.tim"
- \ No newline at end of file
+ .incbin "${PROJECT_SOURCE_DIR}/blendpattern-16c.tim"
diff --git a/examples/graphics/rgb24/CMakeLists.txt b/examples/graphics/rgb24/CMakeLists.txt
new file mode 100644
index 0000000..c66ae69
--- /dev/null
+++ b/examples/graphics/rgb24/CMakeLists.txt
@@ -0,0 +1,28 @@
+# PSn00bSDK example CMake script
+# (C) 2021 spicyjpeg - MPL licensed
+
+cmake_minimum_required(VERSION 3.21)
+
+if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
+ set(CMAKE_TOOLCHAIN_FILE $ENV{PSN00BSDK_LIBS}/cmake/sdk.cmake)
+endif()
+
+project(
+ rgb24
+ LANGUAGES C ASM
+ VERSION 1.0.0
+ DESCRIPTION "PSn00bSDK 24-bit RGB display example"
+ HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
+)
+
+configure_file(tim.s.template tim.s)
+
+file(GLOB _sources *.c)
+psn00bsdk_add_executable(
+ rgb24 STATIC
+ ${_sources}
+ ${PROJECT_BINARY_DIR}/tim.s
+)
+#psn00bsdk_add_cd_image(rgb24_iso rgb24 iso.xml DEPENDS rgb24)
+
+install(FILES ${PROJECT_BINARY_DIR}/rgb24.exe DESTINATION .)
diff --git a/examples/graphics/rgb24/makefile b/examples/graphics/rgb24/makefile
deleted file mode 100644
index 9fa35ec..0000000
--- a/examples/graphics/rgb24/makefile
+++ /dev/null
@@ -1,65 +0,0 @@
-# PSn00bSDK makefile template
-# Part of the PSn00bSDK Project
-# 2019 - 2021 Lameguy64 / Meido-Tek Productions
-
-## Settings
-
-PSN00BSDK_LIBS ?= ../../../libpsn00b
-
-# Edit this to point to psn00bsdk-setup.mk, or copy that over to your project's
-# root folder (it only depends on environment variables).
-include ../../../psn00bsdk-setup.mk
-
-# Project target name
-TARGET = rgb24
-
-## Files
-
-# Searches for C, C++ and S (assembler) files in local directory
-CFILES = $(notdir $(wildcard *.c))
-CPPFILES= $(notdir $(wildcard *.cpp))
-AFILES = $(notdir $(wildcard *.s))
-
-# Create names for object files
-OFILES = $(addprefix build/,$(CFILES:.c=.o)) \
- $(addprefix build/,$(CPPFILES:.cpp=.o)) \
- $(addprefix build/,$(AFILES:.s=.o))
-
-# Project specific includes and libraries
-# (use -I for include dirs, -L for library dirs, -l for static libraries)
-INCLUDE +=
-LIBDIRS +=
-LIBS +=
-
-## Build rules
-
-#all: iso
-all: build/$(TARGET)
-
-iso: build/$(TARGET) resources
- $(MKPSXISO) -y -q iso.xml
-
-resources:
- # Add commands to build/convert your assets here
- #$(LZPACK) data.xml
-
-build/$(TARGET): $(OFILES)
- @mkdir -p $(dir $@)
- $(LD) $(LDFLAGS_EXE) $(LIBDIRS) $^ $(LIBS) -o $@
- $(NM) -f posix -l -n $@ >$@.map
- $(ELF2X) -q $@ $@.exe
-
-build/%.o: %.c
- @mkdir -p $(dir $@)
- $(CC) $(CFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.cpp
- @mkdir -p $(dir $@)
- $(CXX) $(CPPFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-build/%.o: %.s
- @mkdir -p $(dir $@)
- $(CC) $(AFLAGS_EXE) $(INCLUDE) -c $< -o $@
-
-clean:
- rm -rf build
diff --git a/examples/graphics/billboard/tim.s b/examples/graphics/rgb24/tim.s.template
index 1fa8d69..9fb1fb6 100644
--- a/examples/graphics/billboard/tim.s
+++ b/examples/graphics/rgb24/tim.s.template
@@ -3,5 +3,4 @@
.global tim_image
.type tim_image, @object
tim_image:
- .incbin "texture64.tim"
- \ No newline at end of file
+ .incbin "${PROJECT_SOURCE_DIR}/bunpattern.tim"