-
Notifications
You must be signed in to change notification settings - Fork 1
/
toolchain.cmake
38 lines (35 loc) · 1.59 KB
/
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
SET(CMAKE_C_FLAGS "-Wall -std=c99")
SET(CMAKE_C_FLAGS_DEBUG "-g")
SET(CMAKE_C_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_C_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
SET(CMAKE_CXX_FLAGS "-Wall")
SET(CMAKE_CXX_FLAGS_DEBUG "-g")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
# set target to rustc target
EXECUTE_PROCESS(COMMAND bash "-c" "rustc -vV | sed -n 's|host: ||p'"
OUTPUT_VARIABLE TARGET
OUTPUT_STRIP_TRAILING_WHITESPACE)
SET(CMAKE_C_COMPILER_TARGET ${TARGET})
SET(CMAKE_CXX_COMPILER_TARGET ${TARGET})
if (APPLE)
MESSAGE(STATUS "Using LLVM/Clang from Homebrew")
SET(CMAKE_C_COMPILER $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/clang)
SET(CMAKE_CXX_COMPILER $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/clang++)
SET(CMAKE_AR $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/llvm-ar)
SET(CMAKE_LINKER $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/llvm-ld)
SET(CMAKE_NM $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/llvm-nm)
SET(CMAKE_OBJDUMP $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/llvm-objdump)
SET(CMAKE_RANLIB $ENV{HOMEBREW_PREFIX}/opt/llvm/bin/llvm-ranlib)
else ()
MESSAGE(STATUS "Using LLVM/Clang from Linux")
SET(CMAKE_C_COMPILER /usr/bin/clang)
SET(CMAKE_CXX_COMPILER /usr/bin/clang++)
SET(CMAKE_AR /usr/bin/llvm-ar)
SET(CMAKE_LINKER /usr/bin/llvm-ld)
SET(CMAKE_NM /usr/bin/llvm-nm)
SET(CMAKE_OBJDUMP /usr/bin/llvm-objdump)
SET(CMAKE_RANLIB /usr/bin/llvm-ranlib)
endif ()