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/system/dynlink/CMakeLists.txt | 32 ++++++++++++ examples/system/dynlink/iso.xml | 16 +++--- examples/system/dynlink/makefile | 95 ---------------------------------- 3 files changed, 40 insertions(+), 103 deletions(-) create mode 100644 examples/system/dynlink/CMakeLists.txt delete mode 100644 examples/system/dynlink/makefile (limited to 'examples/system/dynlink') diff --git a/examples/system/dynlink/CMakeLists.txt b/examples/system/dynlink/CMakeLists.txt new file mode 100644 index 0000000..3af5d4b --- /dev/null +++ b/examples/system/dynlink/CMakeLists.txt @@ -0,0 +1,32 @@ +# 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( + dynlink + LANGUAGES C + VERSION 1.0.0 + DESCRIPTION "PSn00bSDK dynamic linker example" + HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk" +) + +file(GLOB _sources *.c) +psn00bsdk_add_executable(dynlink_main DYNAMIC ${_sources}) +psn00bsdk_add_library (dynlink_cube SHARED library/cube.c) +psn00bsdk_add_library (dynlink_balls SHARED library/balls.c) +psn00bsdk_add_cd_image( + dynlink_iso dynlink iso.xml + DEPENDS dynlink_main dynlink_cube dynlink_balls +) + +install( + FILES + ${PROJECT_BINARY_DIR}/dynlink.bin + ${PROJECT_BINARY_DIR}/dynlink.cue + DESTINATION . +) diff --git a/examples/system/dynlink/iso.xml b/examples/system/dynlink/iso.xml index 76cc8fc..8f40510 100644 --- a/examples/system/dynlink/iso.xml +++ b/examples/system/dynlink/iso.xml @@ -1,7 +1,7 @@ - - - + + + - - + + diff --git a/examples/system/dynlink/makefile b/examples/system/dynlink/makefile deleted file mode 100644 index b3fb298..0000000 --- a/examples/system/dynlink/makefile +++ /dev/null @@ -1,95 +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 = dynlink - -## Files - -# Searches for C, C++ and S (assembler) files in local directory -CFILES_MAIN = $(notdir $(wildcard *.c)) -CPPFILES_MAIN = $(notdir $(wildcard *.cpp)) -AFILES_MAIN = $(notdir $(wildcard *.s)) - -CFILES_DLL = $(notdir $(wildcard library/*.c)) -CPPFILES_DLL = $(notdir $(wildcard library/*.cpp)) -AFILES_DLL = $(notdir $(wildcard library/*.s)) - -# Create names for object files -OFILES_MAIN = $(addprefix build/,$(CFILES_MAIN:.c=.o)) \ - $(addprefix build/,$(CPPFILES_MAIN:.cpp=.o)) \ - $(addprefix build/,$(AFILES_MAIN:.s=.o)) -OFILES_CUBE = build/library/cube.o -OFILES_BALLS = build/library/balls.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/library/cube build/library/balls build/main - -iso: build/library/cube build/library/balls build/main resources - $(MKPSXISO) -y -q iso.xml - -resources: - # Add commands to build/convert your assets here - #$(LZPACK) data.xml - -build/library/cube: $(OFILES_CUBE) - @mkdir -p $(dir $@) - $(LD) $(LDFLAGS_DLL) $^ -o $@ - #$(NM) -f posix -l -n $@ >$@.map - $(OBJCOPY) -O binary $@ $@.dll - -build/library/balls: $(OFILES_BALLS) - @mkdir -p $(dir $@) - $(LD) $(LDFLAGS_DLL) $^ -o $@ - #$(NM) -f posix -l -n $@ >$@.map - $(OBJCOPY) -O binary $@ $@.dll - -build/main: $(OFILES_MAIN) - @mkdir -p $(dir $@) - $(LD) $(LDFLAGS_EXEDYN) $(LIBDIRS) $^ $(LIBS) -o $@ - $(NM) -f posix -l -n $@ >$@.map - $(ELF2X) -q $@ $@.exe - -build/library/%.o: library/%.c - @mkdir -p $(dir $@) - $(CC) $(CFLAGS_DLL) $(INCLUDE) -c $< -o $@ - -build/library/%.o: library/%.cpp - @mkdir -p $(dir $@) - $(CXX) $(CPPFLAGS_DLL) $(INCLUDE) -c $< -o $@ - -build/library/%.o: library/%.s - @mkdir -p $(dir $@) - $(CC) $(AFLAGS_DLL) $(INCLUDE) -c $< -o $@ - -build/%.o: %.c - @mkdir -p $(dir $@) - $(CC) $(CFLAGS_EXEDYN) $(INCLUDE) -c $< -o $@ - -build/%.o: %.cpp - @mkdir -p $(dir $@) - $(CXX) $(CPPFLAGS_EXEDYN) $(INCLUDE) -c $< -o $@ - -build/%.o: %.s - @mkdir -p $(dir $@) - $(CC) $(AFLAGS_EXEDYN) $(INCLUDE) -c $< -o $@ - -clean: - rm -rf build -- cgit v1.2.3