From 7cf54f48113b77a4d7b21d5858ec98862195b2a6 Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Sun, 12 Sep 2021 19:39:12 +0200 Subject: Migrated examples to CMake --- examples/cdrom/cdbrowse/CMakeLists.txt | 27 ++++++++++++++ examples/cdrom/cdbrowse/iso.xml | 12 +++---- examples/cdrom/cdbrowse/makefile | 65 ---------------------------------- examples/cdrom/cdxa/CMakeLists.txt | 29 +++++++++++++++ examples/cdrom/cdxa/iso.xml | 14 ++++---- examples/cdrom/cdxa/makefile | 65 ---------------------------------- 6 files changed, 69 insertions(+), 143 deletions(-) create mode 100644 examples/cdrom/cdbrowse/CMakeLists.txt delete mode 100644 examples/cdrom/cdbrowse/makefile create mode 100644 examples/cdrom/cdxa/CMakeLists.txt delete mode 100644 examples/cdrom/cdxa/makefile (limited to 'examples/cdrom') diff --git a/examples/cdrom/cdbrowse/CMakeLists.txt b/examples/cdrom/cdbrowse/CMakeLists.txt new file mode 100644 index 0000000..6eb4cbb --- /dev/null +++ b/examples/cdrom/cdbrowse/CMakeLists.txt @@ -0,0 +1,27 @@ +# 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( + cdbrowse + LANGUAGES C + VERSION 1.0.0 + DESCRIPTION "PSn00bSDK CD file browser example" + HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" +) + +file(GLOB _sources *.c) +psn00bsdk_add_executable(cdbrowse STATIC ${_sources}) +psn00bsdk_add_cd_image(cdbrowse_iso cdbrowse iso.xml DEPENDS cdbrowse) + +install( + FILES + ${PROJECT_BINARY_DIR}/cdbrowse.bin + ${PROJECT_BINARY_DIR}/cdbrowse.cue + DESTINATION . +) diff --git a/examples/cdrom/cdbrowse/iso.xml b/examples/cdrom/cdbrowse/iso.xml index 5d8963d..5ffca18 100644 --- a/examples/cdrom/cdbrowse/iso.xml +++ b/examples/cdrom/cdbrowse/iso.xml @@ -1,7 +1,7 @@ - - - + + + diff --git a/examples/cdrom/cdbrowse/makefile b/examples/cdrom/cdbrowse/makefile deleted file mode 100644 index 954408b..0000000 --- a/examples/cdrom/cdbrowse/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 = cdbrowse - -## 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/cdrom/cdxa/CMakeLists.txt b/examples/cdrom/cdxa/CMakeLists.txt new file mode 100644 index 0000000..b0c8d90 --- /dev/null +++ b/examples/cdrom/cdxa/CMakeLists.txt @@ -0,0 +1,29 @@ +# 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( + cdxa + LANGUAGES C + VERSION 1.0.0 + DESCRIPTION "PSn00bSDK CD-XA playback example" + HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" +) + +# TODO: add rules to actually generate a valid .XA file +file(GLOB _sources *.c) +psn00bsdk_add_executable(cdxa STATIC ${_sources}) +#psn00bsdk_add_cd_image(cdxa_iso cdxa iso.xml DEPENDS cdxa) + +install( + FILES + #${PROJECT_BINARY_DIR}/cdxa.bin + #${PROJECT_BINARY_DIR}/cdxa.cue + ${PROJECT_BINARY_DIR}/cdxa.exe + DESTINATION . +) diff --git a/examples/cdrom/cdxa/iso.xml b/examples/cdrom/cdxa/iso.xml index 9a6a206..b98a16f 100644 --- a/examples/cdrom/cdxa/iso.xml +++ b/examples/cdrom/cdxa/iso.xml @@ -1,7 +1,7 @@ - - - + + + - + diff --git a/examples/cdrom/cdxa/makefile b/examples/cdrom/cdxa/makefile deleted file mode 100644 index b1627f7..0000000 --- a/examples/cdrom/cdxa/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 = cdxa - -## 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 -- cgit v1.2.3