-
Notifications
You must be signed in to change notification settings - Fork 22
/
CMakeLists.txt
164 lines (119 loc) · 5.87 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
# This source file is part of appleseed.
# Visit https://appleseedhq.net/ for additional information and resources.
#
# This software is released under the MIT license.
#
# Copyright (c) 2016-2019 Esteban Tovagliari, The appleseedhq Organization
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
#--------------------------------------------------------------------------------------------------
# CMake configuration.
#--------------------------------------------------------------------------------------------------
cmake_minimum_required (VERSION 3.9 FATAL_ERROR)
#--------------------------------------------------------------------------------------------------
# Project configuration.
#--------------------------------------------------------------------------------------------------
# Prevent in-source builds.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message (FATAL_ERROR "In-source builds are not permitted; run CMake inside an empty build directory.")
endif ()
# Create build configurations. Must come before project ().
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
# Select a build configuration if none is selected yet.
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Debug
CACHE STRING "Choose the type of build, options are: ${CMAKE_CONFIGURATION_TYPES}" FORCE)
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
endif ()
project (appleseed-maya)
# Must come after project ().
set (CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
${PROJECT_SOURCE_DIR}/cmake/Modules
)
#--------------------------------------------------------------------------------------------------
# Version.
#--------------------------------------------------------------------------------------------------
set (appleseed_maya_version_major 1)
set (appleseed_maya_version_minor 3)
set (appleseed_maya_version_patch 0)
set (appleseed_maya_version_maturity beta)
#--------------------------------------------------------------------------------------------------
# Build options.
#--------------------------------------------------------------------------------------------------
option (USE_STATIC_BOOST "Use static Boost libraries" ON)
option (WITH_XGEN "Build XGen support" OFF)
#--------------------------------------------------------------------------------------------------
# Preprocessor definitions.
#--------------------------------------------------------------------------------------------------
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES)
endif ()
#--------------------------------------------------------------------------------------------------
# Compile flags.
#--------------------------------------------------------------------------------------------------
if (UNIX)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -msse4.2")
endif ()
#--------------------------------------------------------------------------------------------------
# Boost libraries.
#--------------------------------------------------------------------------------------------------
set (Boost_MULTITHREADED TRUE)
if (USE_STATIC_BOOST)
set (Boost_USE_STATIC_LIBS TRUE)
endif ()
find_package (Boost 1.61 REQUIRED filesystem system)
add_definitions (-DBOOST_FILESYSTEM_VERSION=3 -DBOOST_FILESYSTEM_NO_DEPRECATED)
if (NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Workaround for undefined reference to boost::filesystem::detail::copy_file link error
# on Linux and macOS if Boost is built in C++03 mode.
add_definitions (-DBOOST_NO_CXX11_SCOPED_ENUMS)
endif ()
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})
link_directories (${Boost_LIBRARY_DIRS})
#--------------------------------------------------------------------------------------------------
# Find external packages.
#--------------------------------------------------------------------------------------------------
find_package (Appleseed REQUIRED)
find_package (OpenGL REQUIRED)
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
find_package (Imath REQUIRED)
endif ()
find_package (Maya REQUIRED)
message ("Maya API version = ${MAYA_API_VERSION}")
if (WITH_XGEN)
find_package (XGen REQUIRED)
endif ()
# Make sure you pick the Python interpreter inside Maya...
find_package (PythonLibs REQUIRED)
#--------------------------------------------------------------------------------------------------
# Common include paths.
#--------------------------------------------------------------------------------------------------
include_directories (
${APPLESEED_INCLUDE_DIRS}
)
#--------------------------------------------------------------------------------------------------
# Products.
#--------------------------------------------------------------------------------------------------
add_subdirectory (src/appleseedmaya)
if (WITH_XGEN)
add_subdirectory (src/xgenseed)
endif ()