forked from Samsung/walrus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (73 loc) · 2.89 KB
/
CMakeLists.txt
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
CMAKE_MINIMUM_REQUIRED (VERSION 3.1.0)
PROJECT (WALRUS VERSION 0.0.1)
# CONFIGURATION
SET (CMAKE_EXPORT_COMPILE_COMMANDS ON)
# input variable list
# WALRUS_ASAN, WALRUS_SMALL_CONFIG, WALRUS_DEBUG_INFO
MESSAGE(VERBOSE "CMAKE_SYSTEM_NAME: " ${CMAKE_SYSTEM_NAME})
MESSAGE(VERBOSE "CMAKE_SYSTEM_PROCESSOR: " ${CMAKE_SYSTEM_PROCESSOR})
# TODO: Support multi-config generator
MESSAGE(VERBOSE "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
IF (NOT DEFINED WALRUS_MODE)
IF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(WALRUS_MODE "release")
ELSEIF (${CMAKE_BUILD_TYPE} STREQUAL "Release")
SET(WALRUS_MODE "release")
ELSEIF (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
SET(WALRUS_MODE "release")
SET(WALRUS_DEBUG_INFO ON)
ELSEIF (${CMAKE_BUILD_TYPE} STREQUAL "MinSizeRel")
SET(WALRUS_MODE "release")
SET(WALRUS_SMALL_CONFIG ON)
ELSE()
SET(WALRUS_MODE "debug")
ENDIF()
ENDIF()
IF (NOT DEFINED WALRUS_ARCH)
IF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "X86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686")
SET(WALRUS_ARCH "x86")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "EM64T")
SET(WALRUS_ARCH "x64")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm32"
OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
SET(WALRUS_ARCH "arm")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
SET(WALRUS_ARCH "aarch64")
ELSEIF (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "riscv64")
SET(WALRUS_ARCH "riscv64")
ENDIF()
ENDIF()
IF (NOT DEFINED WALRUS_HOST)
IF (${CMAKE_SYSTEM_NAME} STREQUAL "Windows" OR ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
SET(WALRUS_HOST "windows")
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
SET(WALRUS_HOST "android")
ELSEIF (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
SET(WALRUS_HOST "darwin")
ELSE()
SET(WALRUS_HOST "linux")
ENDIF()
ENDIF()
IF (NOT DEFINED WALRUS_MODE)
SET (WALRUS_MODE "release")
ENDIF()
IF (NOT DEFINED WALRUS_OUTPUT)
SET (WALRUS_OUTPUT "shell")
ENDIF()
IF (NOT DEFINED WALRUS_WASI)
# Enable WASI by default
SET (WALRUS_WASI ON)
ENDIF()
MESSAGE(STATUS "Walrus Arch: " ${WALRUS_ARCH})
MESSAGE(STATUS "Walrus Host: " ${WALRUS_HOST})
MESSAGE(STATUS "Walrus Mode: " ${WALRUS_MODE})
MESSAGE(STATUS "Walrus Output: " ${WALRUS_OUTPUT})
MESSAGE(STATUS "Walrus WASI Enabled: " ${WALRUS_WASI})
SET (WALRUS_TARGET walrus)
INCLUDE (ProcessorCount)
PROCESSORCOUNT (NPROCS)
# INCLUDE CMAKE FILES
INCLUDE (${PROJECT_SOURCE_DIR}/build/config.cmake)
INCLUDE (${PROJECT_SOURCE_DIR}/build/walrus.cmake)