File tree Expand file tree Collapse file tree 4 files changed +27
-40
lines changed Expand file tree Collapse file tree 4 files changed +27
-40
lines changed Original file line number Diff line number Diff line change @@ -27,10 +27,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
27
27
set (CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "" )
28
28
set (CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "" )
29
29
30
- # Disable compiler checks.
31
- set (CMAKE_C_COMPILER_FORCED TRUE )
32
- set (CMAKE_CXX_COMPILER_FORCED TRUE )
33
-
34
30
# Add target system root to cmake find path.
35
31
get_filename_component (PICO_COMPILER_DIR "${PICO_COMPILER_CC} " DIRECTORY )
36
32
get_filename_component (CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR} " DIRECTORY )
@@ -43,11 +39,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
43
39
44
40
include_directories (/usr/include /newlib)
45
41
46
- # todo move to platform/Generix-xxx
47
- set (ARM_CLANG_COMMON_FLAGS " --target=arm-none-eabi -mcpu=cortex-m0plus -mthumb" )
48
- set (CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
49
- set (CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
50
- set (CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
51
- set (CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og" )
52
- set (CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og" )
42
+ option (PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
53
43
44
+ set (ARM_TOOLCHAIN_COMMON_FLAGS " --target=arm-none-eabi -mcpu=cortex-m0plus -mthumb" )
45
+ include (${CMAKE_CURRENT_LIST_DIR} /set_flags.cmake)
Original file line number Diff line number Diff line change @@ -27,10 +27,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
27
27
set (CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "" )
28
28
set (CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "" )
29
29
30
- # Disable compiler checks.
31
- set (CMAKE_C_COMPILER_FORCED TRUE )
32
- set (CMAKE_CXX_COMPILER_FORCED TRUE )
33
-
34
30
# Add target system root to cmake find path.
35
31
get_filename_component (PICO_COMPILER_DIR "${PICO_COMPILER_CC} " DIRECTORY )
36
32
get_filename_component (CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR} " DIRECTORY )
@@ -41,12 +37,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
41
37
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
42
38
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
43
39
44
- # todo move to platform/Generix-xxx
45
- set (ARM_CLANG_COMMON_FLAGS " --cpu=Cortex-M0plus" )
46
- string (APPEND CMAKE_C_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
47
- string (APPEND CMAKE_CXX_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
48
- string (APPEND CMAKE_ASM_FLAGS_INIT "${ARM_CLANG_COMMON_FLAGS} " )
49
- string (APPEND CMAKE_C_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og" )
50
- string (APPEND CMAKE_CXX_FLAGS_DEBUG_INIT "${ARM_CLANG_COMMON_FLAGS} -Og" )
51
-
40
+ option (PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
52
41
42
+ set (ARM_TOOLCHAIN_COMMON_FLAGS " --cpu=Cortex-M0plus" )
43
+ include (${CMAKE_CURRENT_LIST_DIR} /set_flags.cmake)
Original file line number Diff line number Diff line change @@ -35,10 +35,6 @@ set(CMAKE_INCLUDE_FLAG_ASM "-I")
35
35
set (CMAKE_OBJCOPY ${PICO_OBJCOPY} CACHE FILEPATH "" )
36
36
set (CMAKE_OBJDUMP ${PICO_OBJDUMP} CACHE FILEPATH "" )
37
37
38
- # Disable compiler checks.
39
- set (CMAKE_C_COMPILER_FORCED TRUE )
40
- set (CMAKE_CXX_COMPILER_FORCED TRUE )
41
-
42
38
# Add target system root to cmake find path.
43
39
get_filename_component (PICO_COMPILER_DIR "${PICO_COMPILER_CC} " DIRECTORY )
44
40
get_filename_component (CMAKE_FIND_ROOT_PATH "${PICO_COMPILER_DIR} " DIRECTORY )
@@ -51,17 +47,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
51
47
52
48
option (PICO_DEOPTIMIZED_DEBUG "Build debug builds with -O0" 0)
53
49
54
- # todo move to platform/Generix-xxx
55
-
56
50
# on ARM -mcpu should not be mixed with -march
57
- set (ARM_GCC_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb" )
58
- foreach (LANG IN ITEMS C CXX ASM)
59
- set (CMAKE_${LANG} _FLAGS_INIT "${ARM_GCC_COMMON_FLAGS} " )
60
- if (PICO_DEOPTIMIZED_DEBUG)
61
- set (CMAKE_${LANG} _FLAGS_DEBUG_INIT "-O0" )
62
- else ()
63
- set (CMAKE_${LANG} _FLAGS_DEBUG_INIT "-Og" )
64
- endif ()
65
- set (CMAKE_${LANG} _LINK_FLAGS "-Wl,--build-id=none" )
66
- endforeach ()
67
-
51
+ set (ARM_TOOLCHAIN_COMMON_FLAGS " -mcpu=cortex-m0plus -mthumb" )
52
+ include (${CMAKE_CURRENT_LIST_DIR} /set_flags.cmake)
Original file line number Diff line number Diff line change
1
+
2
+ get_property (IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
3
+ foreach (LANG IN ITEMS C CXX ASM)
4
+ set (CMAKE_${LANG} _FLAGS_INIT "${ARM_TOOLCHAIN_COMMON_FLAGS} " )
5
+ if (PICO_DEOPTIMIZED_DEBUG)
6
+ set (CMAKE_${LANG} _FLAGS_DEBUG_INIT "-O0" )
7
+ else ()
8
+ set (CMAKE_${LANG} _FLAGS_DEBUG_INIT "-Og" )
9
+ endif ()
10
+ set (CMAKE_${LANG} _LINK_FLAGS "-Wl,--build-id=none" )
11
+
12
+ # try_compile is where the feature testing is done, and at that point,
13
+ # pico_standard_link is not ready to be linked in to provide essential
14
+ # functions like _exit. So pass -nostdlib so it doesn't link in an exit()
15
+ # function at all.
16
+ if (IS_IN_TRY_COMPILE)
17
+ set (CMAKE_${LANG} _LINK_FLAGS "${CMAKE_${LANG} _LINK_FLAGS} -nostdlib" )
18
+ endif ()
19
+ endforeach ()
You can’t perform that action at this time.
0 commit comments