-
Notifications
You must be signed in to change notification settings - Fork 0
/
musl-cross.toolchain.cmake
145 lines (139 loc) · 7.16 KB
/
musl-cross.toolchain.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
set(CMAKE_SYSTEM_NAME Linux)
if(DEFINED ENV{TOOLCHAIN_NAME})
if($ENV{TOOLCHAIN_NAME} STREQUAL "aarch64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR aarch64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "aarch64_be-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR aarch64_be)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "arm-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR arm)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "arm-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR arm)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armeb-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armeb)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armeb-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armeb)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armel-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armel-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv5te-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armv5te)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv5l-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armv5l)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv5l-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armv5l)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv6-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armv6)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv6-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armv6)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv7-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armv7)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv7-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armv7)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv7l-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armv7l)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv7m-linux-musleabi" )
set(CMAKE_SYSTEM_PROCESSOR armv7m)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "armv7r-linux-musleabihf" )
set(CMAKE_SYSTEM_PROCESSOR armv7r)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "i486-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR i486)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "i586-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR i586)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "i686-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR i686)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "loongarch64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR loongarch64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "m68k-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR m68k)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "microblaze-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR microblaze)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "microblazeel-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR microblazeel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR mips)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips-linux-muslsf" )
set(CMAKE_SYSTEM_PROCESSOR mips)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips-linux-musln32sf" )
set(CMAKE_SYSTEM_PROCESSOR mips)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR mips64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64-linux-musln32" )
set(CMAKE_SYSTEM_PROCESSOR mips64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64-linux-musln32sf" )
set(CMAKE_SYSTEM_PROCESSOR mips64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64el-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR mips64el)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64el-linux-musln32" )
set(CMAKE_SYSTEM_PROCESSOR mips64el)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mips64el-linux-musln32sf" )
set(CMAKE_SYSTEM_PROCESSOR mips64el)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mipsel-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR mipsel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mipsel-linux-musln32" )
set(CMAKE_SYSTEM_PROCESSOR mipsel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mipsel-linux-musln32sf" )
set(CMAKE_SYSTEM_PROCESSOR mipsel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "mipsel-linux-muslsf" )
set(CMAKE_SYSTEM_PROCESSOR mipsel)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "or1k-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR or1k)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpc-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR powerpc)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpc-linux-muslsf" )
set(CMAKE_SYSTEM_PROCESSOR powerpc)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpc64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR powerpc64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpc64le-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR powerpc64le)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpcle-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR powerpcle)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "powerpcle-linux-muslsf" )
set(CMAKE_SYSTEM_PROCESSOR powerpcle)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "riscv32-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR riscv32)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "riscv64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR riscv64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "s390x-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR s390x)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh2-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR sh2)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh2-linux-muslfdpic" )
set(CMAKE_SYSTEM_PROCESSOR sh2)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh2eb-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR sh2eb)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh2eb-linux-muslfdpic" )
set(CMAKE_SYSTEM_PROCESSOR sh2eb)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh4-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR sh4)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "sh4eb-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR sh4eb)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "x86_64-linux-musl" )
set(CMAKE_SYSTEM_PROCESSOR x86_64)
elseif($ENV{TOOLCHAIN_NAME} STREQUAL "x86_64-linux-muslx32" )
set(CMAKE_SYSTEM_PROCESSOR x86_64)
else()
message(FATAL_ERROR "TOOLCHAIN_NAME: $ENV{TOOLCHAIN_NAME} not supported!")
endif()
else()
message(FATAL_ERROR "TOOLCHAIN_NAME env must be defined")
endif()
set(TOOLCHAIN_NAME $ENV{TOOLCHAIN_NAME} CACHE STRING "toolchain name")
if(DEFINED ENV{TOOLCHAIN_PATH})
file(TO_CMAKE_PATH $ENV{TOOLCHAIN_PATH} TOOLCHAIN_PATH)
else()
message(FATAL_ERROR "TOOLCHAIN_PATH env must be defined")
endif()
set(TOOLCHAIN_PATH ${TOOLCHAIN_PATH} CACHE STRING "root path to toolchain")
set(CMAKE_C_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-gcc")
set(CMAKE_CXX_COMPILER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-g++")
set(CMAKE_LINKER "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ld")
set(CMAKE_OBJDUMP "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-objdump")
set(CMAKE_AR "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ar")
set(CMAKE_NM "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-nm")
set(CMAKE_RANLIB "${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_NAME}-ranlib")
#set(CMAKE_FIND_ROOT_PATH "${TOOLCHAIN_PATH}/${TOOLCHAIN_NAME}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)