|
| 1 | +################################################################################ |
| 2 | +# Copyright 1998-2015 by authors (see AUTHORS.txt) |
| 3 | +# |
| 4 | +# This file is part of LuxRender. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +################################################################################ |
| 18 | + |
| 19 | +MESSAGE(STATUS "CMAKE VERSION DETECTED " ${CMAKE_VERSION}) |
| 20 | + |
| 21 | + |
| 22 | +################################################################################ |
| 23 | +# |
| 24 | +# Check and configure cmake |
| 25 | +# |
| 26 | +################################################################################ |
| 27 | +# Fresh start |
| 28 | +cmake_minimum_required(VERSION 2.8) |
| 29 | +cmake_policy(VERSION 2.8) |
| 30 | +#Remove the following when the version check is at least 2.8.4 |
| 31 | +SET(CMAKE_LEGACY_CYGWIN_WIN32 0) |
| 32 | + |
| 33 | +project(LuxRays) |
| 34 | + |
| 35 | +# Don't over-configure |
| 36 | +SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limit configs" FORCE) |
| 37 | + |
| 38 | + |
| 39 | +################################################################################ |
| 40 | +# |
| 41 | +# Include necessary submodules |
| 42 | +# |
| 43 | +################################################################################ |
| 44 | + |
| 45 | +set(CMAKE_MODULE_PATH |
| 46 | + "${LuxRays_SOURCE_DIR}" |
| 47 | + "${LuxRays_SOURCE_DIR}/cmake" |
| 48 | + "${LuxRays_SOURCE_DIR}/cmake/Utils" |
| 49 | + "${LuxRays_SOURCE_DIR}/cmake/Packages" |
| 50 | + "${LuxRays_SOURCE_DIR}/cmake/SpecializedConfig" |
| 51 | +) |
| 52 | + |
| 53 | +# When using single configuration generators like make |
| 54 | +# cmake does need to know which of the possible configurations |
| 55 | +# to generate |
| 56 | +if(NOT CMAKE_BUILD_TYPE) |
| 57 | + set(CMAKE_BUILD_TYPE Release) |
| 58 | +endif(NOT CMAKE_BUILD_TYPE) |
| 59 | +SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "assure config" FORCE) # makes sure type is shown in cmake gui |
| 60 | + |
| 61 | +message(STATUS "Building mode: " ${CMAKE_BUILD_TYPE}) |
| 62 | + |
| 63 | +INCLUDE(PlatformSpecific) |
| 64 | +INCLUDE(Configuration) |
| 65 | +INCLUDE(KernelPreprocess) |
| 66 | + |
| 67 | +# Install CMake modules |
| 68 | +#add_subdirectory(CMake) |
| 69 | + |
| 70 | +SET(LuxRays_INCLUDE_DIR "${LuxRays_SOURCE_DIR}/include") |
| 71 | +include_directories("${LuxRays_INCLUDE_DIR}") |
| 72 | + |
| 73 | +# Find dependencies |
| 74 | +include(Dependencies) |
| 75 | + |
| 76 | +if (NOT Boost_FOUND) |
| 77 | + MESSAGE(FATAL_ERROR "--> Could not locate required Boost files - Please check ${BOOST_SEARCH_PATH}") |
| 78 | +endif() |
| 79 | + |
| 80 | +if (NOT OPENIMAGEIO_FOUND) |
| 81 | + MESSAGE(FATAL_ERROR "--> Could not locate required OpenImageIO files - Please check ${OPENIMAGEIO_SEARCH_PATH}") |
| 82 | +endif() |
| 83 | + |
| 84 | +if (NOT OPENCL_FOUND AND NOT LUXRAYS_DISABLE_OPENCL) |
| 85 | + MESSAGE(ERROR "--> Could not locate required OpenCL files, disabling OpenCL support - Please check ${OPENCL_SEARCH_PATH}") |
| 86 | + SET(LUXRAYS_DISABLE_OPENCL 1) |
| 87 | +endif() |
| 88 | + |
| 89 | +if (NOT OPENGL_FOUND AND NOT LUXRAYS_DISABLE_OPENCL) |
| 90 | + MESSAGE(ERROR "--> Could not locate required OpenGL files, disabling OpenCL support, disabling samples build") |
| 91 | + SET(LUXRAYS_DISABLE_OPENCL 1) |
| 92 | +endif() |
| 93 | + |
| 94 | +if (NOT GLEW_FOUND) |
| 95 | + MESSAGE(FATAL_ERROR "--> Could not locate required GLEW files, disabling samples build - Please check ${GLEW_SEARCH_PATH}") |
| 96 | +endif() |
| 97 | + |
| 98 | +if (NOT GLUT_FOUND) |
| 99 | + MESSAGE(FATAL_ERROR "--> Could not locate required GLUT files, disabling samples build - Please check ${GLUT_SEARCH_PATH}") |
| 100 | +endif() |
| 101 | + |
| 102 | +if (NOT EMBREE_FOUND) |
| 103 | + MESSAGE(FATAL_ERROR "--> Could not locate required Intel Embree files - Please check ${EMBREE_SEARCH_PATH}") |
| 104 | +endif() |
| 105 | + |
| 106 | +################################################################################ |
| 107 | +# |
| 108 | +# Build options |
| 109 | +# |
| 110 | +################################################################################ |
| 111 | + |
| 112 | +if (LUXRAYS_DISABLE_OPENCL) |
| 113 | + ADD_DEFINITIONS("-DLUXRAYS_DISABLE_OPENCL") |
| 114 | +endif() |
| 115 | + |
| 116 | +if (LUXCORE_DISABLE_EMBREE_BVH_BUILDER) |
| 117 | + ADD_DEFINITIONS("-DLUXCORE_DISABLE_EMBREE_BVH_BUILDER") |
| 118 | +endif() |
| 119 | + |
| 120 | +################################################################################ |
| 121 | +# |
| 122 | +# LuxRays, SLG and LuxCore libraries |
| 123 | +# |
| 124 | +################################################################################ |
| 125 | + |
| 126 | +add_subdirectory(src/luxrays) |
| 127 | +add_subdirectory(src/slg) |
| 128 | +add_subdirectory(src/luxcore) |
| 129 | + |
| 130 | + |
| 131 | +################################################################################ |
| 132 | +# |
| 133 | +# Samples |
| 134 | +# |
| 135 | +################################################################################ |
| 136 | + |
| 137 | +if(NOT APPLE OR OSX_BUILD_DEMOS) |
| 138 | + add_subdirectory(samples/benchsimple) |
| 139 | + add_subdirectory(samples/luxcoredemo) |
| 140 | + add_subdirectory(samples/luxcorescenedemo) |
| 141 | + add_subdirectory(samples/luxcoreimplserializationdemo) |
| 142 | +endif() |
| 143 | + |
| 144 | +if(OPENGL_FOUND AND GLUT_FOUND AND GLEW_FOUND) |
| 145 | + add_subdirectory(samples/smallluxgpu4) |
| 146 | +endif(OPENGL_FOUND AND GLUT_FOUND AND GLEW_FOUND) |
| 147 | + |
| 148 | +add_subdirectory(samples/luxcoreconsole) |
| 149 | + |
| 150 | +if(OPENGL_FOUND) |
| 151 | + add_subdirectory(samples/luxcoreui) |
| 152 | + # APPLE bundle is not prepared yet, windows buildbot exhibits problems, so disable for now |
| 153 | + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
| 154 | + add_subdirectory(ui/luxrender2) |
| 155 | + endif() |
| 156 | +endif(OPENGL_FOUND) |
| 157 | + |
| 158 | + |
| 159 | +################################################################################ |
| 160 | +# |
| 161 | +# For non win32 we'll have to copy everything to a single dir |
| 162 | +# |
| 163 | +################################################################################ |
| 164 | + |
| 165 | +INCLUDE(AssembleBinDirs) |
0 commit comments