forked from blami/wslsdlexample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClangMSVC.toolchain.cmake
42 lines (34 loc) · 1.61 KB
/
ClangMSVC.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
# This is toolchain file for use on WSL
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_VERSION 10.0.19041.0)
set(CMAKE_SYSTEM_PROCESSOR amd64)
set(CMAKE_C_COMPILER clang-cl-15)
set(CMAKE_CXX_COMPILER clang-cl-15)
set(CMAKE_LINKER lld-link)
set(CMAKE_C_COMPILER_TARGET x86_64-pc-win32)
set(CMAKE_CXX_COMPILER_TARGET x86_64-pc-win32)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
set(MSVC_PATH "/mnt/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.32.31326")
set(WINSDK_PATH "/mnt/c/Program Files (x86)/Windows Kits/10")
set(WINSDK_VER 10.0.19041.0)
# These are temporary
set(COMPILE_FLAGS
-D_CRT_SECURE_NO_WARNINGS
-imsvc \"${MSVC_PATH}/include\"
-imsvc \"${WINSDK_PATH}/Include/${WINSDK_VER}/ucrt\"
-imsvc \"${WINSDK_PATH}/Include/${WINSDK_VER}/shared\"
-imsvc \"${WINSDK_PATH}/Include/${WINSDK_VER}/um\"
-imsvc \"${WINSDK_PATH}/Include/${WINSDK_VER}/winrt\"
)
string(REPLACE ";" " " COMPILE_FLAGS "${COMPILE_FLAGS}")
set(LINK_FLAGS
-libpath:\"${MSVC_PATH}/lib/x64\"
-libpath:\"${WINSDK_PATH}/Lib/${WINSDK_VER}/ucrt/x64\"
-libpath:\"${WINSDK_PATH}/Lib/${WINSDK_VER}/um/x64\"
)
string(REPLACE ";" " " LINK_FLAGS "${LINK_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILE_FLAGS}" CACHE STRING "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILE_FLAGS}" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS} ${LINK_FLAGS}" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS} ${LINK_FLAGS}" CACHE STRING "")
set(CMAKE_STATIC_LINKER_FLAGS_INIT "${CMAKE_STATIC_LINKER_FLAGS} ${LINK_FLAGS}" CACHE STRING "")