forked from LunarG/LunarGLASS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (72 loc) · 2.68 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 2.8)
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix" FORCE)
project(LunarGLASS)
set(LLVM_BUILD ${CMAKE_CURRENT_SOURCE_DIR}/Core/LLVM/llvm-3.4/build CACHE PATH "LLVM build directory")
set(GLSLANG_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../glslang CACHE PATH "glslang directory")
if(WIN32)
include(Core/LLVM/llvm-3.4/cmake/modules/ChooseMSVCCRT.cmake)
foreach(build_type ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${build_type}" build)
message("CMAKE_CXX_FLAGS_${build} are ${CMAKE_CXX_FLAGS_${build}}")
endforeach(build_type)
set(LLVMINCLUDES ${LLVM_BUILD}/install/include CACHE PATH "LLVM include directory")
set(LLVMLIBS ${LLVM_BUILD}/install/lib CACHE PATH "LLVM library directory")
set(GLSLANGLIBS ${GLSLANG_PATH}/build/install/lib/ CACHE PATH "glslang library directory")
link_directories(${GLSLANGLIBS} ${LLVMLIBS})
elseif(UNIX)
set(LLVMINCLUDES ${LLVM_BUILD}/install/usr/local/include CACHE PATH "LLVM include directory")
set(LLVMLIBS ${LLVM_BUILD}/install/usr/local/lib CACHE PATH "LLVM library directory")
set(GLSLANGLIBS ${GLSLANG_PATH}/build/install/lib/ CACHE PATH "glslang library directory")
link_directories(${GLSLANGLIBS} ${LLVMLIBS})
else(WIN32)
message("unknown platform")
endif(WIN32)
set(GLSLANGINCLUDES ${GLSLANG_PATH} CACHE PATH "glslang include directory")
set(LLVMLIBS
LLVMAsmParser
LLVMLinker
LLVMipo
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMipa
LLVMAnalysis
LLVMTarget
LLVMCore
LLVMSupport)
if(WIN32)
set(SYSTEM_LIBS "")
elseif(UNIX)
# Get system library dependencies from llvm-config.
execute_process(COMMAND ${LLVM_BUILD}/install/usr/local/bin/llvm-config --ldflags OUTPUT_VARIABLE LLVM_LD_FLAGS)
# Convert to a list of link flags.
string(REPLACE " " ";" LLVM_LD_FLAGS_LIST ${LLVM_LD_FLAGS})
foreach(LIB ${LLVM_LD_FLAGS_LIST})
if (${LIB} MATCHES "^-l")
# Get the library's name.
string(SUBSTRING ${LIB} 2 -1 LIBNAME)
list(APPEND SYSTEM_LIBS ${LIBNAME})
endif()
endforeach()
endif(WIN32)
set(GLSLANGLIBS
glslang
HLSL
OSDependent
OGLCompiler
SPIRV)
if(WIN32)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
elseif(UNIX)
execute_process(COMMAND ${LLVM_BUILD}/install/usr/local/bin/llvm-config --cxxflags OUTPUT_VARIABLE LLVM_CXX_FLAGS)
add_definitions(${LLVM_CXX_FLAGS})
endif(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-std=c++11)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
add_definitions(-std=c++11)
endif()
add_subdirectory(Frontends)
add_subdirectory(Core)
add_subdirectory(Backends)
add_subdirectory(Standalone)