aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJohn "Lameguy" Wilbert Villamor <lameguy64@gmail.com>2021-11-22 14:40:59 +0800
committerGitHub <noreply@github.com>2021-11-22 14:40:59 +0800
commit45123e1b968d1883fed9b8526157ce2c4bffc4a7 (patch)
treed20c80fbd4f5a5d1d3972669625972cea6b3684d /tools
parent538f28cfbbbb8163ab8a96de77d6887123856c81 (diff)
parent9b00e5f7ff163a8fc6f341dbf237d90c61dadddc (diff)
downloadpsn00bsdk-45123e1b968d1883fed9b8526157ce2c4bffc4a7.tar.gz
Merge pull request #43 from spicyjpeg/cmake
Even more CMake fixes, submodules, pads example
Diffstat (limited to 'tools')
-rw-r--r--tools/CMakeLists.txt46
m---------tools/mkpsxiso0
m---------tools/tinyxml20
-rw-r--r--tools/util/elf2cpe.c2
4 files changed, 19 insertions, 29 deletions
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index dd90109..af99046 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,7 +1,7 @@
# PSn00bSDK tools build script
# (C) 2021 spicyjpeg - MPL licensed
-cmake_minimum_required(VERSION 3.21)
+cmake_minimum_required(VERSION 3.20)
project(
PSn00bSDK-tools
@@ -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,28 +46,18 @@ 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(
- TARGETS elf2x elf2cpe smxlink lzpack
- RUNTIME_DEPENDENCIES
- PRE_EXCLUDE_REGEXES ".*"
- PRE_INCLUDE_REGEXES "tinyxml2"
-)
+# Install the executables and copy the Blender SMX export plugin to the data
+# directory (for manual installation).
+install(TARGETS elf2x elf2cpe smxlink lzpack)
install(
DIRECTORY plugin
DESTINATION ${CMAKE_INSTALL_DATADIR}/psn00bsdk
diff --git a/tools/mkpsxiso b/tools/mkpsxiso
new file mode 160000
+Subproject fe14e95d07a0da5727a8c2fb3ff2aaa892e465c
diff --git a/tools/tinyxml2 b/tools/tinyxml2
new file mode 160000
+Subproject a9773976845b19e89020c1215781e71116477ef
diff --git a/tools/util/elf2cpe.c b/tools/util/elf2cpe.c
index 46b0a37..210f25b 100644
--- a/tools/util/elf2cpe.c
+++ b/tools/util/elf2cpe.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include "elf.h"
#ifdef WIN32