aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-10-31 15:17:39 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-10-31 15:17:39 +0100
commit8b09040cf56bf732eccfc8a4bb1193d9ef0b10ac (patch)
tree4e292267dd7b7f2b8a66d10750f31080f5a82c84
parent4e0d5bceb24042a6d31c76958ce2c6157369ac68 (diff)
downloadpsn00bsdk-8b09040cf56bf732eccfc8a4bb1193d9ef0b10ac.tar.gz
Added mkpsxiso and tinyxml2 as submodules
-rw-r--r--.gitmodules6
-rw-r--r--CMakeLists.txt63
-rw-r--r--tools/CMakeLists.txt43
m---------tools/mkpsxiso0
m---------tools/tinyxml20
5 files changed, 39 insertions, 73 deletions
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..7d0d2ab
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "tools/tinyxml2"]
+ path = tools/tinyxml2
+ url = https://github.com/leethomason/tinyxml2
+[submodule "tools/mkpsxiso"]
+ path = tools/mkpsxiso
+ url = ../mkpsxiso
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 431e95b..2c44c09 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,7 +12,6 @@ include(ExternalProject)
project(
PSn00bSDK
LANGUAGES NONE
- # IMPORTANT TODO: set a version number
VERSION 0.1.0
DESCRIPTION "Open source PlayStation 1 SDK"
HOMEPAGE_URL "http://lameguy64.net/?page=psn00bsdk"
@@ -36,14 +35,6 @@ set(
)
set(
- SKIP_TINYXML2 OFF
- CACHE BOOL "Skip downloading and building tinyxml2 (if already installed)"
-)
-set(
- SKIP_MKPSXISO OFF
- CACHE BOOL "Skip downloading and building mkpsxiso (if already installed)"
-)
-set(
SKIP_EXAMPLES OFF
CACHE BOOL "Skip building SDK examples (not required for installation)"
)
@@ -61,12 +52,6 @@ set(
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
)
set(
- EXT_LIBRARY_ARGS
- -DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
- -DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/install_temp
- -DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreaded$<$<CONFIG:Debug>:Debug>
-)
-set(
SUBPROJECT_ARGS
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/install_tree
@@ -77,50 +62,30 @@ set(
-DCMAKE_INSTALL_PREFIX:PATH=${PROJECT_BINARY_DIR}/examples
)
-## External dependencies
-
-if(NOT SKIP_TINYXML2)
- list(APPEND SUBPROJECT_ARGS -Dtinyxml2_ROOT:PATH=${PROJECT_BINARY_DIR}/install_temp)
-
- ExternalProject_Add(
- tinyxml2
- GIT_REPOSITORY "https://github.com/leethomason/tinyxml2"
- CMAKE_CACHE_ARGS ${COMMON_ARGS} ${EXT_LIBRARY_ARGS}
- INSTALL_DIR install_temp
- )
-else()
- list(APPEND SUBPROJECT_ARGS -Dtinyxml2_ROOT:PATH=${tinyxml2_ROOT})
-
- # Create a dummy target so CMake doesn't throw missing dependency errors.
- add_library(tinyxml2 INTERFACE)
-endif()
+## Subprojects
-if(NOT SKIP_MKPSXISO)
- ExternalProject_Add(
- mkpsxiso
- GIT_REPOSITORY "https://github.com/Lameguy64/mkpsxiso"
- CMAKE_CACHE_ARGS ${COMMON_ARGS} ${SUBPROJECT_ARGS}
- INSTALL_DIR install_tree
- DEPENDS tinyxml2
- )
-else()
- add_library(mkpsxiso INTERFACE)
+if(NOT EXISTS ${PROJECT_SOURCE_DIR}/tools/mkpsxiso/CMakeLists.txt)
+ message(FATAL_ERROR "The mkpsxiso directory is empty. Run 'git submodule update --init --recursive' to populate it.")
endif()
-## Subprojects
-
ExternalProject_Add(
- libpsn00b
- SOURCE_DIR ${PROJECT_SOURCE_DIR}/libpsn00b
+ tools
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/tools
CMAKE_CACHE_ARGS ${COMMON_ARGS} ${SUBPROJECT_ARGS}
INSTALL_DIR install_tree
)
ExternalProject_Add(
- tools
- SOURCE_DIR ${PROJECT_SOURCE_DIR}/tools
+ mkpsxiso
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/tools/mkpsxiso
+ CMAKE_CACHE_ARGS ${COMMON_ARGS} ${SUBPROJECT_ARGS}
+ INSTALL_DIR install_tree
+)
+ExternalProject_Add(
+ libpsn00b
+ SOURCE_DIR ${PROJECT_SOURCE_DIR}/libpsn00b
CMAKE_CACHE_ARGS ${COMMON_ARGS} ${SUBPROJECT_ARGS}
INSTALL_DIR install_tree
- DEPENDS tinyxml2
+ #DEPENDS tools
)
ExternalProject_Add(
examples
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index dd90109..14fa775 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -12,22 +12,22 @@ project(
include(GNUInstallDirs)
-## External dependencies
-
-# Let CMake attempt to find tinyxml2 on its own first. This avoids invoking
-# pkg-config where it might not be installed, and allows usage of package
-# managers like vcpkg. The path to tinyxml2 can also be specified manually by
-# passing -Dtinyxml2_ROOT.
-find_package(tinyxml2 CONFIG)
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_CXX_STANDARD 11)
-if(NOT tinyxml2_FOUND)
- find_package(PkgConfig REQUIRED)
- pkg_search_module(_tinyxml2 REQUIRED IMPORTED_TARGET tinyxml2)
+## Dependencies
- add_library(tinyxml2::tinyxml2 ALIAS PkgConfig::_tinyxml2)
+if(NOT EXISTS ${PROJECT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp)
+ message(FATAL_ERROR "The tinyxml2 directory is empty. Run 'git submodule update --init --recursive' to populate it.")
endif()
-## Internal dependencies
+# Build tinyxml2. I didn't bother with tinyxml2's actual CMake integration
+# because it's far easier do do this. It is a single-file library after all.
+add_library (tinyxml2 STATIC tinyxml2/tinyxml2.cpp)
+target_include_directories(tinyxml2 PUBLIC tinyxml2)
+
+#add_subdirectory(tinyxml2)
# Build liblzp using sources from the libpsn00b tree. Hacky but it works.
set(LIBPSN00B_PATH ${PROJECT_SOURCE_DIR}/../libpsn00b)
@@ -46,27 +46,22 @@ target_include_directories(
## Executables
-# This is required in order to properly link against tinyxml2 under MSVC.
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-set(CMAKE_C_STANDARD 11)
-set(CMAKE_CXX_STANDARD 11)
-
add_executable(elf2x util/elf2x.c)
add_executable(elf2cpe util/elf2cpe.c)
add_executable(smxlink smxlink/main.cpp smxlink/timreader.cpp)
add_executable(lzpack lzpack/main.cpp lzpack/filelist.cpp)
-target_link_libraries(smxlink tinyxml2::tinyxml2)
-target_link_libraries(lzpack tinyxml2::tinyxml2 lzp)
+target_link_libraries(smxlink tinyxml2)
+target_link_libraries(lzpack tinyxml2 lzp)
## Installation
-# Install the executables alongside the tinyxml2 DLL (if any) and copy the
-# Blender SMX export plugin to the data directory (for manual installation).
+# Install the executables and copy the Blender SMX export plugin to the data
+# directory (for manual installation).
install(
TARGETS elf2x elf2cpe smxlink lzpack
- RUNTIME_DEPENDENCIES
- PRE_EXCLUDE_REGEXES ".*"
- PRE_INCLUDE_REGEXES "tinyxml2"
+ #RUNTIME_DEPENDENCIES
+ #PRE_EXCLUDE_REGEXES ".*"
+ #PRE_INCLUDE_REGEXES "tinyxml2"
)
install(
DIRECTORY plugin
diff --git a/tools/mkpsxiso b/tools/mkpsxiso
new file mode 160000
+Subproject 0d65bb7ef80a67c1a89a6c43e40521fd5777681
diff --git a/tools/tinyxml2 b/tools/tinyxml2
new file mode 160000
+Subproject a9773976845b19e89020c1215781e71116477ef