|
1 | | -# |
2 | | -# Copyright (c) .NET Foundation and Contributors |
3 | | -# See LICENSE file in the project root for full license information. |
4 | | -# |
5 | | - |
6 | | -# need to specify linker flags here |
7 | | -set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags") |
8 | | - |
9 | | -# TARGET parameter to set the target that's setting them for |
10 | | -# optional EXTRA_COMPILE_OPTIONS with compile options to be added |
11 | | -macro(nf_set_compile_options) |
12 | | - |
13 | | - # parse arguments |
14 | | - cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN}) |
15 | | - |
16 | | - if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "") |
17 | | - message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()") |
18 | | - endif() |
19 | | - |
20 | | - # include any extra options coming from any extra args? |
21 | | - target_compile_options(${NFSCO_TARGET} PUBLIC ${NFSCO_EXTRA_COMPILE_OPTIONS} -Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-parameter -Wshadow -Wimplicit-fallthrough -fshort-wchar -fno-builtin -fno-common -fno-exceptions -fcheck-new ) |
22 | | - |
23 | | - # this series has FPU |
24 | | - target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32c6 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM) |
25 | | - |
26 | | -endmacro() |
27 | | - |
28 | | -# TARGET parameter to set the target that's setting them for |
29 | | -# optional EXTRA_LINK_FLAGS with link flags to be added |
30 | | -macro(nf_set_link_options) |
31 | | - |
32 | | - # parse arguments |
33 | | - cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN}) |
34 | | - |
35 | | - if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "") |
36 | | - message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()") |
37 | | - endif() |
38 | | - |
39 | | - # set optimization linker flags for RELEASE and MinSizeRel |
40 | | - if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") |
41 | | - set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ") |
42 | | - endif() |
43 | | - |
44 | | - # include libraries in build |
45 | | - nf_include_libraries_in_build(${NFSLO_TARGET}) |
46 | | - |
47 | | - # set extra linker flags |
48 | | - set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ") |
49 | | - |
50 | | - # set optimization flags |
51 | | - nf_set_optimization_options(${NFSLO_TARGET}) |
52 | | - |
53 | | -endmacro() |
| 1 | +# |
| 2 | +# Copyright (c) .NET Foundation and Contributors |
| 3 | +# See LICENSE file in the project root for full license information. |
| 4 | +# |
| 5 | + |
| 6 | +# need to specify linker flags here |
| 7 | +set(CMAKE_EXE_LINKER_FLAGS " -Wl,--print-memory-usage " CACHE INTERNAL "executable linker flags") |
| 8 | + |
| 9 | +# TARGET parameter to set the target that's setting them for |
| 10 | +# optional EXTRA_COMPILE_OPTIONS with compile options to be added |
| 11 | +macro(nf_set_compile_options) |
| 12 | + |
| 13 | + # parse arguments |
| 14 | + cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN}) |
| 15 | + |
| 16 | + if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "") |
| 17 | + message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()") |
| 18 | + endif() |
| 19 | + |
| 20 | + # include any extra options coming from any extra args? |
| 21 | + target_compile_options(${NFSCO_TARGET} PUBLIC ${NFSCO_EXTRA_COMPILE_OPTIONS} -Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-parameter -Wshadow -Wimplicit-fallthrough -fshort-wchar -fno-builtin -fno-common -fno-exceptions -fcheck-new ) |
| 22 | + |
| 23 | + # this series has FPU |
| 24 | + target_compile_definitions(${NFSCO_TARGET} PUBLIC -DTARGET=esp32c5 -DUSE_FPU=TRUE -DPLATFORM_ESP32 -DESP_PLATFORM) |
| 25 | + |
| 26 | +endmacro() |
| 27 | + |
| 28 | +# TARGET parameter to set the target that's setting them for |
| 29 | +# optional EXTRA_LINK_FLAGS with link flags to be added |
| 30 | +macro(nf_set_link_options) |
| 31 | + |
| 32 | + # parse arguments |
| 33 | + cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN}) |
| 34 | + |
| 35 | + if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "") |
| 36 | + message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()") |
| 37 | + endif() |
| 38 | + |
| 39 | + # set optimization linker flags for RELEASE and MinSizeRel |
| 40 | + if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") |
| 41 | + set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os ") |
| 42 | + endif() |
| 43 | + |
| 44 | + # include libraries in build |
| 45 | + nf_include_libraries_in_build(${NFSLO_TARGET}) |
| 46 | + |
| 47 | + # set extra linker flags |
| 48 | + set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ") |
| 49 | + |
| 50 | + # set optimization flags |
| 51 | + nf_set_optimization_options(${NFSLO_TARGET}) |
| 52 | + |
| 53 | +endmacro() |
0 commit comments