forked from libffi/libffi
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure_platform.cmake
44 lines (40 loc) · 1.35 KB
/
configure_platform.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
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "")
set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR})
else()
set(HOST_ARCH ${CMAKE_C_COMPILER_ARCHITECTURE_ID})
endif()
if("${TARGET_PLATFORM}" STREQUAL "")
if(HOST_ARCH MATCHES x64|x86_64|AMD64|amd64)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(TARGET_PLATFORM X86_WIN64)
else()
set(TARGET_PLATFORM X86_64)
endif()
elseif(HOST_ARCH MATCHES i.*86.*|X86|x86)
if(CMAKE_SYSTEM_NAME MATCHES Windows)
set(TARGET_PLATFORM X86_WIN32)
else()
set(TARGET_PLATFORM X86)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(TARGET_PLATFORM X86_DARWIN)
elseif(CMAKE_SYSTEM_NAME MATCHES FreeBSD|OpenBSD)
set(TARGET_PLATFORM X86_FREEBSD)
endif()
elseif(HOST_ARCH MATCHES aarch64|ARM64|arm64)
if(CMAKE_SYSTEM_NAME MATCHES Windows)
set(TARGET_PLATFORM ARM_WIN64)
else()
set(TARGET_PLATFORM AARCH64)
endif()
elseif(HOST_ARCH MATCHES arm.*|ARM.*)
if(CMAKE_SYSTEM_NAME MATCHES Windows)
set(TARGET_PLATFORM ARM_WIN32)
else()
set(TARGET_PLATFORM ARM)
endif()
else()
message(FATAL_ERROR "Unknown host.")
endif()
endif()
message(STATUS "Building for TARGET_PLATFORM: ${TARGET_PLATFORM}")