aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author浅倉麗子2020-07-12 03:07:45 -0400
committer浅倉麗子2020-07-12 03:07:45 -0400
commit2f2ccb1eeb88e9b26b6e5e6b39cefffe70820eb3 (patch)
tree2c560d20197d4896eab80a19be13bddffd4fd32d
parentScale shared FB to the scaled size of app FB (diff)
downloadsharpscale-2f2ccb1eeb88e9b26b6e5e6b39cefffe70820eb3.tar.gz
Build with latest SDK and refactor CMake script
-rw-r--r--CMakeLists.txt53
-rw-r--r--config-app/CMakeLists.txt35
-rw-r--r--main.c1
-rw-r--r--scaling-test/CMakeLists.txt54
4 files changed, 63 insertions, 80 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 61f137a..280b9cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,46 +15,46 @@
cmake_minimum_required(VERSION 3.13)
-if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- if(DEFINED ENV{DOLCESDK})
- set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "toolchain file")
- else()
- message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!")
- endif()
+if(DEFINED ENV{DOLCESDK})
+ set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake")
+ include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
+else()
+ message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!")
endif()
-include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
-
project(sharpscale LANGUAGES C)
-set(ELF "${PROJECT_NAME}.elf")
-set(SELF "${PROJECT_NAME}.skprx")
-
-add_executable("${ELF}"
- main.c
- config.c
-)
-
-target_compile_options("${ELF}"
- PRIVATE -O3 -std=c99
- PRIVATE -Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
- PRIVATE -fsingle-precision-constant -fno-common
+add_compile_options(
+ -O3 -std=c99
+ -Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
+ -fsingle-precision-constant -fno-common
)
if(LOG_PRINTF)
- target_compile_definitions("${ELF}" PRIVATE LOG_PRINTF)
+ add_compile_definitions(LOG_PRINTF)
endif()
if(LOG_FILE)
- target_compile_definitions("${ELF}" PRIVATE LOG_FILE)
+ add_compile_definitions(LOG_FILE)
endif()
+# Build self
+
+set(ELF "sharpscale.elf")
+set(SELF "sharpscale.skprx")
+set(VELF_CFG "exports.yml")
+set(SELF_STUB "sharpscale-stub")
+
+add_executable("${ELF}"
+ main.c
+ config.c
+)
+
target_link_options("${ELF}"
PRIVATE -nostdlib
)
target_link_libraries("${ELF}"
- gcc
m
SceDebugForDriver_stub
SceIofilemgrForDriver_stub
@@ -67,14 +67,13 @@ target_link_libraries("${ELF}"
dolce_create_self("${SELF}"
"${ELF}"
- CONFIG exports.yml
+ CONFIG "${VELF_CFG}"
)
-dolce_create_stubs("${PROJECT_NAME}-stubs"
- "${ELF}"
- exports.yml
+dolce_create_stubs("${SELF_STUB}" "${SELF}" "${VELF_CFG}"
KERNEL
LIB Sharpscale_stub
)
add_subdirectory(config-app)
+add_subdirectory(scaling-test)
diff --git a/config-app/CMakeLists.txt b/config-app/CMakeLists.txt
index 16ebc6d..71ad12b 100644
--- a/config-app/CMakeLists.txt
+++ b/config-app/CMakeLists.txt
@@ -13,30 +13,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-project(sharpscale_config LANGUAGES C)
+# Build self
-add_custom_command(OUTPUT boot_param.bin
- COMMAND dolce-make-bootparam app_memsize 0x2000 boot_param.bin
-)
-
-set(ELF "${PROJECT_NAME}.elf")
-set(SELF "${PROJECT_NAME}.self")
-set(VPK "${PROJECT_NAME}.vpk")
-
-set(TITLE_NAME "Sharpscale Config Menu")
-set(TITLE_ID "AKRK00005")
-set(TITLE_VER "01.07")
+set(ELF "config-app.elf")
+set(SELF "config-app.self")
+set(BOOTPARAM "${CMAKE_CURRENT_BINARY_DIR}/boot_param.bin")
add_executable("${ELF}"
main.c
)
-target_compile_options("${ELF}"
- PRIVATE -O3 -std=c99
- PRIVATE -Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
- PRIVATE -fsingle-precision-constant -fno-common
-)
-
target_include_directories("${ELF}"
PRIVATE "${CMAKE_SOURCE_DIR}"
)
@@ -54,12 +40,23 @@ target_link_libraries("${ELF}"
SceSysmodule_stub
)
+add_custom_command(OUTPUT "${BOOTPARAM}"
+ COMMAND dolce-make-bootparam app_memsize 0x2000 "${BOOTPARAM}"
+)
+
dolce_create_self("${SELF}"
"${ELF}"
UNSAFE
- BOOT_PARAM ${CMAKE_CURRENT_BINARY_DIR}/boot_param.bin
+ BOOT_PARAM "${BOOTPARAM}"
)
+# Build VPK
+
+set(VPK "sharpscale-config.vpk")
+set(TITLE_NAME "Sharpscale Configuration Menu")
+set(TITLE_ID "AKRK00005")
+set(TITLE_VER "01.07")
+
dolce_create_vpk("${VPK}" "${TITLE_ID}" "${SELF}"
NAME "${TITLE_NAME}"
VERSION "${TITLE_VER}"
diff --git a/main.c b/main.c
index d2009cc..a118963 100644
--- a/main.c
+++ b/main.c
@@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <string.h>
#include <psp2kern/io/fcntl.h>
#include <psp2kern/io/stat.h>
+#include <psp2kern/kernel/constants.h>
#include <psp2kern/kernel/modulemgr.h>
#include <psp2kern/kernel/sysmem.h>
#include <psp2kern/lowio/iftu.h>
diff --git a/scaling-test/CMakeLists.txt b/scaling-test/CMakeLists.txt
index 3b3c999..f8464bc 100644
--- a/scaling-test/CMakeLists.txt
+++ b/scaling-test/CMakeLists.txt
@@ -13,31 +13,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-cmake_minimum_required(VERSION 3.0)
+# Build font
-if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
- if(DEFINED ENV{DOLCESDK})
- set(CMAKE_TOOLCHAIN_FILE "$ENV{DOLCESDK}/share/dolce.toolchain.cmake" CACHE PATH "toolchain file")
- else()
- message(FATAL_ERROR "Please define DOLCESDK to point to your SDK path!")
- endif()
-endif()
-
-include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
-
-project(sharpscale_scaling_test LANGUAGES C)
-
-# build font
-set(FONT_FILE "unifont.bdf.gz")
-set(SFN_FILE "font.sfn")
+set(FONT_BASE "unifont-13.0.02")
+set(FONT_FILE "${CMAKE_CURRENT_BINARY_DIR}/unifont.bdf.gz")
+set(SFN_FILE "${CMAKE_CURRENT_BINARY_DIR}/unifont.sfn")
file(DOWNLOAD
- "https://ftp.gnu.org/gnu/unifont/unifont-13.0.02/unifont-13.0.02.bdf.gz"
+ "https://ftp.gnu.org/gnu/unifont/${FONT_BASE}/${FONT_BASE}.bdf.gz"
"${FONT_FILE}"
EXPECTED_HASH SHA256=ee02036aec9350dc35ebaaa205c43f9f9ad14efc56d63c12b177ac4fd424e94f
)
-add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}"
+add_custom_command(OUTPUT "${SFN_FILE}"
+ DEPENDS "${FONT_FILE}"
COMMAND bit2sfn
-r "Basic Latin" "${FONT_FILE}"
-r "Latin-1 Supplement" "${FONT_FILE}"
@@ -45,28 +34,18 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}"
-r 0x5009 0x500A "${FONT_FILE}"
-r 0x9E97 0x9E98 "${FONT_FILE}"
-r 0x5B50 0x5B51 "${FONT_FILE}"
- "${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}"
+ "${SFN_FILE}"
)
-# build application
-set(ELF "${PROJECT_NAME}.elf")
-set(SELF "${PROJECT_NAME}.self")
-set(VPK "${PROJECT_NAME}.vpk")
+# Build self
-set(TITLE_NAME "Sharpscale Scaling Test")
-set(TITLE_ID "AKRK00004")
-set(TITLE_VER "01.05")
+set(ELF "scaling-test.elf")
+set(SELF "scaling-test.self")
add_executable("${ELF}"
main.c
)
-target_compile_options("${ELF}"
- PRIVATE -O3 -std=c99
- PRIVATE -Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
- PRIVATE -fsingle-precision-constant -fno-common
-)
-
target_link_libraries("${ELF}"
fnblit
SceCtrl_stub
@@ -78,9 +57,16 @@ dolce_create_self("${SELF}"
"${ELF}"
)
+# Build VPK
+
+set(VPK "sharpscale-scaling-test.vpk")
+set(TITLE_NAME "Sharpscale Scaling Test")
+set(TITLE_ID "AKRK00004")
+set(TITLE_VER "01.05")
+
dolce_create_vpk("${VPK}" "${TITLE_ID}" "${SELF}"
- VERSION "${TITLE_VER}"
NAME "${TITLE_NAME}"
+ VERSION "${TITLE_VER}"
FILE icon0.png sce_sys/icon0.png
- FILE "${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}" "${SFN_FILE}"
+ FILE "${SFN_FILE}" font.sfn
)