aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-11-10 17:11:44 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-11-10 17:11:44 +0100
commitb55bc88017aac1bbe9eab21b480093459c0fd0e1 (patch)
tree248573885c01567732c974ff99e61c8a2fa6d1e1 /examples
parentc61d83010a1d83513623724f908f0903e90966e2 (diff)
downloadpsn00bsdk-b55bc88017aac1bbe9eab21b480093459c0fd0e1.tar.gz
Fixed examples directory hierarchy not being preserved
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt22
-rw-r--r--examples/beginner/cppdemo/CMakeLists.txt2
-rw-r--r--examples/beginner/hello/CMakeLists.txt2
-rw-r--r--examples/cdrom/cdbrowse/CMakeLists.txt2
-rw-r--r--examples/cdrom/cdxa/CMakeLists.txt2
-rw-r--r--examples/demos/n00bdemo/CMakeLists.txt2
-rw-r--r--examples/graphics/balls/CMakeLists.txt2
-rw-r--r--examples/graphics/billboard/CMakeLists.txt2
-rw-r--r--examples/graphics/fpscam/CMakeLists.txt4
-rw-r--r--examples/graphics/gte/CMakeLists.txt4
-rw-r--r--examples/graphics/hdtv/CMakeLists.txt2
-rw-r--r--examples/graphics/render2tex/CMakeLists.txt2
-rw-r--r--examples/graphics/rgb24/CMakeLists.txt2
-rw-r--r--examples/io/pads/CMakeLists.txt2
-rw-r--r--examples/sound/vagsample/CMakeLists.txt2
-rw-r--r--examples/system/childexec/CMakeLists.txt2
-rw-r--r--examples/system/console/CMakeLists.txt2
-rw-r--r--examples/system/dynlink/CMakeLists.txt2
-rw-r--r--examples/system/timer/CMakeLists.txt2
-rw-r--r--examples/system/tty/CMakeLists.txt2
20 files changed, 40 insertions, 24 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 87210b9..15212c8 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -10,16 +10,32 @@ project(
HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
)
+include(GNUInstallDirs)
+
+# Find all subdirectories that contain a CMake build script. This includes the
+# top-level examples directory and this file as well, however we're going to
+# skip it.
file(
GLOB_RECURSE _examples
+ RELATIVE ${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/CMakeLists.txt
)
foreach(_script IN LISTS _examples)
- cmake_path(GET _script PARENT_PATH _dir)
- if(_dir STREQUAL PROJECT_SOURCE_DIR)
+ if(_script STREQUAL "CMakeLists.txt")
continue()
endif()
- add_subdirectory(${_dir})
+ # CMake provides no way to override the install prefix of a subdirectory,
+ # as it "imports" its targets into the main project rather than treating it
+ # as a separate project. However, as the example subdirectories use
+ # install(... TYPE BIN) to install executables, it is possible to override
+ # CMAKE_INSTALL_BINDIR temporarily to place them in any directory within
+ # the install prefix. This is a hack, but it allows us to preserve the
+ # examples' folder hierarchy in the installation directory (it is already
+ # preserved by CMake in the build tree!) with minimal effort.
+ cmake_path(GET _script PARENT_PATH _dir)
+ cmake_path(GET _dir PARENT_PATH CMAKE_INSTALL_BINDIR)
+
+ add_subdirectory(${PROJECT_SOURCE_DIR}/${_dir})
endforeach()
diff --git a/examples/beginner/cppdemo/CMakeLists.txt b/examples/beginner/cppdemo/CMakeLists.txt
index 3b6a53e..becf464 100644
--- a/examples/beginner/cppdemo/CMakeLists.txt
+++ b/examples/beginner/cppdemo/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.cpp)
psn00bsdk_add_executable(cppdemo STATIC ${_sources})
#psn00bsdk_add_cd_image(cppdemo_iso cppdemo iso.xml DEPENDS cppdemo)
-install(FILES ${PROJECT_BINARY_DIR}/cppdemo.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/cppdemo.exe TYPE BIN)
diff --git a/examples/beginner/hello/CMakeLists.txt b/examples/beginner/hello/CMakeLists.txt
index 81ed0f7..7fb7c22 100644
--- a/examples/beginner/hello/CMakeLists.txt
+++ b/examples/beginner/hello/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c)
psn00bsdk_add_executable(hello STATIC ${_sources})
#psn00bsdk_add_cd_image(hello_iso hello iso.xml DEPENDS hello)
-install(FILES ${PROJECT_BINARY_DIR}/hello.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/hello.exe TYPE BIN)
diff --git a/examples/cdrom/cdbrowse/CMakeLists.txt b/examples/cdrom/cdbrowse/CMakeLists.txt
index d587f5a..e5ec759 100644
--- a/examples/cdrom/cdbrowse/CMakeLists.txt
+++ b/examples/cdrom/cdbrowse/CMakeLists.txt
@@ -23,5 +23,5 @@ install(
FILES
${PROJECT_BINARY_DIR}/cdbrowse.bin
${PROJECT_BINARY_DIR}/cdbrowse.cue
- DESTINATION .
+ TYPE BIN
)
diff --git a/examples/cdrom/cdxa/CMakeLists.txt b/examples/cdrom/cdxa/CMakeLists.txt
index d95a40d..18dcc69 100644
--- a/examples/cdrom/cdxa/CMakeLists.txt
+++ b/examples/cdrom/cdxa/CMakeLists.txt
@@ -25,5 +25,5 @@ install(
#${PROJECT_BINARY_DIR}/cdxa.bin
#${PROJECT_BINARY_DIR}/cdxa.cue
${PROJECT_BINARY_DIR}/cdxa.exe
- DESTINATION .
+ TYPE BIN
)
diff --git a/examples/demos/n00bdemo/CMakeLists.txt b/examples/demos/n00bdemo/CMakeLists.txt
index 02c7b35..c62c4ef 100644
--- a/examples/demos/n00bdemo/CMakeLists.txt
+++ b/examples/demos/n00bdemo/CMakeLists.txt
@@ -47,4 +47,4 @@ target_include_directories(n00bdemo PRIVATE ${PROJECT_SOURCE_DIR})
add_custom_target(n00bdemo_data DEPENDS data.lzp)
add_dependencies(n00bdemo n00bdemo_data)
-install(FILES ${PROJECT_BINARY_DIR}/n00bdemo.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/n00bdemo.exe TYPE BIN)
diff --git a/examples/graphics/balls/CMakeLists.txt b/examples/graphics/balls/CMakeLists.txt
index 5afb2b1..5886484 100644
--- a/examples/graphics/balls/CMakeLists.txt
+++ b/examples/graphics/balls/CMakeLists.txt
@@ -19,4 +19,4 @@ 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 .)
+install(FILES ${PROJECT_BINARY_DIR}/balls.exe TYPE BIN)
diff --git a/examples/graphics/billboard/CMakeLists.txt b/examples/graphics/billboard/CMakeLists.txt
index 1d9df78..8cd31a9 100644
--- a/examples/graphics/billboard/CMakeLists.txt
+++ b/examples/graphics/billboard/CMakeLists.txt
@@ -25,4 +25,4 @@ psn00bsdk_add_executable(
)
#psn00bsdk_add_cd_image(billboard_iso billboard iso.xml DEPENDS billboard)
-install(FILES ${PROJECT_BINARY_DIR}/billboard.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/billboard.exe TYPE BIN)
diff --git a/examples/graphics/fpscam/CMakeLists.txt b/examples/graphics/fpscam/CMakeLists.txt
index b2becb9..791f6c2 100644
--- a/examples/graphics/fpscam/CMakeLists.txt
+++ b/examples/graphics/fpscam/CMakeLists.txt
@@ -8,7 +8,7 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
endif()
project(
- hello
+ fpscam
LANGUAGES C
VERSION 1.0.0
DESCRIPTION "PSn00bSDK 3D camera controls example"
@@ -19,4 +19,4 @@ 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 .)
+install(FILES ${PROJECT_BINARY_DIR}/fpscam.exe TYPE BIN)
diff --git a/examples/graphics/gte/CMakeLists.txt b/examples/graphics/gte/CMakeLists.txt
index 5fdf4d1..85b2942 100644
--- a/examples/graphics/gte/CMakeLists.txt
+++ b/examples/graphics/gte/CMakeLists.txt
@@ -8,7 +8,7 @@ if(NOT DEFINED CMAKE_TOOLCHAIN_FILE AND DEFINED ENV{PSN00BSDK_LIBS})
endif()
project(
- hello
+ gte
LANGUAGES C
VERSION 1.0.0
DESCRIPTION "PSn00bSDK GTE 3D cube example"
@@ -19,4 +19,4 @@ 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 .)
+install(FILES ${PROJECT_BINARY_DIR}/gte.exe TYPE BIN)
diff --git a/examples/graphics/hdtv/CMakeLists.txt b/examples/graphics/hdtv/CMakeLists.txt
index 899f963..f92faeb 100644
--- a/examples/graphics/hdtv/CMakeLists.txt
+++ b/examples/graphics/hdtv/CMakeLists.txt
@@ -19,4 +19,4 @@ 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 .)
+install(FILES ${PROJECT_BINARY_DIR}/hdtv.exe TYPE BIN)
diff --git a/examples/graphics/render2tex/CMakeLists.txt b/examples/graphics/render2tex/CMakeLists.txt
index db30377..360840d 100644
--- a/examples/graphics/render2tex/CMakeLists.txt
+++ b/examples/graphics/render2tex/CMakeLists.txt
@@ -25,4 +25,4 @@ psn00bsdk_add_executable(
)
#psn00bsdk_add_cd_image(render2tex_iso render2tex iso.xml DEPENDS render2tex)
-install(FILES ${PROJECT_BINARY_DIR}/render2tex.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/render2tex.exe TYPE BIN)
diff --git a/examples/graphics/rgb24/CMakeLists.txt b/examples/graphics/rgb24/CMakeLists.txt
index 71e2cfa..bf8a8fa 100644
--- a/examples/graphics/rgb24/CMakeLists.txt
+++ b/examples/graphics/rgb24/CMakeLists.txt
@@ -25,4 +25,4 @@ psn00bsdk_add_executable(
)
#psn00bsdk_add_cd_image(rgb24_iso rgb24 iso.xml DEPENDS rgb24)
-install(FILES ${PROJECT_BINARY_DIR}/rgb24.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/rgb24.exe TYPE BIN)
diff --git a/examples/io/pads/CMakeLists.txt b/examples/io/pads/CMakeLists.txt
index 62c06a2..5bd7f5d 100644
--- a/examples/io/pads/CMakeLists.txt
+++ b/examples/io/pads/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c *.s)
psn00bsdk_add_executable(pads STATIC ${_sources})
#psn00bsdk_add_cd_image(pads_iso pads iso.xml DEPENDS pads)
-install(FILES ${PROJECT_BINARY_DIR}/pads.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/pads.exe TYPE BIN)
diff --git a/examples/sound/vagsample/CMakeLists.txt b/examples/sound/vagsample/CMakeLists.txt
index 54305ab..1a15d9c 100644
--- a/examples/sound/vagsample/CMakeLists.txt
+++ b/examples/sound/vagsample/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c)
psn00bsdk_add_executable(vagsample STATIC ${_sources})
#psn00bsdk_add_cd_image(vagsample_iso vagsample iso.xml DEPENDS vagsample)
-install(FILES ${PROJECT_BINARY_DIR}/vagsample.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/vagsample.exe TYPE BIN)
diff --git a/examples/system/childexec/CMakeLists.txt b/examples/system/childexec/CMakeLists.txt
index f28a136..88168e0 100644
--- a/examples/system/childexec/CMakeLists.txt
+++ b/examples/system/childexec/CMakeLists.txt
@@ -38,4 +38,4 @@ target_link_options(child PRIVATE -Ttext=0x80030000)
# embedded via child_exe.s).
add_dependencies(parent child)
-install(FILES ${PROJECT_BINARY_DIR}/parent.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/parent.exe TYPE BIN)
diff --git a/examples/system/console/CMakeLists.txt b/examples/system/console/CMakeLists.txt
index 024c7a4..6dc6154 100644
--- a/examples/system/console/CMakeLists.txt
+++ b/examples/system/console/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c)
psn00bsdk_add_executable(console STATIC ${_sources})
#psn00bsdk_add_cd_image(console_iso console iso.xml DEPENDS console)
-install(FILES ${PROJECT_BINARY_DIR}/console.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/console.exe TYPE BIN)
diff --git a/examples/system/dynlink/CMakeLists.txt b/examples/system/dynlink/CMakeLists.txt
index e7188de..5834647 100644
--- a/examples/system/dynlink/CMakeLists.txt
+++ b/examples/system/dynlink/CMakeLists.txt
@@ -28,5 +28,5 @@ install(
FILES
${PROJECT_BINARY_DIR}/dynlink.bin
${PROJECT_BINARY_DIR}/dynlink.cue
- DESTINATION .
+ TYPE BIN
)
diff --git a/examples/system/timer/CMakeLists.txt b/examples/system/timer/CMakeLists.txt
index 6dc5ec3..58daf9b 100644
--- a/examples/system/timer/CMakeLists.txt
+++ b/examples/system/timer/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c)
psn00bsdk_add_executable(timer STATIC ${_sources})
#psn00bsdk_add_cd_image(timer_iso timer iso.xml DEPENDS timer)
-install(FILES ${PROJECT_BINARY_DIR}/timer.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/timer.exe TYPE BIN)
diff --git a/examples/system/tty/CMakeLists.txt b/examples/system/tty/CMakeLists.txt
index b8b5738..4e0ca36 100644
--- a/examples/system/tty/CMakeLists.txt
+++ b/examples/system/tty/CMakeLists.txt
@@ -19,4 +19,4 @@ file(GLOB _sources *.c)
psn00bsdk_add_executable(tty STATIC ${_sources})
#psn00bsdk_add_cd_image(tty_iso tty iso.xml DEPENDS tty)
-install(FILES ${PROJECT_BINARY_DIR}/tty.exe DESTINATION .)
+install(FILES ${PROJECT_BINARY_DIR}/tty.exe TYPE BIN)