forked from nrfconnect/sdk-nrfxlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.cmake
39 lines (37 loc) · 943 Bytes
/
common.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# Copyright (c) 2019 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
#
# Header guard
if(__NRFXLIB_COMMON_CMAKE__)
return()
endif()
set(__NRFXLIB_COMMON_CMAKE__ TRUE)
#
# Build the path of the library taking in
# -Arch type
# -Float ABI
# -wchar_t size
#
function(nrfxlib_calculate_lib_path lib_path)
# Add Arch type
assert(GCC_M_CPU "GCC_M_CPU must be set to find correct lib.")
# Set floating ABI
if(CONFIG_FLOAT)
if(CONFIG_FP_HARDABI)
set(float_dir hard-float)
elseif(CONFIG_FP_SOFTABI)
set(float_dir softfp-float)
else()
assert(0 "Unreachable code")
endif()
else()
set(float_dir soft-float)
endif()
list(FIND COMPILER_OPT_AS_LIST "-fshort-wchar" SHORT_WCHAR_INDEX)
if (NOT (SHORT_WCHAR_INDEX EQUAL -1))
set(short_wchar "/short-wchar")
endif()
set(${lib_path} "lib/${GCC_M_CPU}/${float_dir}${short_wchar}" PARENT_SCOPE)
endfunction()