-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
92 lines (77 loc) · 2.9 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
86
87
88
89
90
91
#-------------------------------------------------------------------------------
# anyfx
#-------------------------------------------------------------------------------
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
SET(ANYFX_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
IF(NOT DEFINED ANYFX_FOLDER)
SET(ANYFX_FOLDER "anyfx")
ENDIF()
SET(ANYFX_VULKAN_EXTERNAL ON)
SET(ANYFX_GLEW_EXTERNAL ON)
IF(NOT DEFINED ANYFX_GLEW_FOLDER)
SET(ANYFX_GLEW_FOLDER ${ANYFX_SOURCE_DIR}/exts/glew)
SET(ANYFX_GLEW_EXTERNAL OFF)
ENDIF()
INCLUDE(macros.cmake)
PROJECT(AnyFX)
IF (WIN32)
SET(OPENGL_LIBS glu32.lib opengl32.lib)
ELSEIF(APPLE)
LINK_DIRECTORIES(/System/Library/Frameworks /usr/X11R6/lib /opt/local/lib)
INCLUDE_DIRECTORIES(/System/Library/Frameworks /usr/X11R6/include /opt/local/include)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
SET(OPENGL_LIBS ${OPENGL_LIBRARIES} X11)
ELSEIF(UNIX)
SET(OPENGL_LIBS GL X11)
ENDIF()
# set compiler definitions
IF(WIN32)
ADD_DEFINITIONS(-D__WIN32__)
ELSEIF(APPLE)
ADD_DEFINITIONS(-D__APPLE__)
ELSEIF(UNIX)
ADD_DEFINITIONS(-D__UNIX__)
ENDIF()
IF(MSVC)
ADD_DEFINITIONS(-D__MSVC__)
ELSEIF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-D__GNUCXX__)
ENDIF()
OPTION(ANYFX_BUILD_DEMO "Build AnyFX Demo" OFF)
OPTION(ANYFX_BUILD_COMPILER_LIBRARY "Build AnyFX Compiler as a library" ON)
OPTION(ANYFX_TRANSPOSE_MATRICES "Builds AnyFX with automatic matrix transposing for variables")
ADD_SUBDIRECTORY(compiler)
ADD_SUBDIRECTORY(api)
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(exts/eastl)
ADD_SUBDIRECTORY(exts/glslang)
IF (NOT ANYFX_VULKAN_EXTERNAL)
INCLUDE_DIRECTORIES(exts/vulkan/src/vulkan)
SET_TARGET_PROPERTIES(vulkan PROPERTIES FOLDER ${ANYFX_FOLDER}/exts)
ENDIF()
IF (NOT ANYFX_GLEW_EXTERNAL)
ADD_SUBDIRECTORY(exts/glew)
SET_TARGET_PROPERTIES(glew PROPERTIES FOLDER ${ANYFX_FOLDER}/exts)
ENDIF()
# set target subdirs
SET_TARGET_PROPERTIES(compiler PROPERTIES FOLDER ${ANYFX_FOLDER})
SET_TARGET_PROPERTIES(mcpp PROPERTIES FOLDER ${ANYFX_FOLDER})
SET_TARGET_PROPERTIES(antlr PROPERTIES FOLDER ${ANYFX_FOLDER})
SET_TARGET_PROPERTIES(api PROPERTIES FOLDER ${ANYFX_FOLDER})
SET_TARGET_PROPERTIES(util PROPERTIES FOLDER ${ANYFX_FOLDER})
SET_TARGET_PROPERTIES(EASTL PROPERTIES FOLDER ${ANYFX_FOLDER})
# set khronos compiler folders
SET_TARGET_PROPERTIES(glslang PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
SET_TARGET_PROPERTIES(glslangValidator PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
SET_TARGET_PROPERTIES(OGLCompiler PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
SET_TARGET_PROPERTIES(OSDependent PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
SET_TARGET_PROPERTIES(SPIRV PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
SET_TARGET_PROPERTIES(spirv-remap PROPERTIES FOLDER ${ANYFX_FOLDER}/khronos)
IF(ANYFX_TRANSPOSE_MATRICES)
ADD_DEFINITIONS(-D__ANYFX_TRANSPOSE_MATRIX__)
ENDIF()
IF(ANYFX_BUILD_DEMO)
ADD_SUBDIRECTORY(demo)
SET_TARGET_PROPERTIES(demo PROPERTIES FOLDER ${ANYFX_FOLDER})
ENDIF()