forked from mmp/pbrt-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
577 lines (490 loc) · 15.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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# TODO: many of the best practices described here
# (https://www.slideshare.net/DanielPfeifer1/cmake-48475415) are violated
# in this file. Would be nice to address some of these.
CMAKE_MINIMUM_REQUIRED ( VERSION 3.1.0 )
# For sanitizers
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
PROJECT ( PBRT-V3 )
OPTION(PBRT_FLOAT_AS_DOUBLE "Use 64-bit floats" OFF)
IF (PBRT_FLOAT_AS_DOUBLE)
ADD_DEFINITIONS ( -D PBRT_FLOAT_AS_DOUBLE )
ENDIF()
OPTION(PBRT_SAMPLED_SPECTRUM "Use SampledSpectrum rather than RGBSpectrum" OFF)
IF (PBRT_SAMPLED_SPECTRUM)
ADD_DEFINITIONS ( -D PBRT_SAMPLED_SPECTRUM )
ENDIF()
ENABLE_TESTING()
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/ext/openexr/OpenEXR")
message(FATAL_ERROR "The OpenEXR submodule directory is missing! "
"You probably did not clone the project with --recursive. It is possible to recover "
"by running \"git submodule update --init --recursive\"")
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/ext/glog/cmake")
message(FATAL_ERROR "The glog submodule directory is missing! "
"You probably did not clone the project with --recursive, or you first checked out "
"pbrt before it was added. It is possible to recover by running "
"\"git submodule update --init --recursive\"")
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/ext/ptex/src")
message(FATAL_ERROR "The ptex submodule directory is missing! "
"You probably did not clone the project with --recursive, or you first checked out "
"pbrt before it was added. It is possible to recover by running "
"\"git submodule update --init --recursive\"")
endif()
if(NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/ext/zlib/doc")
message(FATAL_ERROR "The zlib submodule directory is missing! "
"You probably did not clone the project with --recursive, or you first checked out "
"pbrt before it was added. It is possible to recover by running "
"\"git submodule update --init --recursive\"")
endif()
FIND_PACKAGE ( Sanitizers )
FIND_PACKAGE ( Threads )
IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
ADD_DEFINITIONS (-DNDEBUG)
ENDIF()
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
###########################################################################
# Annoying compiler-specific details
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-conversion-null")
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-register")
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
FIND_PROGRAM(XIAR xiar)
IF(XIAR)
SET(CMAKE_AR "${XIAR}")
ENDIF(XIAR)
MARK_AS_ADVANCED(XIAR)
FIND_PROGRAM(XILD xild)
IF(XILD)
SET(CMAKE_LINKER "${XILD}")
ENDIF(XILD)
MARK_AS_ADVANCED(XILD)
# ICC will default to -fp-model fast=1, which performs value-unsafe optimizations which will
# cause pbrt_test to fail. For safety, -fp-model precise is explicitly set here by default.
set(FP_MODEL "precise" CACHE STRING "The floating point model to compile with.")
set_property(CACHE FP_MODEL PROPERTY STRINGS "precise" "fast=1" "fast=2")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp-model ${FP_MODEL}")
ENDIF()
IF(MSVC)
ADD_DEFINITIONS (/D _CRT_SECURE_NO_WARNINGS)
ENDIF()
INCLUDE (CheckIncludeFiles)
CHECK_INCLUDE_FILES ( alloca.h HAVE_ALLOCA_H )
IF ( HAVE_ALLOCA_H )
ADD_DEFINITIONS ( -D PBRT_HAVE_ALLOCA_H )
ENDIF ()
CHECK_INCLUDE_FILES ( memory.h HAVE_MEMORY_H )
IF ( HAVE_MEMORY_H )
ADD_DEFINITIONS ( -D PBRT_HAVE_MEMORY_H )
ENDIF ()
###########################################################################
# Check for various C++11 features and set preprocessor variables or
# define workarounds.
INCLUDE (CheckCXXSourceCompiles)
INCLUDE (CheckCXXSourceRuns)
CHECK_CXX_SOURCE_COMPILES (
"int main() { float x = 0x1p-32f; }"
HAVE_HEX_FP_CONSTANTS )
IF ( HAVE_HEX_FP_CONSTANTS )
ADD_DEFINITIONS ( -D PBRT_HAVE_HEX_FP_CONSTANTS )
ENDIF ()
CHECK_CXX_SOURCE_COMPILES (
"int main() { int x = 0b101011; }"
HAVE_BINARY_CONSTANTS )
IF ( HAVE_BINARY_CONSTANTS )
ADD_DEFINITIONS ( -D PBRT_HAVE_BINARY_CONSTANTS )
ENDIF ()
CHECK_CXX_SOURCE_COMPILES (
"int main() { constexpr int x = 0; }"
HAVE_CONSTEXPR )
IF ( HAVE_CONSTEXPR )
ADD_DEFINITIONS ( -D PBRT_HAVE_CONSTEXPR )
ADD_DEFINITIONS ( -D PBRT_CONSTEXPR=constexpr )
ELSE ()
ADD_DEFINITIONS ( -D PBRT_CONSTEXPR=const )
ENDIF ()
CHECK_CXX_SOURCE_COMPILES (
"struct alignas(32) Foo { char x; }; int main() { }"
HAVE_ALIGNAS )
IF ( HAVE_ALIGNAS )
ADD_DEFINITIONS ( -D PBRT_HAVE_ALIGNAS )
ENDIF ()
CHECK_CXX_SOURCE_COMPILES (
"int main() { int x = alignof(double); }"
HAVE_ALIGNOF )
IF ( HAVE_ALIGNOF )
ADD_DEFINITIONS ( -D PBRT_HAVE_ALIGNOF )
ENDIF ()
CHECK_CXX_SOURCE_RUNS ( "
#include <signal.h>
#include <string.h>
#include <sys/time.h>
void ReportProfileSample(int, siginfo_t *, void *) { }
int main() {
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = ReportProfileSample;
sa.sa_flags = SA_RESTART | SA_SIGINFO;
sigemptyset(&sa.sa_mask);
sigaction(SIGPROF, &sa, NULL);
static struct itimerval timer;
return setitimer(ITIMER_PROF, &timer, NULL) == 0 ? 0 : 1;
}
" HAVE_ITIMER )
IF ( HAVE_ITIMER )
ADD_DEFINITIONS ( -D PBRT_HAVE_ITIMER )
ENDIF()
CHECK_CXX_SOURCE_COMPILES ( "
class Bar { public: Bar() { x = 0; } float x; };
struct Foo { union { int x[10]; Bar b; }; Foo() : b() { } };
int main() { Foo f; }
" HAVE_NONPOD_IN_UNIONS )
IF ( HAVE_NONPOD_IN_UNIONS )
ADD_DEFINITIONS ( -D PBRT_HAVE_NONPOD_IN_UNIONS )
ENDIF ()
CHECK_CXX_SOURCE_COMPILES ( "
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
int main() {
int fd = open(\"foo\", O_RDONLY);
struct stat s;
fstat(fd, &s);
size_t len = s.st_size;
void *ptr = mmap(0, len, PROT_READ, MAP_FILE | MAP_SHARED, fd, 0);
munmap(ptr, len);
}
" HAVE_MMAP )
if ( HAVE_MMAP )
ADD_DEFINITIONS ( -D PBRT_HAVE_MMAP )
ENDIF ()
########################################
# noinline
CHECK_CXX_SOURCE_COMPILES (
"__declspec(noinline) void foo() { }
int main() { }"
HAVE_DECLSPEC_NOINLINE )
CHECK_CXX_SOURCE_COMPILES (
"__attribute__((noinline)) void foo() { }
int main() { }"
HAVE_ATTRIBUTE_NOINLINE )
IF ( HAVE_ATTRIBUTE_NOINLINE )
ADD_DEFINITIONS ( -D "PBRT_NOINLINE=__attribute__\\(\\(noinline\\)\\)" )
ELSEIF ( HAVE_DECLSPEC_NOINLINE )
ADD_DEFINITIONS ( -D "PBRT_NOINLINE=__declspec(noinline)" )
ELSE ()
ADD_DEFINITIONS ( -D PBRT_NOINLINE )
ENDIF ()
########################################
# Aligned memory allocation
CHECK_CXX_SOURCE_COMPILES ( "
#include <malloc.h>
int main() { void * ptr = _aligned_malloc(1024, 32); }
" HAVE__ALIGNED_MALLOC )
CHECK_CXX_SOURCE_COMPILES ( "
#include <stdlib.h>
int main() {
void *ptr;
posix_memalign(&ptr, 32, 1024);
} " HAVE_POSIX_MEMALIGN )
CHECK_CXX_SOURCE_COMPILES ( "
#include <malloc.h>
int main() {
void *ptr = memalign(32, 1024);
} " HAVE_MEMALIGN )
IF ( HAVE__ALIGNED_MALLOC )
ADD_DEFINITIONS ( -D PBRT_HAVE__ALIGNED_MALLOC )
ELSEIF ( HAVE_POSIX_MEMALIGN )
ADD_DEFINITIONS ( -D PBRT_HAVE_POSIX_MEMALIGN )
ELSEIF ( HAVE_MEMALIGN )
ADD_DEFINITIONS ( -D PBRTHAVE_MEMALIGN )
ELSE ()
MESSAGE ( SEND_ERROR "Unable to find a way to allocate aligned memory" )
ENDIF ()
########################################
# thread-local variables
CHECK_CXX_SOURCE_COMPILES ( "
#ifdef __CYGWIN__
// Hack to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697
#error \"No thread_local on cygwin\"
#endif // __CYGWIN__
thread_local int x; int main() { }
" HAVE_THREAD_LOCAL )
CHECK_CXX_SOURCE_COMPILES ( "
__declspec(thread) int x; int main() { }
" HAVE_DECLSPEC_THREAD )
CHECK_CXX_SOURCE_COMPILES ( "
__thread int x; int main() { }
" HAVE___THREAD )
IF ( HAVE_THREAD_LOCAL )
ADD_DEFINITIONS ( -D PBRT_THREAD_LOCAL=thread_local )
ELSEIF ( HAVE___THREAD )
ADD_DEFINITIONS ( -D PBRT_THREAD_LOCAL=__thread )
ELSEIF ( HAVE_DECLSPEC_THREAD )
ADD_DEFINITIONS ( -D "PBRT_THREAD_LOCAL=__declspec(thread)" )
ELSE ()
MESSAGE ( SEND_ERROR "Unable to find a way to declare a thread-local variable")
ENDIF ()
###########################################################################
# zlib
FIND_PACKAGE ( ZLIB )
IF(NOT ZLIB_FOUND)
# Build zlib
SET(ZLIB_BUILD_STATIC_LIBS ON CACHE BOOL " " FORCE)
SET(ZLIB_BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
ADD_SUBDIRECTORY(src/ext/zlib)
SET(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/ext/zlib")
SET(ZLIB_LIBRARY zlibstatic)
SET_PROPERTY(TARGET zlibstatic PROPERTY FOLDER "ext")
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/ext/zlib")
ENDIF()
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
###########################################################################
# OpenEXR
SET(ILMBASE_NAMESPACE_VERSIONING OFF CACHE BOOL " " FORCE)
SET(OPENEXR_NAMESPACE_VERSIONING OFF CACHE BOOL " " FORCE)
SET(OPENEXR_BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
SET(ILMBASE_BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
ADD_SUBDIRECTORY(src/ext/openexr)
SET_PROPERTY(TARGET IexMath eLut toFloat b44ExpLogTable dwaLookups IlmThread Half Iex Imath IlmImf PROPERTY FOLDER "ext")
INCLUDE_DIRECTORIES (
src/ext/openexr/IlmBase/Imath
src/ext/openexr/IlmBase/Half
src/ext/openexr/IlmBase/Iex
src/ext/openexr/OpenEXR/IlmImf
${CMAKE_BINARY_DIR}/src/ext/openexr/IlmBase/config
${CMAKE_BINARY_DIR}/src/ext/openexr/OpenEXR/config
)
IF(WIN32)
SET(OPENEXR_LIBS IlmImf Imath Half ${ZLIB_LIBRARY})
ELSE()
SET(OPENEXR_LIBS IlmImf Imath Half)
ENDIF()
###########################################################################
# glog
SET(WITH_GFLAGS OFF CACHE BOOL "Use gflags")
SET(BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
IF(WIN32)
ADD_DEFINITIONS( -D GOOGLE_GLOG_DLL_DECL= )
ENDIF()
ADD_SUBDIRECTORY(src/ext/glog)
SET_PROPERTY(TARGET glog logging_unittest demangle_unittest utilities_unittest stl_logging_unittest PROPERTY FOLDER "ext")
INCLUDE_DIRECTORIES (
src/ext/glog/src
${CMAKE_BINARY_DIR}/src/ext/glog
)
###########################################################################
# ptex
# work around https://github.com/wdas/ptex/issues/28
IF ( CMAKE_BUILD_TYPE )
STRING ( TOLOWER ${CMAKE_BUILD_TYPE} LOWER_BUILD_TYPE )
SET ( ENV{FLAVOR} ${LOWER_BUILD_TYPE} )
ENDIF ()
SET(PTEX_BUILD_SHARED_LIBS OFF CACHE BOOL " " FORCE)
SET(CMAKE_MACOSX_RPATH 1)
IF ( WIN32 )
ADD_DEFINITIONS ( /D PTEX_STATIC)
ENDIF ()
ADD_SUBDIRECTORY(src/ext/ptex)
SET_PROPERTY(TARGET Ptex_static ptxinfo halftest ftest rtest wtest PROPERTY FOLDER "ext")
INCLUDE_DIRECTORIES ( src/ext/ptex/src/ptex )
###########################################################################
# On to pbrt...
SET ( PBRT_CORE_SOURCE
src/core/api.cpp
src/core/bssrdf.cpp
src/core/camera.cpp
src/core/efloat.cpp
src/core/error.cpp
src/core/fileutil.cpp
src/core/film.cpp
src/core/filter.cpp
src/core/floatfile.cpp
src/core/geometry.cpp
src/core/imageio.cpp
src/core/integrator.cpp
src/core/interaction.cpp
src/core/interpolation.cpp
src/core/light.cpp
src/core/lightdistrib.cpp
src/core/lowdiscrepancy.cpp
src/core/material.cpp
src/core/medium.cpp
src/core/memory.cpp
src/core/microfacet.cpp
src/core/parallel.cpp
src/core/paramset.cpp
src/core/parser.cpp
src/core/primitive.cpp
src/core/progressreporter.cpp
src/core/quaternion.cpp
src/core/reflection.cpp
src/core/sampler.cpp
src/core/sampling.cpp
src/core/scene.cpp
src/core/shape.cpp
src/core/sobolmatrices.cpp
src/core/spectrum.cpp
src/core/stats.cpp
src/core/texture.cpp
src/core/transform.cpp
)
SET ( PBRT_CORE_HEADERS
src/core/api.h
src/core/bssrdf.h
src/core/camera.h
src/core/efloat.h
src/core/error.h
src/core/fileutil.h
src/core/film.h
src/core/filter.h
src/core/floatfile.h
src/core/geometry.h
src/core/imageio.h
src/core/integrator.h
src/core/interaction.h
src/core/interpolation.h
src/core/light.h
src/core/lowdiscrepancy.h
src/core/material.h
src/core/medium.h
src/core/memory.h
src/core/microfacet.h
src/core/mipmap.h
src/core/parallel.h
src/core/paramset.h
src/core/parser.h
src/core/pbrt.h
src/core/primitive.h
src/core/progressreporter.h
src/core/quaternion.h
src/core/reflection.h
src/core/rng.h
src/core/sampler.h
src/core/sampling.h
src/core/scene.h
src/core/shape.h
src/core/sobolmatrices.h
src/core/spectrum.h
src/core/stats.h
src/core/stringprint.h
src/core/texture.h
src/core/transform.h
)
FILE ( GLOB PBRT_SOURCE
src/ext/*
src/accelerators/*
src/cameras/*
src/filters/*
src/integrators/*
src/lights/*
src/materials/*
src/samplers/*
src/shapes/*
src/textures/*
src/media/*
)
INCLUDE_DIRECTORIES ( src )
INCLUDE_DIRECTORIES ( src/core )
# Visual Studio source folders
SOURCE_GROUP (core REGULAR_EXPRESSION src/core/.*)
SOURCE_GROUP (ext REGULAR_EXPRESSION src/ext/.*)
SOURCE_GROUP (accelerators REGULAR_EXPRESSION src/accelerators/.*)
SOURCE_GROUP (cameras REGULAR_EXPRESSION src/cameras/.*)
SOURCE_GROUP (filters REGULAR_EXPRESSION src/filters/.*)
SOURCE_GROUP (integrators REGULAR_EXPRESSION src/integrators/.*)
SOURCE_GROUP (lights REGULAR_EXPRESSION src/lights/.*)
SOURCE_GROUP (materials REGULAR_EXPRESSION src/materials/.*)
SOURCE_GROUP (samplers REGULAR_EXPRESSION src/samplers/.*)
SOURCE_GROUP (shapes REGULAR_EXPRESSION src/shapes/.*)
SOURCE_GROUP (textures REGULAR_EXPRESSION src/textures/.*)
SOURCE_GROUP (media REGULAR_EXPRESSION src/media/.*)
###########################################################################
# pbrt libraries and executables
ADD_LIBRARY ( pbrt STATIC
${PBRT_YACC_LEX_SOURCE}
${PBRT_CORE_SOURCE}
${PBRT_CORE_HEADERS}
${PBRT_SOURCE}
)
ADD_SANITIZERS ( pbrt )
# A non-exhaustive but pretty representative set..
# Note that we work-around shoddy c++11 support in MSVC2013
# (constexpr, etc.), so don't test for that stuff here
SET ( PBRT_CXX11_FEATURES
cxx_auto_type
cxx_explicit_conversions
cxx_lambdas
cxx_nullptr
cxx_range_for
cxx_static_assert
)
TARGET_COMPILE_FEATURES ( pbrt PRIVATE ${PBRT_CXX11_FEATURES} )
IF (WIN32)
# Avoid a name clash when building on Visual Studio
SET_TARGET_PROPERTIES ( pbrt PROPERTIES OUTPUT_NAME libpbrt )
ENDIF()
SET(ALL_PBRT_LIBS
pbrt
${CMAKE_THREAD_LIBS_INIT}
${OPENEXR_LIBS}
glog
Ptex_static
${ZLIB_LIBRARY}
)
# Main renderer
ADD_EXECUTABLE ( pbrt_exe src/main/pbrt.cpp )
ADD_SANITIZERS ( pbrt_exe )
SET_TARGET_PROPERTIES ( pbrt_exe PROPERTIES OUTPUT_NAME pbrt )
TARGET_COMPILE_FEATURES ( pbrt_exe PRIVATE ${PBRT_CXX11_FEATURES} )
TARGET_LINK_LIBRARIES ( pbrt_exe ${ALL_PBRT_LIBS} )
# Tools
ADD_EXECUTABLE ( bsdftest src/tools/bsdftest.cpp )
ADD_SANITIZERS ( bsdftest )
TARGET_COMPILE_FEATURES ( bsdftest PRIVATE ${PBRT_CXX11_FEATURES} )
TARGET_LINK_LIBRARIES ( bsdftest ${ALL_PBRT_LIBS} )
ADD_EXECUTABLE ( imgtool src/tools/imgtool.cpp )
ADD_SANITIZERS ( imgtool )
TARGET_COMPILE_FEATURES ( imgtool PRIVATE ${PBRT_CXX11_FEATURES} )
TARGET_LINK_LIBRARIES ( imgtool ${ALL_PBRT_LIBS} )
ADD_EXECUTABLE ( obj2pbrt src/tools/obj2pbrt.cpp )
TARGET_COMPILE_FEATURES ( obj2pbrt PRIVATE ${PBRT_CXX11_FEATURES} )
ADD_SANITIZERS ( obj2pbrt )
ADD_EXECUTABLE ( cyhair2pbrt src/tools/cyhair2pbrt.cpp )
ADD_SANITIZERS ( cyhair2pbrt )
# Unit test
FILE ( GLOB PBRT_TEST_SOURCE
src/tests/*.cpp
src/tests/gtest/*.cc
)
ADD_EXECUTABLE ( pbrt_test ${PBRT_TEST_SOURCE} )
ADD_SANITIZERS ( pbrt_test )
TARGET_COMPILE_FEATURES ( pbrt_test PRIVATE ${PBRT_CXX11_FEATURES} )
TARGET_LINK_LIBRARIES ( pbrt_test ${ALL_PBRT_LIBS} )
ADD_TEST ( pbrt_unit_test pbrt_test )
# Installation
INSTALL ( TARGETS
pbrt_exe
bsdftest
imgtool
obj2pbrt
cyhair2pbrt
DESTINATION
bin
)
INSTALL ( TARGETS
pbrt
DESTINATION
lib
)