-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·131 lines (109 loc) · 3.98 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
###############################################################################
cmake_minimum_required (VERSION 3.0)
project (WINBRICK)
###############################################################################
find_package(OpenGL REQUIRED)
# c++11
if(${CMAKE_CXX_COMPILER_ID} MATCHES GNU OR ${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
# Using C++11 on OSX requires using libc++ instead of libstd++.
# libc++ is an implementation of the C++ standard library for OSX.
if(APPLE)
if(XCODE)
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
endif()
if( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR )
message( FATAL_ERROR "Please select another Build Directory ! (and give it a clever name, like bin_Visual2012_64bits/)" )
endif()
if( CMAKE_SOURCE_DIR MATCHES " " )
message( "Your Source Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()
if( CMAKE_BINARY_DIR MATCHES " " )
message( "Your Build Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()
# Compile external dependencies
add_subdirectory (external)
# On Visual 2005 and above, this module can set the debug working directory
cmake_policy(SET CMP0026 OLD)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/rpavlik-cmake-modules-fe2273")
include(CreateLaunchers)
include(MSVCMultipleProcessCompile) # /MP
###############################################################################
include_directories(
external/glfw-3.1.2/include/GLFW/
external/glm-0.9.7.1/
external/glew-1.13.0/include/
external/Simple-OpenGL-Image-Library/include/
external/tinyxml2/include/
external/tinyobjloader/include/
.
)
set(ALL_LIBS
${OPENGL_LIBRARY}
glfw
GLEW_1130
SOIL
TINYXML2
)
add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
)
###############################################################################
# winbrick
add_executable(winbrick
winbrick/winbrick_ver11.cpp
common/util.cpp
common/util.h
common/shader.cpp
common/shader.h
common/ModelLoader.cpp
common/ModelLoader.h
common/texture.cpp
common/texture.h
common/Box.h
common/Sphere.h
common/Board.h
common/Cube.h
common/GameGrid_ver2.h
common/Fonts.h
common/Menu.h
common/Extras.h
winbrick/winbrick_ver11.h
winbrick/StandardShading.fragmentshader
winbrick/StandardShading.vertexshader
)
target_link_libraries(winbrick
${ALL_LIBS}
)
# Xcode and Visual working directories
set_target_properties(winbrick
PROPERTIES
XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "${CMAKE_CURRENT_SOURCE_DIR}/winbrick/"
PROJECT_LABEL "WinBrick - Game"
FOLDER "AppCode"
)
create_target_launcher(winbrick WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/winbrick/")
create_default_target_launcher(winbrick WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/winbrick/")
###############################################################################
SOURCE_GROUP(common REGULAR_EXPRESSION ".*/common/.*" )
SOURCE_GROUP(shaders REGULAR_EXPRESSION ".*/.*shader$" )
SOURCE_GROUP(obj REGULAR_EXPRESSION ".*/.*obj$" )
###############################################################################
# copy
if (NOT ${CMAKE_GENERATOR} MATCHES "Xcode" )
add_custom_command(
TARGET winbrick POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/winbrick${CMAKE_EXECUTABLE_SUFFIX}" "${CMAKE_CURRENT_SOURCE_DIR}/winbrick/"
)
elseif (${CMAKE_GENERATOR} MATCHES "Xcode" )
endif (NOT ${CMAKE_GENERATOR} MATCHES "Xcode" )