aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author浅倉麗子2020-06-08 18:41:02 -0400
committer浅倉麗子2020-06-08 18:41:02 -0400
commita4ecedc50d9cc02d48f5d280f802abf5023ce2aa (patch)
tree337981b367159f57cdaabe613238a8245557db67
parentUpdate readme and changelog (diff)
downloadsharpscale-a4ecedc50d9cc02d48f5d280f802abf5023ce2aa.tar.gz
Add compile flags and warningsv1.4.0
-rw-r--r--CMakeLists.txt24
-rw-r--r--config-app/CMakeLists.txt6
-rw-r--r--scaling-test/CMakeLists.txt10
3 files changed, 28 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0ba4e40..61f137a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,16 +27,6 @@ include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
project(sharpscale LANGUAGES C)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O3 -std=c99 -Wdouble-promotion -fsingle-precision-constant")
-
-if(LOG_PRINTF)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLOG_PRINTF")
-endif()
-
-if(LOG_FILE)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLOG_FILE")
-endif()
-
set(ELF "${PROJECT_NAME}.elf")
set(SELF "${PROJECT_NAME}.skprx")
@@ -45,6 +35,20 @@ add_executable("${ELF}"
config.c
)
+target_compile_options("${ELF}"
+ PRIVATE -O3 -std=c99
+ PRIVATE -Wall -Wextra -Wdouble-promotion -Wshadow -Wundef
+ PRIVATE -fsingle-precision-constant -fno-common
+)
+
+if(LOG_PRINTF)
+ target_compile_definitions("${ELF}" PRIVATE LOG_PRINTF)
+endif()
+
+if(LOG_FILE)
+ target_compile_definitions("${ELF}" PRIVATE LOG_FILE)
+endif()
+
target_link_options("${ELF}"
PRIVATE -nostdlib
)
diff --git a/config-app/CMakeLists.txt b/config-app/CMakeLists.txt
index df2e0f3..0f8d62d 100644
--- a/config-app/CMakeLists.txt
+++ b/config-app/CMakeLists.txt
@@ -31,6 +31,12 @@ 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}"
)
diff --git a/scaling-test/CMakeLists.txt b/scaling-test/CMakeLists.txt
index debfb02..3b3c999 100644
--- a/scaling-test/CMakeLists.txt
+++ b/scaling-test/CMakeLists.txt
@@ -27,8 +27,7 @@ include("$ENV{DOLCESDK}/share/dolce.cmake" REQUIRED)
project(sharpscale_scaling_test LANGUAGES C)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -O3 -std=c99")
-
+# build font
set(FONT_FILE "unifont.bdf.gz")
set(SFN_FILE "font.sfn")
@@ -49,6 +48,7 @@ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}"
"${CMAKE_CURRENT_BINARY_DIR}/${SFN_FILE}"
)
+# build application
set(ELF "${PROJECT_NAME}.elf")
set(SELF "${PROJECT_NAME}.self")
set(VPK "${PROJECT_NAME}.vpk")
@@ -61,6 +61,12 @@ 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