-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This program will allow for managing Nintendo RVT-H Reader devkits, including dumping existing images and installing new images. The current version doesn't actually do anything. It's mostly a copy of the infrastructure from rom-properties, with some changes. In particular, we're using CMake's TARGET_COMPILE_FEATURES() instead of manually detecting C99 support.
- Loading branch information
0 parents
commit f321fe5
Showing
28 changed files
with
2,215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Filetypes. | ||
*~ | ||
*.o | ||
*.a | ||
*.so | ||
.directory | ||
*.kate-swp | ||
|
||
# Build directories. | ||
/build* | ||
|
||
# KDevelop project files. | ||
*.kdev4 | ||
|
||
# CMake temproary files. | ||
CMakeCache.txt | ||
CMakeFiles/ | ||
cmake_install.cmake | ||
git_version.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
PROJECT(rvthtool-base) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.1) | ||
|
||
LIST(APPEND CMAKE_MODULE_PATH | ||
"${CMAKE_SOURCE_DIR}/cmake/macros" | ||
) | ||
|
||
# If no build type is set, default to "Debug". | ||
# TODO: Default to "Release"? | ||
STRING(TOLOWER "${CMAKE_BUILD_TYPE}" TMP_BUILD_TYPE) | ||
IF(TMP_BUILD_TYPE STREQUAL "") | ||
SET(CMAKE_BUILD_TYPE "Release") | ||
ELSEIF(TMP_BUILD_TYPE MATCHES "none") | ||
SET(CMAKE_BUILD_TYPE "Release") | ||
ENDIF() | ||
UNSET(TMP_BUILD_TYPE) | ||
|
||
# Put all the binaries and libraries into a single directory. | ||
# NOTE: CACHE INTERNAL is required in order to get this to work | ||
# for KDE5 for some reason. (and maybe that's why KDE4 did this | ||
# layout by default?) | ||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" CACHE INTERNAL "Put all binaries in a single directory.") | ||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE INTERNAL "Put all libraries in a single directory.") | ||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" CACHE INTERNAL "Put all archives in a single directory.") | ||
|
||
# Check for platform-specific functionality. | ||
INCLUDE(cmake/platform.cmake NO_POLICY_SCOPE) | ||
|
||
# Program information. | ||
SET(DESCRIPTION "RVT-H Tool") | ||
SET(PACKAGE_NAME "rvthtool") | ||
SET(AUTHOR "David Korth") | ||
SET(VERSION_MAJOR 0) | ||
SET(VERSION_MINOR 0) | ||
SET(VERSION_PATCH 0) | ||
SET(VERSION_DEVEL 1) | ||
IF(VERSION_PATCH) | ||
SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") | ||
ELSE(VERSION_PATCH) | ||
SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}") | ||
ENDIF(VERSION_PATCH) | ||
IF(VERSION_DEVEL) | ||
SET(VERSION_STRING "${VERSION_STRING}+") | ||
ENDIF(VERSION_DEVEL) | ||
SET(VERSION_STRING_WIN32 "${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_DEVEL}") | ||
|
||
# Split Debug macro. | ||
# Also sets the image version for Windows builds. | ||
INCLUDE(Win32ImageVersionLinkerFlags) | ||
MACRO(DO_SPLIT_DEBUG _target) | ||
IF(TARGET ${_target}) | ||
# Split debug information. | ||
INCLUDE(SetMSVCDebugPath) | ||
SET_MSVC_DEBUG_PATH(${_target}) | ||
IF(SPLIT_DEBUG) | ||
INCLUDE(SplitDebugInformation) | ||
SPLIT_DEBUG_INFORMATION(${_target}) | ||
ENDIF(SPLIT_DEBUG) | ||
# Set image version. | ||
# Subprojects can override ${VERSION_MAJOR} and ${VERSION_MINOR}. | ||
# FIXME: If minor version is e.g. "3", Windows interprets it as "03", | ||
# so "1.3" will actually be "1.03". | ||
WIN32_IMAGE_VERSION_LINKER_FLAGS(${VERSION_MAJOR} ${VERSION_MINOR}) | ||
ENDIF(TARGET ${_target}) | ||
ENDMACRO(DO_SPLIT_DEBUG) | ||
|
||
# Git version information. | ||
FIND_PROGRAM(POSIX_SH sh) | ||
IF(POSIX_SH) | ||
# sh is available. | ||
# Run the git version script. | ||
IF(WIN32) | ||
SET(ENV{SHELLOPTS} igncr) | ||
ENDIF(WIN32) | ||
ADD_CUSTOM_TARGET(git_version ALL | ||
${POSIX_SH} "${CMAKE_SOURCE_DIR}/git_version.sh" | ||
-s "${CMAKE_SOURCE_DIR}" | ||
-o "${CMAKE_BINARY_DIR}/git_version.h" | ||
VERBATIM | ||
) | ||
ELSE(POSIX_SH) | ||
# sh isn't available. | ||
# Create a blank git_version.h. | ||
FILE(WRITE "${CMAKE_BINARY_DIR}/git_version.h" | ||
"/* dummy file; POSIX sh is not available */\n") | ||
ENDIF(POSIX_SH) | ||
|
||
# Make sure the file is deleted on `make clean`. | ||
SET_PROPERTY(DIRECTORY APPEND | ||
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/git_version.h") | ||
|
||
# Reference: https://cmake.org/Wiki/RecipeAddUninstallTarget | ||
########### Add uninstall target ############### | ||
CONFIGURE_FILE( | ||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" | ||
IMMEDIATE @ONLY) | ||
ADD_CUSTOM_TARGET(uninstall | ||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") | ||
|
||
### Subdirectories. ### | ||
|
||
# Project subdirectories. | ||
ADD_SUBDIRECTORY(src) | ||
|
||
# TODO: Print build summary indicating what plugins will be built. | ||
# (Some other project had something like this...) | ||
# TODO: Fail if no plugins are being built. | ||
|
||
# CPack settings. | ||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${DESCRIPTION}") | ||
SET(CPACK_PACKAGE_NAME "${PACKAGE_NAME}") | ||
SET(CPACK_PACKAGE_VENDOR "${AUTHOR}") | ||
SET(CPACK_PACKAGE_CONTACT "David Korth <gerbilsoft@gerbilsoft.com>") | ||
SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) | ||
SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) | ||
SET(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) | ||
SET(CPACK_PACKAGE_VERSION ${VERSION_STRING}) | ||
|
||
# TODO: DESCRIPTION and WELCOME files. | ||
#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/doc/DESCRIPTION.txt") | ||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") | ||
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") | ||
#SET(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/doc/WELCOME.txt") | ||
|
||
# CPack: Source package settings. | ||
# NOTE: Double-escape is required because the unescaped | ||
# string # is written to CPackSourceConfig.cmake, which | ||
# is then unescaped. | ||
SET(CPACK_SOURCE_GENERATOR "TGZ") | ||
SET(CPACK_SOURCE_IGNORE_FILES | ||
"build.*/" | ||
"build.*\\\\.sh" | ||
"\\\\.git/" | ||
"\\\\.gitignore" | ||
"*\\\\.kate-swp" | ||
) | ||
|
||
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i.|x)86\$") | ||
SET(CPACK_PACKAGE_SYSTEM_PROCESSOR "i386") | ||
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64\$") | ||
SET(CPACK_PACKAGE_SYSTEM_PROCESSOR "amd64") | ||
ELSE() | ||
SET(CPACK_PACKAGE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR}) | ||
ENDIF() | ||
|
||
IF(APPLE) | ||
# TODO: Support for Mac OS X. | ||
ELSEIF(WIN32) | ||
IF(MSVC AND CMAKE_CL_64) | ||
SET(WIN32_PACKAGE_SUFFIX "win64") | ||
ELSEIF(NOT MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 8) | ||
SET(WIN32_PACKAGE_SUFFIX "win64") | ||
ELSE() | ||
SET(WIN32_PACKAGE_SUFFIX "win32") | ||
ENDIF() | ||
|
||
SET(CPACK_GENERATOR "ZIP") | ||
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${WIN32_PACKAGE_SUFFIX}") | ||
SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) | ||
ENDIF() | ||
|
||
# Components. | ||
SET(CPACK_COMPONENTS_ALL dll program debug doc i18n) | ||
SET(CPACK_COMPONENT_DLL_DISPLAY_NAME "DLLs") | ||
SET(CPACK_COMPONENT_PROGRAM_DISPLAY_NAME "Programs") | ||
SET(CPACK_COMPONENT_DEBUG_DISPLAY_NAME "Debugging Symbols") | ||
SET(CPACK_COMPONENT_DOC_DISPLAY_NAME "Documents") | ||
SET(CPACK_COMPONENT_I18N_DISPLAY_NAME "Internationalization") | ||
|
||
# Initialize CPack. | ||
INCLUDE(CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
GNU General Public License, version 2 or any later version. | ||
See GPL-2 or GPL-3 for the full text of these licenses. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# RVT-H Tool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Reference: https://cmake.org/Wiki/RecipeAddUninstallTarget | ||
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
MESSAGE(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") | ||
|
||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) | ||
STRING(REGEX REPLACE " " ";" files "${files}") | ||
STRING(REGEX REPLACE "\n" ";" files "${files}") | ||
FOREACH(file ${files}) | ||
MESSAGE(STATUS "Uninstalling $ENV{DESTDIR}${file}") | ||
IF(EXISTS "$ENV{DESTDIR}${file}") | ||
EXEC_PROGRAM( | ||
"@CMAKE_COMMAND@" ARGS "-E remove $ENV{DESTDIR}${file}" | ||
OUTPUT_VARIABLE rm_out | ||
RETURN_VALUE rm_retval | ||
) | ||
IF(NOT "${rm_retval}" STREQUAL 0) | ||
MESSAGE(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") | ||
ENDIF(NOT "${rm_retval}" STREQUAL 0) | ||
ELSE(EXISTS "$ENV{DESTDIR}${file}") | ||
MESSAGE(STATUS "File $ENV{DESTDIR}${file} does not exist.") | ||
ENDIF(EXISTS "$ENV{DESTDIR}${file}") | ||
ENDFOREACH(file) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* 64-bit time_t test code. | ||
* Reference: https://github.com/Benjamin-Dobell/Heimdall/blob/master/cmake/LargeFiles.c | ||
*/ | ||
|
||
#include <stdint.h> | ||
#include <time.h> | ||
|
||
/** static_assert() macro copied from c++11-compat.h **/ | ||
#define static_assert(expr, msg) switch (0) { case 0: case (expr): ; } | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
static_assert(sizeof(time_t) == sizeof(int64_t), "time_t is the wrong size"); | ||
int64_t tm64; | ||
time_t tm = time(&tm64); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# Check for 64-bit time support. | ||
# Known cases: | ||
# - Windows, MSVC: Supported as of MSVC 2005. | ||
# - Windows, MinGW: Supported if -D__MINGW_USE_VC2005_COMPAT is defined. | ||
# - 32-bit Linux: Supported in an upcoming glibc release. | ||
# - 64-bit Linux: No macros are required. | ||
# - 32-bit Mac OS X: Not supported. | ||
# - 64-bit Mac OS X: No macros are required. | ||
|
||
# Partially based on: | ||
# https://github.com/Benjamin-Dobell/Heimdall/blob/master/cmake/LargeFiles.cmake | ||
|
||
# This sets the following variables: | ||
# - TIME64_FOUND: Set to 1 if 64-bit time_t is supported. | ||
# - TIME64_FOUND_MINGW: Set to 1 if MinGW-w64's -D__MINGW_USE_VC2005_COMPAT is in use. | ||
# - TIME64_FOUND_TIME_BITS: Set to 1 if glibc's -D_TIME_BITS=64 is in use. | ||
# - TIME64_DEFINITIONS: Preprocessor macros required for large file support, if any. | ||
|
||
FUNCTION(CHECK_64BIT_TIME_SUPPORT) | ||
IF(NOT DEFINED TIME64_FOUND) | ||
# NOTE: ${CMAKE_MODULE_PATH} has two directories, macros/ and libs/, | ||
# so we have to configure this manually. | ||
SET(TIME64_SOURCE_PATH "${CMAKE_SOURCE_DIR}/cmake/macros") | ||
|
||
# Check for 64-bit time_t. | ||
MESSAGE(STATUS "Checking if time_t is 64-bit") | ||
IF(MSVC) | ||
IF(MSVC_VERSION LESS 1310) | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - no") | ||
MESSAGE(WARNING "MSVC 2005 (8.0) or later is required for 64-bit time_t.") | ||
ELSE() | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - yes") | ||
SET(TMP_TIME64_FOUND 1) | ||
ENDIF() | ||
ELSEIF(MINGW) | ||
# MinGW should support 64-bit time_t if -D__MINGW_USE_VC2005_COMPAT is specified. | ||
SET(TMP_TIME64_DEFINITIONS -D__MINGW_USE_VC2005_COMPAT) | ||
TRY_COMPILE(TMP_TIME64_FOUND "${CMAKE_BINARY_DIR}" | ||
"${TIME64_SOURCE_PATH}/64BitTimeSupport.c" | ||
COMPILE_DEFINITIONS ${TMP_TIME64_DEFINITIONS}) | ||
IF(TMP_TIME64_FOUND) | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - yes, using -D__MINGW_USE_VC2005_COMPAT") | ||
SET(TMP_TIME64_FOUND_MINGW 1) | ||
ELSE(TMP_TIME64_FOUND) | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - no") | ||
MESSAGE(WARNING "MinGW-w64 is required for 64-bit time_t.") | ||
UNSET(TMP_TIME64_DEFINITIONS) | ||
ENDIF(TMP_TIME64_FOUND) | ||
ELSE() | ||
# Check if the OS supports 64-bit time_t out of the box. | ||
TRY_COMPILE(TMP_TIME64_FOUND "${CMAKE_BINARY_DIR}" | ||
"${TIME64_SOURCE_PATH}/64BitTimeSupport.c") | ||
IF(TMP_TIME64_FOUND) | ||
# Supported out of the box. | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - yes") | ||
ELSE() | ||
# Try adding 64-bit time_t macros. | ||
# Reference: https://sourceware.org/glibc/wiki/Y2038ProofnessDesign?rev=115 | ||
SET(TMP_TIME64_DEFINITIONS -D_TIME_BITS=64) | ||
TRY_COMPILE(TMP_TIME64_FOUND "${CMAKE_BINARY_DIR}" | ||
"${TIME64_SOURCE_PATH}/64BitTimeSupport.c" | ||
COMPILE_DEFINITIONS ${TMP_TIME64_DEFINITIONS}) | ||
IF(TMP_TIME64_FOUND) | ||
# TIME64 macros work. | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - yes, using -D_TIME_BITS=64") | ||
SET(TMP_TIME64_FOUND_TIME_BITS 1) | ||
ELSE() | ||
# TIME64 macros failed. | ||
MESSAGE(STATUS "Checking if time_t is 64-bit - no") | ||
UNSET(TMP_TIME64_DEFINITIONS) | ||
ENDIF() | ||
ENDIF() | ||
ENDIF() | ||
|
||
SET(TIME64_FOUND ${TMP_TIME64_FOUND} CACHE INTERNAL "Is Large File Support available?") | ||
SET(TIME64_FOUND_MINGW ${TMP_TIME64_FOUND_TIME_BITS} CACHE INTERNAL "64-bit time_t is available using -D__MINGW_USE_VC2005_COMPAT") | ||
SET(TIME64_FOUND_TIME_BITS ${TMP_TIME64_FOUND_TIME_BITS} CACHE INTERNAL "64-bit time_t is available using -D_TIME_BITS=64") | ||
SET(TIME64_DEFINITIONS "${TMP_TIME64_DEFINITIONS}" CACHE INTERNAL "Definitions required for 64-bit time_t") | ||
ENDIF() | ||
ENDFUNCTION(CHECK_64BIT_TIME_SUPPORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Check what flags are needed for hidden visibility. | ||
# Usage: CHECK_HIDDEN_VISIBILITY() | ||
# | ||
# NOTE: Do NOT use this for extlibs, since many extlibs, including | ||
# zlib, don't work properly if symbols aren't visible by default. | ||
|
||
MACRO(CHECK_HIDDEN_VISIBILITY) | ||
# Check for visibility symbols. | ||
IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0) | ||
# CMake 3.3: Use CMake predefined variables. | ||
# NOTE: CMake 3.0-3.2 do not apply these settings | ||
# to static libraries, so we have to fall back to the | ||
# "deprecated" ADD_COMPILER_EXPORT_FLAGS(). | ||
CMAKE_POLICY(SET CMP0063 NEW) | ||
SET(CMAKE_C_VISIBILITY_PRESET "hidden") | ||
SET(CMAKE_CXX_VISIBILITY_PRESET "hidden") | ||
SET(CMAKE_VISIBILITY_INLINES_HIDDEN ON) | ||
ELSE() | ||
# CMake 2.x, 3.0-3.2: Use ADD_COMPILER_EXPORT_FLAGS(). | ||
# NOTE: 3.0+ will show a deprecation warning. | ||
INCLUDE(GenerateExportHeader) | ||
ADD_COMPILER_EXPORT_FLAGS(RP_COMPILER_EXPORT_FLAGS) | ||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${RP_COMPILER_EXPORT_FLAGS}") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RP_COMPILER_EXPORT_FLAGS}") | ||
UNSET(RP_COMPILER_EXPORT_FLAGS) | ||
ENDIF() | ||
ENDMACRO() |
Oops, something went wrong.