forked from STEllAR-GROUP/hpx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
1862 lines (1559 loc) · 71.7 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
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2007-2012 Hartmut Kaiser
# Copyright (c) 2011-2013 Thomas Heller
# Copyright (c) 2007-2008 Chirag Dekate
# Copyright (c) 2011 Bryce Lelbach
# Copyright (c) 2011 Vinay C Amatya
# Copyright (c) 2013 Jeroen Habraken
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# We require at least CMake V2.8.4
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
# Overrides must go before the project() statement, otherwise they are ignored.
################################################################################
# C++ overrides
################################################################################
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
"${CMAKE_SOURCE_DIR}/cmake/HPX_CXXOverrides.cmake")
################################################################################
# Fortran overrides
################################################################################
set(CMAKE_USER_MAKE_RULES_OVERRIDE_Fortran
"${CMAKE_SOURCE_DIR}/cmake/HPX_FortranOverrides.cmake")
################################################################################
# Build type (needs to be handled before project command below)
################################################################################
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Configuration type (one of Debug, RelWithDebInfo, Release, MinSizeRel)" FORCE)
endif()
set(HPX_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Configuration type (one of Debug, RelWithDebInfo, Release, MinSizeRel)" FORCE)
# Always force CMAKE_CONFIGURATION_TYPES to be the same as CMAKE_BUILD_TYPE
# (at least for now, until we figure out how to use multiple build types in
# the same project).
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}" CACHE INTERNAL "Configuration types" FORCE)
################################################################################
# project metadata
################################################################################
project(hpx CXX C)
set(HPX_MAJOR_VERSION 1)
set(HPX_MINOR_VERSION 0)
set(HPX_PATCH_LEVEL 0)
set(HPX_VERSION "${HPX_MAJOR_VERSION}.${HPX_MINOR_VERSION}.${HPX_PATCH_LEVEL}")
set(HPX_SOVERSION ${HPX_MAJOR_VERSION})
if(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
################################################################################
# CMake configuration
################################################################################
set(HPX_INTERNAL_CMAKE ON)
set(CMAKE_MODULE_PATH ${hpx_SOURCE_DIR}/cmake)
# include additional macro definitions
include(HPX_Utils)
include(HPX_Distclean)
set(HPX_DEFINITIONS CACHE INTERNAL "" FORCE)
set(HPX_CONFIG_DEFINITIONS CACHE INTERNAL "" FORCE)
hpx_force_out_of_tree_build("This project requires an out-of-source-tree build. See README.rst. Clean your CMake cache and CMakeFiles if this message persists.")
if(NOT HPX_CMAKE_LOGLEVEL)
set(HPX_CMAKE_LOGLEVEL "WARN")
endif()
###############################################################################
# reconfigure Boost library information if configuration type has been
# changed since last configure
if(CMAKE_BUILD_TYPE AND NOT (CMAKE_BUILD_TYPE STREQUAL CMAKE_CONFIGURATION_TYPES))
set(BOOST_VERSION_SEARCHED OFF CACHE INTERNAL "Found Boost version" FORCE)
set(BOOST_SEARCHED OFF CACHE INTERNAL "Found Boost libraries" FORCE)
endif()
################################################################################
# Fortran compiler detection
################################################################################
include(HPX_FortranCompiler)
################################################################################
# Boost configuration
################################################################################
# Boost.Chrono is in newer versions of Boost
hpx_option(HPX_INTERNAL_CHRONO BOOL "Use HPX's internal version of Boost.Chrono (default: OFF)" OFF ADVANCED)
# Boost.Move is in newer versions of Boost
hpx_option(HPX_INTERNAL_MOVE BOOL "Use HPX's internal version of Boost.Move (default: OFF)" OFF ADVANCED)
# This cmake module will snag the Boost version we'll be using (which we need
# to know to specify the Boost libraries that we want to look for)
find_package(HPX_BoostVersion)
if(NOT BOOST_VERSION_FOUND)
hpx_error("boost" "Failed to locate Boost.")
endif()
if(NOT MSVC AND ${BOOST_MINOR_VERSION} LESS 47)
hpx_warn("boost" "Applications will segfault at shutdown with this version of Boost, please use 1.47.0 or higher.")
endif()
###############################################################################
# Boost libraries which are always used from the installed version
set(BOOST_LIBRARIES date_time
filesystem
program_options
regex
serialization
system
thread)
# Decide whether to use internal version of Boost.Chrono
if(${BOOST_MINOR_VERSION} LESS 47)
hpx_warn("boost" "Using internal version of Boost.Chrono, setting HPX_INTERNAL_CHRONO=ON.")
set(HPX_INTERNAL_CHRONO ON CACHE BOOL "Use HPX's internal version of Boost.Chrono (default: OFF)" FORCE)
endif()
# Decide whether to use internal version of Boost.Move
if(${BOOST_MINOR_VERSION} LESS 48)
hpx_warn("boost" "Using internal version of Boost.Move, setting HPX_INTERNAL_MOVE=ON.")
set(HPX_INTERNAL_MOVE ON CACHE BOOL "Use HPX's internal version of Boost.Move (default: OFF)" FORCE)
endif()
# Decide whether to use Boost.Context for coroutine implementation
if(${BOOST_MINOR_VERSION} GREATER 50)
if (APPLE)
hpx_option(HPX_USE_GENERIC_COROUTINE_CONTEXT BOOL "Use Boost.Context as the underlying coroutines context switch implementation (default: ON)." ON ADVANCED)
else()
hpx_option(HPX_USE_GENERIC_COROUTINE_CONTEXT BOOL "Use Boost.Context as the underlying coroutines context switch implementation (default: OFF)." OFF ADVANCED)
endif()
endif()
################################################################################
# search path configuration
################################################################################
hpx_include_directories(${hpx_SOURCE_DIR})
hpx_include_directories(${CMAKE_BINARY_DIR})
if(HPX_INTERNAL_MOVE)
hpx_add_config_define(HPX_INTERNAL_MOVE)
hpx_include_directories(${hpx_SOURCE_DIR}/external/move)
endif()
if(${BOOST_MINOR_VERSION} LESS 53)
hpx_include_directories(${hpx_SOURCE_DIR}/external/atomic)
else()
set(BOOST_LIBRARIES ${BOOST_LIBRARIES} atomic)
endif()
if(HPX_INTERNAL_CHRONO)
hpx_add_config_define(HPX_INTERNAL_CHRONO)
hpx_add_config_define(BOOST_CHRONO_NO_LIB)
hpx_include_directories(${hpx_SOURCE_DIR}/external/chrono)
else()
set(BOOST_LIBRARIES ${BOOST_LIBRARIES} chrono)
endif()
if(HPX_USE_GENERIC_COROUTINE_CONTEXT)
if(${BOOST_MINOR_VERSION} GREATER 50)
hpx_add_config_define(HPX_HAVE_GENERIC_CONTEXT_COROUTINES)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES} context)
else()
hpx_error("boost_version" "Boost V1.51.0 or higher is required to use the Boost.Context library.")
endif()
endif()
if(${BOOST_MINOR_VERSION} LESS 53)
hpx_include_directories(${hpx_SOURCE_DIR}/external/lockfree)
endif()
hpx_include_directories(${hpx_SOURCE_DIR}/external/cache)
hpx_include_directories(${hpx_SOURCE_DIR}/external/endian)
if(${BOOST_MINOR_VERSION} LESS 49)
hpx_include_directories(${hpx_SOURCE_DIR}/external/serialization)
endif()
# If we compile natively for the MIC, we need some workarounds for certain
# boost headers
# FIXME: push changes upstream
if(HPX_NATIVE_MIC)
hpx_include_directories(${hpx_SOURCE_DIR}/external/asio)
endif()
if(UNIX)
hpx_link_directories(${CMAKE_BINARY_DIR}/lib/hpx)
else()
hpx_link_directories(${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}/lib/hpx)
endif()
###############################################################################
# Configure option to automatically set all required settings to use the
# XeonPhi
###############################################################################
hpx_option(HPX_NATIVE_MIC BOOL
"Build HPX to run natively on the Intel MIC coprocessor (default: OFF)."
OFF ADVANCED)
if(HPX_NATIVE_MIC)
hpx_option(HPX_MAX_CPU_COUNT STRING
"HPX applications will not use more than this amount of OS-threads (default: 256)."
"256" ADVANCED)
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
hpx_error("HPX on the MIC can only be compiled with the Intel compiler.")
endif()
hpx_add_config_define(HPX_NATIVE_MIC)
else()
hpx_option(HPX_MAX_CPU_COUNT STRING
"HPX applications will not use more than this amount of OS-threads (default: 64)."
"64" ADVANCED)
endif()
###############################################################################
# Configure upper limit for number of threads, this is important for XeonPhi
###############################################################################
hpx_option(HPX_USE_MORE_THAN_64_THREADS BOOL
"HPX applications will use more than 64 OS-threads (default: OFF)." OFF ADVANCED)
if(HPX_USE_MORE_THAN_64_THREADS)
hpx_add_config_define(HPX_HAVE_MORE_THAN_64_THREADS)
elseif(HPX_MAX_CPU_COUNT)
hpx_add_config_define(HPX_MAX_CPU_COUNT ${HPX_MAX_CPU_COUNT})
endif()
###############################################################################
# We have a patched version of FindBoost loosely based on the one that Kitware ships
find_package(HPX_Boost)
hpx_include_sys_directories(${BOOST_INCLUDE_DIR})
hpx_link_sys_directories(${BOOST_LIBRARY_DIR})
if(NOT MSVC)
set(hpx_LIBRARIES ${BOOST_FOUND_LIBRARIES})
endif()
# Boost preprocessor definitions
hpx_add_config_define(BOOST_PARAMETER_MAX_ARITY 7)
hpx_add_config_define(HPX_COROUTINE_ARG_MAX 1)
if(NOT MSVC)
hpx_add_config_define(HPX_COROUTINE_NO_SEPARATE_CALL_SITES)
endif()
hpx_add_config_define(HPX_LOG_NO_TSS)
hpx_add_config_define(HPX_LOG_NO_TS)
hpx_add_config_define(BOOST_BIGINT_HAS_NATIVE_INT64)
# disable usage of std::atomics in lockfree
if(${BOOST_MINOR_VERSION} LESS 53)
hpx_add_config_define(BOOST_NO_0X_HDR_ATOMIC)
endif()
################################################################################
# Compiler detection code
################################################################################
# C++
hpx_include(GCCVersion)
if(GCC_VERSION AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
hpx_info("gcc_config" "Compiler reports compatibility with GCC version ${GCC_VERSION_STR}")
hpx_option(HPX_IGNORE_GCC_VERSION BOOL
"Ignore version reported by gcc (default: OFF)." OFF ADVANCED)
if(HPX_IGNORE_GCC_VERSION)
hpx_warn("gcc_config" "GCC 4.4.5 or higher is required. Building HPX will proceed but may fail.")
elseif(040405 GREATER ${GCC_VERSION})
hpx_error("gcc_config" "GCC 4.4.5 or higher is required. Specify HPX_IGNORE_GCC_VERSION=ON to overwrite this error.")
endif()
elseif(MSVC)
if(NOT (MSVC10 OR MSVC11 OR MSVC12))
hpx_error("msvc_config" "MSVC x64 2010 or higher is required.")
elseif(NOT CMAKE_CL_64)
hpx_warn("msvc_config" "MSVC (32Bit) will compile but will fail running larger applications because of limitations in the Windows OS.")
endif()
endif()
# Fortran
if(CMAKE_Fortran_COMPILER)
hpx_include(GFortranVersion)
if(GFORTRAN_VERSION)
hpx_info("gfortran_config" "Compiler reports compatibility with gfortran version ${GFORTRAN_VERSION_STR}")
endif()
endif()
hpx_include(CompilerFlags)
################################################################################
# Git commit detection
################################################################################
include(HPX_GitCommit)
hpx_add_config_define(HPX_GIT_COMMIT "\"${HPX_GIT_COMMIT}\"")
################################################################################
# Installation configuration
################################################################################
# FIXME: Three separate doc strings are used for the *_PREFIX macros.
hpx_option(HPX_DEFAULT_BUILD_TARGETS BOOL
"Associate the core HPX library with the default build target (default: ON)." ON ADVANCED)
hpx_option(HPX_NO_INSTALL BOOL
"Build hpx applications so that they can be run without installation (default: OFF)." OFF ADVANCED)
if(NOT HPX_NO_INSTALL)
# for backwards compatibility
if(CMAKE_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_PREFIX}")
endif()
if(NOT CMAKE_INSTALL_PREFIX)
if(UNIX)
set(CMAKE_INSTALL_PREFIX "/opt/hpx" CACHE PATH "Prefix prepended to install directories.")
else()
set(CMAKE_INSTALL_PREFIX "C:/Program Files/hpx" CACHE PATH "Prefix prepended to install directories.")
endif()
endif()
set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Where to install ${PROJECT_NAME} (default: /opt/hpx for POSIX, C:/Program Files/hpx for Windows)." FORCE)
hpx_info("install" "Install root is ${CMAKE_INSTALL_PREFIX}.")
endif()
################################################################################
# Decide whether to use shared memory based parcelport (starting with Boost V1.52)
################################################################################
if(${BOOST_MINOR_VERSION} GREATER 51)
hpx_option(HPX_HAVE_PARCELPORT_SHMEM BOOL "Enable parcelport based on shared memory (default: OFF)." OFF ADVANCED)
if(HPX_HAVE_PARCELPORT_SHMEM)
hpx_add_config_define(HPX_HAVE_PARCELPORT_SHMEM)
endif()
endif()
################################################################################
# Decide whether to use rdma based ibverbs parcelport
################################################################################
hpx_option(HPX_HAVE_PARCELPORT_IBVERBS BOOL "Enable parcelport based on rdma ibverbs operations (default: OFF)." OFF ADVANCED)
if(HPX_HAVE_PARCELPORT_IBVERBS)
find_package(HPX_Ibverbs)
find_package(HPX_Rdmacm)
if(IBVERBS_FOUND AND RDMACM_FOUND)
hpx_add_config_define(HPX_HAVE_PARCELPORT_IBVERBS)
endif()
endif()
################################################################################
# Decide whether to use MPI based parcelport
################################################################################
hpx_option(HPX_HAVE_PARCELPORT_MPI BOOL "Enable parcelport based on MPI (default: OFF)." OFF ADVANCED)
if(HPX_HAVE_PARCELPORT_MPI)
find_package(HPX_MPI)
if(MPI_FOUND OR MPI_CXX_FOUND)
foreach(language CXX C Fortran)
set(CMAKE_${language}_FLAGS_DEBUG
"${CMAKE_${language}_FLAGS_DEBUG} ${MPI_${language}_COMPILE_FLAGS}")
set(CMAKE_${language}_FLAGS_RELWITHDEBINFO
"${CMAKE_${language}_FLAGS_RELWITHDEBINFO} ${MPI_${language}_COMPILE_FLAGS}")
set(CMAKE_${language}_FLAGS_MINSIZEREL
"${CMAKE_${language}_FLAGS_MINSIZEREL} ${MPI_${language}_COMPILE_FLAGS}")
set(CMAKE_${language}_FLAGS_RELEASE
"${CMAKE_${language}_FLAGS_RELEASE} ${MPI_${language}_COMPILE_FLAGS}")
endforeach()
hpx_add_config_define(HPX_HAVE_PARCELPORT_MPI)
foreach(language CXX C)
if(MPI_${language}_COMPILE_FLAGS)
add_definitions(${MPI_${language}_COMPILE_FLAGS})
endif()
if(MPI_${language}_INCLUDE_PATH)
hpx_include_sys_directories(${MPI_${language}_INCLUDE_PATH})
endif()
if(MPI_${language}_LIBRARIES)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${MPI_${language}_LIBRARIES})
set(hpx_LIBRARIES ${hpx_LIBRARIES} ${MPI_${language}_LIBRARIES})
endif()
endforeach()
if(MPI_LIBRARY)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${MPI_LIBRARY})
set(hpx_LIBRARIES ${hpx_LIBRARIES} ${MPI_LIBRARY})
endif()
if(MPI_EXTRA_LIBRARY)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${MPI_EXTRA_LIBRARY})
set(hpx_LIBRARIES ${hpx_LIBRARIES} ${MPI_EXTRA_LIBRARY})
endif()
# This list is to detect if we run inside an mpi environment
# if one of those environment variables is set, the MPI parcelport
# is enabled by default
# PMI_RANK: Intel MPI and MVAPICH2
# OMPI_COMM_WORLD_SIZE: OpenMPI starting at version 1.3
hpx_option(HPX_PARCELPORT_MPI_ENV STRING
"List of environment variables checked to detect MPI (default: PMI_RANK;OMPI_COMM_WORLD_SIZE)."
"PMI_RANK;OMPI_COMM_WORLD_SIZE" ADVANCED)
if(HPX_PARCELPORT_MPI_ENV)
string(REPLACE ";" "," hpx_parcelport_mpi_env_ "${HPX_PARCELPORT_MPI_ENV}")
hpx_add_config_define(HPX_PARCELPORT_MPI_ENV "\"${hpx_parcelport_mpi_env_}\"")
endif()
else()
hpx_error("parcelport"
"HPX_HAVE_PARCELPORT_MPI is set but MPI could not be found."
"Please set MPI_CXX_COMPILER, MPI_C_COMPILER and"
"MPI_FORTRAN_COMPILER to the appropraite mpi compiler wrapper")
endif()
endif()
################################################################################
# Logging configuration
################################################################################
hpx_option(HPX_NO_LOGGING BOOL "Build hpx with logging completely disabled (default: OFF)." OFF ADVANCED)
if(HPX_NO_LOGGING)
hpx_add_config_define(HPX_NO_LOGGING 1)
endif()
################################################################################
# HPX_PREFIX
################################################################################
# If you want to run hpx applications without installing them, set this to
# ${CMAKE_BINARY_DIR} when using Makefiles or
# ${CMAKE_BINARY_DIR}/$(Configuration) when using Visual Studio
if(HPX_NO_INSTALL)
if(MSVC)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}" CACHE PATH "Prefix prepended to install directories." FORCE)
set(HPX_PREFIX "${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}" CACHE PATH "Where the hpx applications look for component dlls" FORCE)
else()
set(HPX_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Where the hpx applications look for component dlls" FORCE)
endif()
else()
set(HPX_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Where the hpx applications look for component dlls" FORCE)
endif()
hpx_add_config_define(HPX_PREFIX "\"${HPX_PREFIX}\"")
# Make sure the specified build type is valid.
if(NOT ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel" OR
"${CMAKE_BUILD_TYPE}" STREQUAL "Release"))
hpx_error("build_type" "\"${CMAKE_BUILD_TYPE}\" is not a valid build type, must be Debug, Release, RelWithDebInfo, or MinSizeRel.")
endif()
hpx_include(SetOutputPaths)
################################################################################
# RPATH configuration
################################################################################
if(NOT MSVC)
set(HPX_RPATH "${CMAKE_INSTALL_PREFIX}/lib/hpx:${CMAKE_BINARY_DIR}/lib/hpx"
CACHE STRING "Base RPATH for linking" FORCE)
endif()
################################################################################
# C++11 configuration
################################################################################
hpx_option(HPX_HAVE_CXX11 BOOL "Use C++11 support, if available (default: ON)" ON ADVANCED)
if(HPX_HAVE_CXX11)
hpx_add_config_define(HPX_HAVE_CXX11)
endif()
################################################################################
# Additional debug support
################################################################################
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
hpx_option(HPX_HAVE_VERIFY_LOCKS BOOL "Enable lock verification code (default: ON)" ON ADVANCED)
else()
hpx_option(HPX_HAVE_VERIFY_LOCKS BOOL "Enable lock verification code (default: OFF)" OFF ADVANCED)
endif()
if(HPX_HAVE_VERIFY_LOCKS)
hpx_add_config_define(HPX_HAVE_VERIFY_LOCKS 1)
else()
hpx_add_config_define(HPX_HAVE_VERIFY_LOCKS 0)
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
hpx_option(HPX_THREAD_DEBUG_INFO BOOL "Enable thread debugging information (default: ON)" ON ADVANCED)
else()
hpx_option(HPX_THREAD_DEBUG_INFO BOOL "Enable thread debugging information (default: OFF)" OFF ADVANCED)
endif()
if(NOT MSVC)
hpx_option(HPX_THREAD_GUARD_PAGE BOOL "Enable thread guard page (default: ON)" ON ADVANCED)
if(HPX_THREAD_GUARD_PAGE)
hpx_add_config_define(HPX_THREAD_GUARD_PAGE 1)
else()
hpx_add_config_define(HPX_THREAD_GUARD_PAGE 0)
endif()
endif()
if(NOT MSVC)
hpx_option(HPX_USE_MMAP BOOL "Use mmap for stack allocation (default: ON)" ON ADVANCED)
if(HPX_USE_MMAP)
hpx_add_config_define(HPX_USE_MMAP)
endif()
endif()
if(HPX_THREAD_DEBUG_INFO)
hpx_add_config_define(HPX_THREAD_MAINTAIN_PARENT_REFERENCE 1)
hpx_add_config_define(HPX_THREAD_MAINTAIN_PHASE_INFORMATION 1)
hpx_add_config_define(HPX_THREAD_MAINTAIN_DESCRIPTION 1)
else()
hpx_add_config_define(HPX_THREAD_MAINTAIN_PARENT_REFERENCE 0)
hpx_add_config_define(HPX_THREAD_MAINTAIN_PHASE_INFORMATION 0)
hpx_add_config_define(HPX_THREAD_MAINTAIN_DESCRIPTION 0)
endif()
hpx_option(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION BOOL "Enable thread stack back trace being captured on suspension (default: OFF)" OFF ADVANCED)
if(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION)
hpx_option(HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH STRING "Thread stack back trace depth being captured on suspension (default: 5)" "5" ADVANCED)
hpx_add_config_define(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION 1)
hpx_add_config_define(HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH ${HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH})
else()
hpx_add_config_define(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION 0)
endif()
hpx_option(HPX_THREAD_MAINTAIN_TARGET_ADDRESS BOOL "Enable storing target address in thread for NUMA awareness (default: OFF)" OFF ADVANCED)
if(HPX_THREAD_MAINTAIN_TARGET_ADDRESS)
hpx_add_config_define(HPX_THREAD_MAINTAIN_TARGET_ADDRESS 1)
else()
hpx_add_config_define(HPX_THREAD_MAINTAIN_TARGET_ADDRESS 0)
endif()
hpx_option(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME BOOL "Enable collecting queue wait times for threads (default: ON)" ON ADVANCED)
if(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME)
hpx_add_config_define(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME 1)
else()
hpx_add_config_define(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME 0)
endif()
################################################################################
# PAPI event counters
################################################################################
find_package(HPX_PAPI)
################################################################################
# Apex event counters
################################################################################
find_package(HPX_TAU)
find_package(HPX_APEX)
################################################################################
# hwloc (don't use it on MacOS as it make runs fail and is useless anyways.)
################################################################################
if(NOT APPLE)
find_package(HPX_Hwloc)
if(HWLOC_FOUND)
hpx_include_sys_directories(${HWLOC_INCLUDE_DIR})
hpx_link_sys_directories(${HWLOC_LIBRARY_DIR})
hpx_add_definitions(-DHPX_HAVE_HWLOC)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${HWLOC_LIBRARY})
endif()
elseif(HWLOC_FOUND)
unset(HWLOC_FOUND)
endif()
################################################################################
# Security, libsodium: P(ortable|ackageable) NaCl
################################################################################
find_package(HPX_Sodium)
if(SODIUM_FOUND)
hpx_option(HPX_HAVE_SECURITY BOOL "Enable enable security options (default: OFF)" OFF ADVANCED)
hpx_add_config_define(HPX_HAVE_SODIUM)
hpx_include_sys_directories(${SODIUM_INCLUDE_DIR})
hpx_link_sys_directories(${SODIUM_LIBRARY_DIR})
if(MSVC)
hpx_add_config_define(SODIUM_STATIC)
endif()
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${SODIUM_LIBRARY})
if(HPX_HAVE_SECURITY)
hpx_add_config_define(HPX_HAVE_SECURITY)
endif()
elseif(HPX_HAVE_SECURITY)
hpx_error("security" "The libsodium library has to be available to enable security features.")
set(HPX_HAVE_SECURITY OFF)
endif()
###############################################################################
# Configure compression and other plugins
###############################################################################
add_hpx_pseudo_target(plugins)
add_subdirectory(plugins)
if(HPX_HAVE_COMPRESSION_BZIP2 AND BZIP2_FOUND)
hpx_add_config_define(HPX_HAVE_COMPRESSION_BZIP2)
endif()
if(HPX_HAVE_COMPRESSION_SNAPPY AND SNAPPY_FOUND)
hpx_add_config_define(HPX_HAVE_COMPRESSION_SNAPPY)
endif()
if(HPX_HAVE_COMPRESSION_ZLIB AND ZLIB_FOUND)
hpx_add_config_define(HPX_HAVE_COMPRESSION_ZLIB)
endif()
# Parcel coalescing is used by the main HPX library, enable it always
hpx_add_config_define(HPX_HAVE_PARCEL_COALESCING)
################################################################################
# Documentation toolchain (DocBook, BoostBook, QuickBook, xsltproc)
################################################################################
hpx_include(Documentation)
################################################################################
# Creating the partially preprocessed header requires a recent version of Wave
################################################################################
hpx_include(Preprocessing)
################################################################################
# Warning configuration
################################################################################
hpx_option(HPX_WARNINGS BOOL "Enable compiler warnings (default: ON)" ON ADVANCED)
################################################################################
# Backtrace configuration
################################################################################
hpx_option(HPX_HAVE_STACKTRACES BOOL "Attach backtraces to HPX exceptions (default: ON)" ON ADVANCED)
if(HPX_HAVE_STACKTRACES OR HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION)
hpx_info("stacktraces" "Stack traces are enabled.")
hpx_add_config_define(HPX_HAVE_STACKTRACES)
endif()
################################################################################
# Emulation of SwapContext on Windows
################################################################################
if(MSVC)
hpx_option(HPX_HAVE_SWAP_CONTEXT_EMULATION BOOL "Emulate SwapContext API for coroutines (default: OFF)" OFF ADVANCED)
if(HPX_HAVE_SWAP_CONTEXT_EMULATION)
enable_language(ASM_MASM)
if(CMAKE_ASM_MASM_COMPILER)
hpx_info("swap_context" "SwitchToFiber emulation is enabled, using compiler: '${CMAKE_ASM_MASM_COMPILER}'")
else()
hpx_warn("swap_context" "SwitchToFiber emulation will be disabled, try setting the ASM_MASM environment variable to the assembler executable (ml.exe/ml64.exe)")
set(HPX_HAVE_SWAP_CONTEXT_EMULATION OFF CACHE BOOL "Emulate SwitchToFiber API for coroutines (default: OFF)" FORCE)
endif()
endif()
endif()
################################################################################
# Enable integration with Intel Amplifier and Inspector tools
################################################################################
hpx_option(HPX_HAVE_ITTNOTIFY BOOL "Bind to Intel Amplifier Tool (default: OFF)" OFF ADVANCED)
if(HPX_HAVE_ITTNOTIFY)
find_package(HPX_Amplifier)
if(AMPLIFIER_FOUND)
hpx_info("itt" "Binding to Intel Amplifier tool is enabled.")
hpx_add_config_define(HPX_HAVE_ITTNOTIFY 1)
hpx_include_sys_directories(${AMPLIFIER_INCLUDE_DIR})
hpx_link_sys_directories(${AMPLIFIER_LIBRARY_DIR})
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} ${AMPLIFIER_LIBRARY})
else()
set(HPX_HAVE_ITTNOTIFY OFF FORCE)
hpx_warn("itt" "Binding to Intel Amplifier tool will be disabled, try setting the AMPLIFIER_ROOT variable to the Intel Amplifier installation directory.")
endif()
endif()
################################################################################
# Native TLS configuration
################################################################################
if(APPLE)
hpx_option(HPX_HAVE_NATIVE_TLS BOOL "Use native TLS support if available (default: OFF)" OFF ADVANCED)
else()
hpx_option(HPX_HAVE_NATIVE_TLS BOOL "Use native TLS support if available (default: ON)" ON ADVANCED)
endif()
if(HPX_HAVE_NATIVE_TLS)
hpx_info("tls" "Native TLS is enabled.")
hpx_add_config_define(HPX_HAVE_NATIVE_TLS)
endif()
################################################################################
# Disable the use of partially preprocessed header files
################################################################################
hpx_option(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION BOOL "Do not use preprocessed headers (default: OFF)" OFF ADVANCED)
if(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
hpx_info("ppheaders" "Use of preprocessed headers is disabled.")
hpx_add_config_define(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
endif()
################################################################################
# Compiler configuration
################################################################################
# Clear CMake defaults
foreach(language CXX C Fortran)
set(CMAKE_${language}_FLAGS_DEBUG "" CACHE STRING "Debug flags (${language})" FORCE)
set(CMAKE_${language}_FLAGS_MINSIZEREL "" CACHE STRING "MinSizeRel flags (${language})" FORCE)
set(CMAKE_${language}_FLAGS_RELEASE "" CACHE STRING "Release flags (${language})" FORCE)
set(CMAKE_${language}_FLAGS_RELWITHDEBINFO "" CACHE STRING "RelWithDebInfo flags (${language})" FORCE)
endforeach()
if(HPX_NATIVE_MIC)
foreach(language CXX C Fortran)
set(CMAKE_${language}_FLAGS_DEBUG
"${CMAKE_${language}_FLAGS_DEBUG} -mmic")
set(CMAKE_${language}_FLAGS_RELWITHDEBINFO
"${CMAKE_${language}_FLAGS_RELWITHDEBINFO} -mmic")
set(CMAKE_${language}_FLAGS_MINSIZEREL
"${CMAKE_${language}_FLAGS_MINSIZEREL} -mmic")
set(CMAKE_${language}_FLAGS_RELEASE
"${CMAKE_${language}_FLAGS_RELEASE} -mmic")
endforeach()
hpx_add_definitions(-mmic)
endif()
if(MSVC)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
hpx_add_config_define(HPX_BUILD_TYPE debug)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
hpx_add_config_define(HPX_BUILD_TYPE relwithdebinfo)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
hpx_add_config_define(HPX_BUILD_TYPE minsizerel)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
hpx_add_config_define(HPX_BUILD_TYPE release)
endif()
foreach(language CXX C Fortran)
set(CMAKE_${language}_FLAGS_DEBUG
"${CMAKE_${language}_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_${language}_FLAGS_RELWITHDEBINFO
"${CMAKE_${language}_FLAGS_RELWITHDEBINFO} -DNDEBUG -DBOOST_DISABLE_ASSERTS")
set(CMAKE_${language}_FLAGS_MINSIZEREL
"${CMAKE_${language}_FLAGS_MINSIZEREL} -DNDEBUG -DBOOST_DISABLE ASSERTS")
set(CMAKE_${language}_FLAGS_RELEASE
"${CMAKE_${language}_FLAGS_RELEASE} -DNDEBUG -DBOOST_DISABLE_ASSERTS")
endforeach()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG -DBOOST_DISABLE_ASSERTS")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DNDEBUG -DBOOST_DISABLE_ASSERTS")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -DBOOST_DISABLE_ASSERTS")
else()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
hpx_add_definitions(-DDEBUG)
hpx_add_config_define(HPX_BUILD_TYPE debug)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
hpx_add_definitions(-DNDEBUG)
hpx_add_definitions(-DBOOST_DISABLE_ASSERTS)
hpx_add_config_define(HPX_BUILD_TYPE relwithdebinfo)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel")
hpx_add_definitions(-DNDEBUG)
hpx_add_definitions(-DBOOST_DISABLE_ASSERTS)
hpx_add_config_define(HPX_BUILD_TYPE minsizerel)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
hpx_add_definitions(-DNDEBUG)
hpx_add_definitions(-DBOOST_DISABLE_ASSERTS)
hpx_add_config_define(HPX_BUILD_TYPE release)
endif()
endif()
# Debug library postfix
set(CMAKE_DEBUG_POSTFIX "d")
set(HPX_DEBUG_POSTFIX "d")
################################################################################
# Utility configuration
################################################################################
hpx_option(HPX_UTIL_BIND BOOL "Use hpx::util::bind instead of boost::bind or std::bind (default: ON)" ON ADVANCED)
if(HPX_UTIL_BIND)
hpx_add_config_define(HPX_UTIL_BIND)
endif()
hpx_option(HPX_UTIL_FUNCTION BOOL "Use hpx::util::function instead of boost::function or std::function (default: ON)" ON ADVANCED)
if(HPX_UTIL_FUNCTION)
hpx_add_config_define(HPX_UTIL_FUNCTION)
endif()
hpx_option(HPX_UTIL_TUPLE BOOL "Use hpx::util::tuple instead of boost::tuple or std::tuple (default: ON)" ON ADVANCED)
if(HPX_UTIL_TUPLE)
hpx_add_config_define(HPX_UTIL_TUPLE)
endif()
################################################################################
# Scheduler configuration
################################################################################
hpx_option(HPX_GLOBAL_SCHEDULER BOOL "Enable the use of --queueing=global (default: OFF)" OFF ADVANCED)
if(HPX_GLOBAL_SCHEDULER)
hpx_add_config_define(HPX_GLOBAL_SCHEDULER)
endif()
hpx_option(HPX_LOCAL_SCHEDULER BOOL "Enable the use of --queueing=local (default: OFF)" OFF ADVANCED)
if(HPX_LOCAL_SCHEDULER)
hpx_add_config_define(HPX_LOCAL_SCHEDULER)
endif()
hpx_option(HPX_STATIC_PRIORITY_SCHEDULER BOOL "Enable the use of --queueing=static (default: On)" On ADVANCED)
if(HPX_STATIC_PRIORITY_SCHEDULER)
hpx_add_config_define(HPX_STATIC_PRIORITY_SCHEDULER)
endif()
hpx_option(HPX_ABP_SCHEDULER BOOL "Enable the use of --queueing=abp (default: OFF)" OFF ADVANCED)
if(HPX_ABP_SCHEDULER)
hpx_add_config_define(HPX_ABP_SCHEDULER)
endif()
hpx_option(HPX_ABP_PRIORITY_SCHEDULER BOOL "Enable the use of --queueing=priority_abp (default: OFF)" OFF ADVANCED)
if(HPX_ABP_PRIORITY_SCHEDULER)
hpx_add_config_define(HPX_ABP_PRIORITY_SCHEDULER)
endif()
hpx_option(HPX_HIERARCHY_SCHEDULER BOOL "Enable the use of --queueing=hierarchy (default: OFF)" OFF ADVANCED)
if(HPX_HIERARCHY_SCHEDULER)
hpx_add_config_define(HPX_HIERARCHY_SCHEDULER)
endif()
hpx_option(HPX_PERIODIC_PRIORITY_SCHEDULER BOOL "Enable the use of --queueing=periodic (default: OFF)" OFF ADVANCED)
if(HPX_PERIODIC_PRIORITY_SCHEDULER)
hpx_add_config_define(HPX_PERIODIC_PRIORITY_SCHEDULER)
endif()
hpx_option(HPX_GOOGLE_PERFTOOLS BOOL
"Compile HPX with google perftools (Default: ON)" ON ADVANCED)
if(HPX_GOOGLE_PERFTOOLS)
find_package(HPX_GooglePerftools)
if(GOOGLE_PERFTOOLS_FOUND)
set(hpx_LIBRARIES ${hpx_LIBRARIES} ${GOOGLE_PERFTOOLS_LIBRARY})
hpx_include_sys_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
hpx_link_sys_directories(${GOOGLE_PERFTOOLS_LIBRARY_DIR})
hpx_add_config_define(HPX_GOOGLE_PERFTOOLS)
endif()
endif()
# On Linux, the system allocator has a bad performance for multi-threaded applications. We thus use tcmalloc by default.
# If tcmalloc is not present, this will fail. It is intentional that overriding this default requires an explicit
# "-DHPX_MALLOC=system"
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
if(HPX_NATIVE_MIC)
set(HPX_MALLOC_DEFAULT "tbbmalloc")
else()
set(HPX_MALLOC_DEFAULT "TCMalloc")
endif()
else()
set(HPX_MALLOC_DEFAULT "system")
endif()
set(hpx_MALLOC_LIBRARY "")
hpx_include(SetAllocator)
################################################################################
# MSVC configuration
################################################################################
if(MSVC)
foreach(language CXX C Fortran)
set(CMAKE_${language}_FLAGS_DEBUG
"${CMAKE_${language}_FLAGS_DEBUG} -D_DEBUG -Od -Zi -MDd")
set(CMAKE_${language}_FLAGS_RELWITHDEBINFO
"${CMAKE_${language}_FLAGS_RELWITHDEBINFO} -O2 -Zi -MD")
set(CMAKE_${language}_FLAGS_MINSIZEREL
"${CMAKE_${language}_FLAGS_MINSIZEREL} -O1 -MD")
set(CMAKE_${language}_FLAGS_RELEASE
"${CMAKE_${language}_FLAGS_RELEASE} -Ox -MD -GL")
endforeach()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -RTC1")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -RTC1")
# VS2012 and above has a special flag for improving the debug experience by
# adding more symbol information to the build
if(NOT MSVC10)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -d2Zi+")
endif()
# VS2013 and above know how to do link time constant data segment folding
if(MSVC12)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Gw")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Gw")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Gw")
endif()
# Exceptions
hpx_append_flag(-EHsc)
# Runtime type information
hpx_append_flag(-GR)
# Multiprocessor build
hpx_append_flag(-MP LANGUAGES CXX C Fortran)
# Increase the maximum size of object file sections
hpx_append_flag(-bigobj LANGUAGES CXX C Fortran)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} psapi shlwapi)
##############################################################################
# Stacktraces
##############################################################################
if(HPX_HAVE_STACKTRACES)
set(hpx_RUNTIME_LIBRARIES ${hpx_RUNTIME_LIBRARIES} dbghelp)
endif()
##############################################################################
# C++11
##############################################################################
if(HPX_HAVE_CXX11)
# C++11 support
hpx_option(HPX_HAVE_CXX11_RVALUE_REFERENCES BOOL "Compiler supports C++11 rvalue references (default: ON)." ON ADVANCED)
if(HPX_HAVE_CXX11_RVALUE_REFERENCES)
hpx_add_config_define(HPX_HAVE_CXX11_RVALUE_REFERENCES)
endif()
hpx_option(HPX_HAVE_CXX11_LAMBDAS BOOL "Compiler supports C++11 lambda functions (default: ON)." ON ADVANCED)
if(HPX_HAVE_CXX11_LAMBDAS)
hpx_add_config_define(HPX_HAVE_CXX11_LAMBDAS)
endif()
hpx_option(HPX_HAVE_CXX11_AUTO BOOL "Compiler supports C++11 auto keyword (default: ON)." ON ADVANCED)
if(HPX_HAVE_CXX11_AUTO)
hpx_add_config_define(HPX_HAVE_CXX11_AUTO)
endif()
hpx_option(HPX_HAVE_CXX11_DECLTYPE BOOL "Compiler supports C++11 decltype keyword (default: ON)." ON ADVANCED)
if(HPX_HAVE_CXX11_DECLTYPE)
hpx_add_config_define(HPX_HAVE_CXX11_DECLTYPE)
hpx_add_config_define(BOOST_RESULT_OF_USE_DECLTYPE)
endif()
if(MSVC12)
hpx_option(HPX_HAVE_CXX11_ALIAS_TEMPLATES BOOL "Compiler supports C++11 alias templates (default: ON)." ON ADVANCED)
else()
hpx_option(HPX_HAVE_CXX11_ALIAS_TEMPLATES BOOL "Compiler supports C++11 alias templates (default: OFF)." OFF ADVANCED)
endif()
if(HPX_HAVE_CXX11_ALIAS_TEMPLATES)
hpx_add_config_define(HPX_HAVE_CXX11_ALIAS_TEMPLATES)
endif()
hpx_option(HPX_HAVE_CXX11_DEFAULTED_DELETED_FUNCTIONS BOOL "Compiler supports C++11 defaulted/deleted functions (default: OFF)." OFF ADVANCED)
if(HPX_HAVE_CXX11_DEFAULTED_DELETED_FUNCTIONS)
hpx_add_config_define(HPX_HAVE_CXX11_DEFAULTED_DELETED_FUNCTIONS)
endif()
if(MSVC12)
hpx_option(HPX_HAVE_CXX11_VARIADIC_TEMPLATES BOOL "Compiler supports C++11 variadic templates (default: ON)." ON ADVANCED)
else()
hpx_option(HPX_HAVE_CXX11_VARIADIC_TEMPLATES BOOL "Compiler supports C++11 variadic templates (default: OFF)." OFF ADVANCED)
endif()
if(HPX_HAVE_CXX11_VARIADIC_TEMPLATES)
hpx_add_config_define(HPX_HAVE_CXX11_VARIADIC_TEMPLATES)
endif()
hpx_option(HPX_HAVE_CXX11_UNIQUE_PTR BOOL "Compiler supports C++11 std::unique_ptr (default: ON)." ON ADVANCED)
if(HPX_HAVE_CXX11_UNIQUE_PTR)
hpx_add_config_define(HPX_HAVE_CXX11_STD_UNIQUE_PTR)
hpx_add_config_define(BOOST_LOCKFREE_HAVE_CXX11_UNIQUE_PTR)
endif()
hpx_option(HPX_HAVE_CXX11_STD_TUPLE BOOL "Compiler supports C++11 (movable) std::tuple (default: ON)." ON ADVANCED)
if(NOT HPX_UTIL_TUPLE AND HPX_HAVE_CXX11_STD_TUPLE)
hpx_add_config_define(HPX_HAVE_CXX11_STD_TUPLE)
else()
set(HPX_HAVE_CXX11_STD_TUPLE OFF CACHE BOOL "Compiler supports C++11 (movable) std::tuple." FORCE)
hpx_info("C++11" "HPX_UTIL_TUPLE is enabled: even while std::tuple is available it will not be used.")
endif()
hpx_option(HPX_HAVE_CXX11_STD_BIND BOOL "Compiler supports C++11 (movable) std::bind (default: OFF)." OFF ADVANCED)
if(NOT HPX_UTIL_BIND)
hpx_add_config_define(HPX_HAVE_CXX11_STD_BIND)
else()
set(HPX_HAVE_CXX11_STD_BIND OFF CACHE BOOL "Compiler supports C++11 (movable) std::bind." FORCE)
hpx_info("C++11" "HPX_UTIL_BIND is enabled: even while std::bind is available it will not be used.")
endif()
hpx_option(HPX_HAVE_CXX11_STD_FUNCTION BOOL "Compiler supports C++11 (movable) std::function (default: OFF)." OFF ADVANCED)
if(NOT HPX_UTIL_FUNCTION AND HPX_HAVE_CXX11_STD_FUNCTION)
hpx_add_config_define(HPX_HAVE_CXX11_STD_FUNCTION)
else()
set(HPX_HAVE_CXX11_STD_FUNCTION OFF CACHE BOOL "Compiler supports C++11 (movable) std::function." FORCE)
hpx_info("C++11" "HPX_UTIL_FUNCTION is enabled: even while std::function is available it will not be used.")
endif()
if(MSVC12)
hpx_option(HPX_HAVE_CXX11_STD_INITIALIZER_LIST BOOL "Compiler supports C++11 std::initializer_list (default: ON)." ON ADVANCED)
else()
hpx_option(HPX_HAVE_CXX11_STD_INITIALIZER_LIST BOOL "Compiler supports C++11 std::initializer_list (default: OFF)." OFF ADVANCED)
endif()
if(HPX_HAVE_CXX11_STD_INITIALIZER_LIST)
hpx_add_config_define(HPX_HAVE_CXX11_STD_INITIALIZER_LIST)
endif()
endif()
##############################################################################
# Diagnostics