forked from STEllAR-GROUP/hpx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
1461 lines (1231 loc) · 55.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
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-2014 Hartmut Kaiser
# Copyright (c) 2011-2014 Thomas Heller
# Copyright (c) 2007-2008 Chirag Dekate
# Copyright (c) 2011 Bryce Lelbach
# Copyright (c) 2011 Vinay C Amatya
# Copyright (c) 2013 Jeroen Habraken
# Copyright (c) 2014 Andreas Schäfer
#
# 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.10
cmake_minimum_required(VERSION 2.8.10 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)")
endif()
################################################################################
# project metadata
################################################################################
project(hpx CXX C)
set(HPX_MAJOR_VERSION 0)
set(HPX_MINOR_VERSION 9)
set(HPX_PATCH_LEVEL 10)
set(HPX_VERSION "${HPX_MAJOR_VERSION}.${HPX_MINOR_VERSION}.${HPX_PATCH_LEVEL}")
set(HPX_LIBRARY_VERSION "${HPX_VERSION}")
set(HPX_SOVERSION ${HPX_MAJOR_VERSION})
if(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()
################################################################################
# CMake configuration
################################################################################
set(CMAKE_MODULE_PATH "${hpx_SOURCE_DIR}/cmake")
# We safe the passed compiler flag to a special variable. This is needed for our
# build system unit tests. Some flags might influence the created symbols (
# _GLIBCXX_DEBUG i look at you)
set(CMAKE_CXX_FLAGS_SAFE ${CMAKE_CXX_FLAGS})
include(CheckCXXCompilerFlag)
include(CMakeDependentOption)
# include additional macro definitions
include(HPX_Utils)
include(HPX_ExportTargets)
include(HPX_Libraries)
include(HPX_AddConfigTest)
include(HPX_AddDefinitions)
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()
################################################################################
# Fortran compiler detection
#
include(HPX_FortranCompiler)
################################################################################
################################################################################
# Setup platform for which HPX should be compiled for.
#
include(HPX_SetPlatform)
if("${HPX_PLATFORM_UC}" STREQUAL "ANDROID")
unset(HPX_LIBRARY_VERSION)
unset(HPX_SOVERSION)
endif()
################################################################################
################################################################################
# Set our build options cache variables which are customizable by users
#
## Generic build options
set(DEFAULT_MALLOC "system")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(DEFAULT_MALLOC "tcmalloc")
# set(DEFAULT_MALLOC "jemalloc")
endif()
hpx_option(HPX_MALLOC
STRING
"Define which allocator should be linked in. Options are: system, tcmalloc, jemalloc and tbbmalloc (default is: tcmalloc)"
${DEFAULT_MALLOC} ADVANCED)
hpx_option(HPX_WITH_HWLOC
BOOL
"Use Hwloc for hardware topolgy information and thread pinning. If disabled, performance might be reduced."
ON ADVANCED)
hpx_option(HPX_WITH_SECURITY BOOL "Enable security support via libsodium." OFF)
# Logging configuration
hpx_option(HPX_WITH_LOGGING BOOL "Build HPX with logging enabled (default: ON)." ON ADVANCED)
if(NOT HPX_WITH_LOGGING)
hpx_add_config_define(HPX_NO_LOGGING)
endif()
## Compiler related build options
hpx_option(HPX_GCC_VERSION_CHECK BOOL "Ignore version reported by gcc (default: ON)" ON ADVANCED)
hpx_option(HPX_BUILD_DEFAULT_TARGETS BOOL
"Associate the core HPX library with the default build target (default: ON)." ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_COMPILER_WARNINGS BOOL "Enable compiler warnings (default: ON)" ON ADVANCED)
hpx_option(HPX_BUILD_DOCUMENTATION BOOL "Build the HPX documentation (default OFF)." OFF CATEGORY "Build Targets")
hpx_option(HPX_BUILD_DOCUMENTATION_SINGLEPAGE BOOL "The HPX documentation should be build as a single page HTML (default OFF)." OFF CATEGORY "Build Targets")
hpx_option(HPX_AUTOMATIC_PREPROCESSING BOOL "True if the automatic header preprocessing target should be created (default: OFF)." OFF ADVANCED)
hpx_option(HPX_WAVE_ADDITIONAL_INCLUDE_DIRS STRING "Additional (compiler specific) include directories for the wave preprocessing tool." "" CATEGORY "Generic" ADVANCED)
################################################################################
# Some platforms do not support dynamic linking. Enable this to link all
# libraries statically. This also changes some of the internals of HPX related
# to how components are loaded.
################################################################################
hpx_option(HPX_STATIC_LINKING BOOL
"Compile HPX statically linked libraries (Default: OFF)" OFF ADVANCED)
if(HPX_STATIC_LINKING)
hpx_add_config_define(HPX_STATIC_LINKING)
set(hpx_library_link_mode STATIC)
set(CMAKE_SHARED_LIBS OFF)
else()
set(hpx_library_link_mode SHARED)
endif()
################################################################################
hpx_option(HPX_BUILD_EXAMPLES BOOL "Build the HPX examples (default OFF)" ON CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TESTS BOOL "Build the HPX tests (default ON)" ON CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TESTS_BENCHMARKS BOOL "Build HPX benchmark tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TESTS_REGRESSIONS BOOL "Build HPX regression tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TESTS_UNIT BOOL "Build HPX unit tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TESTS_EXTERNAL_BUILD BOOL "Build external cmake build tests (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_BUILD_TOOLS BOOL "Build HPX tools (default: OFF)" OFF ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_BUILD_RUNTIME BOOL "Build HPX runtime (default: ON)" ON ADVANCED CATEGORY "Build Targets")
hpx_option(HPX_FULL_RPATH BOOL "Build and link HPX libraries and executables with full RPATHs (default: ON)" ON ADVANCED)
hpx_option(HPX_BUILD_WITH_INSTALL_PREFIX BOOL "Always set the HPX_PREFIX default to the install directory (default: OFF)" OFF ADVANCED)
################################################################################
# Native TLS configuration
################################################################################
set(HPX_NATIVE_TLS_DEFAULT ON)
if(APPLE)
set(HPX_NATIVE_TLS_DEFAULT OFF)
endif()
hpx_option(HPX_NATIVE_TLS BOOL "Use native TLS support if available (default: ON)" ${HPX_NATIVE_TLS_DEFAULT} ADVANCED)
if(HPX_NATIVE_TLS)
hpx_info("Native TLS is enabled.")
hpx_add_config_define(HPX_HAVE_NATIVE_TLS)
endif()
################################################################################
# Disable the use of partially preprocessed header files
################################################################################
hpx_option(HPX_PREPROCESSOR_LIMIT_EXPANSION BOOL "Do not use preprocessed headers (default: OFF)" OFF ADVANCED)
if(HPX_PREPROCESSOR_LIMIT_EXPANSION)
hpx_info("Use of preprocessed headers is disabled.")
hpx_add_config_define(HPX_USE_PREPROCESSOR_LIMIT_EXPANSION)
endif()
################################################################################
# Utility configuration
################################################################################
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()
set(HPX_HIDDEN_VISIBILITY_DEFAULT ON)
if(CMAKE_COMPILER_IS_GNUCXX)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6.99
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
set(HPX_HIDDEN_VISIBILITY_DEFAULT OFF)
endif()
if("${HPX_PLATFORM_UC}" STREQUAL "ANDROID")
set(HPX_HIDDEN_VISIBILITY_DEFAULT OFF)
endif()
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(HPX_HIDDEN_VISIBILITY_DEFAULT OFF)
endif()
if(APPLE)
set(HPX_HIDDEN_VISIBILITY_DEFAULT OFF)
endif()
hpx_option(HPX_HIDDEN_VISIBILITY BOOL
"Use -fvisibility=hidden for builds on platforms which support it (default ON)"
${HPX_HIDDEN_VISIBILITY_DEFAULT}
ADVANCED)
hpx_option(HPX_AUTOMATIC_SERIALIZATION_REGISTRATION BOOL
"Use automatic serialization registration for actions and functions. This affects compatibility between HPX applications compiled with different compilers (default ON)"
ON
ADVANCED)
if(NOT HPX_AUTOMATIC_SERIALIZATION_REGISTRATION)
hpx_add_config_define(HPX_DISABLE_AUTOMATIC_SERIALIZATION_REGISTRATION)
endif()
hpx_option(HPX_UNIQUE_FUTURE_ALIAS BOOL
"HPX will defined unique_future<R> as a template alias to future<R>. (default OFF)."
OFF ADVANCED)
## Thread Manager related build options
set(HPX_MAX_CPU_COUNT_DEFAULT "64")
hpx_option(HPX_MAX_CPU_COUNT STRING
"HPX applications will not use more that this number of OS-Threads (default: ${HPX_MAX_CPU_COUNT_DEFAULT})"
${HPX_MAX_CPU_COUNT_DEFAULT}
CATEGORY "Thread Manager" ADVANCED)
hpx_add_config_define(HPX_MAX_CPU_COUNT ${HPX_MAX_CPU_COUNT})
hpx_option(HPX_THREAD_STACK_MMAP BOOL
"Use mmap for stack allocation on appropriate platforms"
ON
CATEGORY "Thread Manager" ADVANCED)
hpx_option(HPX_THREAD_MANAGER_IDLE_BACKOFF BOOL
"HPX scheduler threads are backing off on idle queues (default: ON)"
ON
CATEGORY "Thread Manager" ADVANCED)
hpx_option(HPX_WITH_STACKTRACES BOOL "Attach backtraces to HPX exceptions (default: ON)"
ON CATEGORY "Thread Manager" ADVANCED)
hpx_option(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION BOOL
"Enable thread stack back trace being captured on suspension (default: OFF)"
OFF
CATEGORY "Thread Manager" ADVANCED)
if(HPX_WITH_STACKTRACES OR HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION)
hpx_info("Stack traces are enabled.")
hpx_add_config_define(HPX_HAVE_STACKTRACES)
if(MSVC)
hpx_libraries(dbghelp)
endif()
endif()
hpx_option(HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH STRING
"Thread stack back trace depth being captured on suspension (default: 5)"
"5" CATEGORY "Thread Manager" ADVANCED)
hpx_option(HPX_THREAD_MAINTAIN_FULLBACKTRACE_ON_SUSPENSION BOOL
"Enable thread stack back trace being captured on suspension (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION)
hpx_add_config_define(HPX_THREAD_MAINTAIN_BACKTRACE_ON_SUSPENSION)
hpx_add_config_define(HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH
${HPX_THREAD_BACKTRACE_ON_SUSPENSION_DEPTH})
if(HPX_THREAD_MAINTAIN_FULLBACKTRACE_ON_SUSPENSION)
hpx_add_config_define(HPX_THREAD_MAINTAIN_FULLBAKCTRACE_ON_SUSPENSION)
endif()
endif()
hpx_option(HPX_THREAD_MAINTAIN_TARGET_ADDRESS BOOL
"Enable storing target address in thread for NUMA awareness (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_TARGET_ADDRESS)
hpx_add_config_define(HPX_THREAD_MAINTAIN_TARGET_ADDRESS)
endif()
hpx_option(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME BOOL
"Enable collecting queue wait times for threads (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME)
hpx_add_config_define(HPX_THREAD_MAINTAIN_QUEUE_WAITTIME)
endif()
hpx_option(HPX_THREAD_MAINTAIN_IDLE_RATES BOOL
"Enable measuring the percentage of overhead times spent in the scheduler (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
hpx_option(HPX_THREAD_MAINTAIN_CREATION_AND_CLEANUP_RATES BOOL
"Enable measuring thread creation and cleanup times (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_IDLE_RATES)
hpx_add_config_define(HPX_THREAD_MAINTAIN_IDLE_RATES)
if(HPX_THREAD_MAINTAIN_CREATION_AND_CLEANUP_RATES)
hpx_add_config_define(HPX_THREAD_MAINTAIN_CREATION_AND_CLEANUP_RATES)
endif()
endif()
hpx_option(HPX_THREAD_MAINTAIN_CUMULATIVE_COUNTS BOOL
"Enable keeping track of cumulative thread counts in the schedulers (default: ON)"
ON CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_CUMULATIVE_COUNTS)
hpx_add_config_define(HPX_THREAD_MAINTAIN_CUMULATIVE_COUNTS)
endif()
hpx_option(HPX_THREAD_MAINTAIN_STEALING_COUNTS BOOL
"Enable keeping track of counts of thread stealing incidents in the schedulers (default: ON)"
ON CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_STEALING_COUNTS)
hpx_add_config_define(HPX_THREAD_MAINTAIN_STEALING_COUNTS)
endif()
hpx_option(HPX_THREAD_MAINTAIN_LOCAL_STORAGE BOOL
"Enable thread local storage for all HPX threads (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
if(HPX_THREAD_MAINTAIN_LOCAL_STORAGE)
hpx_add_config_define(HPX_THREAD_MAINTAIN_LOCAL_STORAGE)
endif()
hpx_option(HPX_HAVE_SWAP_CONTEXT_EMULATION BOOL "Emulate SwapContext API for coroutines (default: OFF)"
OFF CATEGORY "Thread Manager" ADVANCED)
################################################################################
# Scheduler configuration
################################################################################
hpx_option(HPX_THREAD_SCHEDULERS STRING
"Which thread schedulers are build. Options are: all, abp-priority, local, static-priority, hierarchy, and periodic-priority. For multiple enabled schedulers, separate with a semicolon (default: all)"
"all"
CATEGORY "Thread Manager" ADVANCED)
string(TOUPPER ${HPX_THREAD_SCHEDULERS} HPX_THREAD_SCHEDULERS_UC)
foreach(_scheduler ${HPX_THREAD_SCHEDULERS_UC})
if(_scheduler STREQUAL "ALL")
set(_all On)
set(HPX_ALL_SCHEDULERS ON CACHE INTERNAL "")
endif()
if(_scheduler STREQUAL "ABP-PRIORITY" OR _all)
hpx_add_config_define(HPX_ABP_SCHEDULER)
set(HPX_ABP_SCHEDULER ON CACHE INTERNAL "")
endif()
if(_scheduler STREQUAL "LOCAL" OR _all)
hpx_add_config_define(HPX_LOCAL_SCHEDULER)
set(HPX_LOCAL_SCHEDULER ON CACHE INTERNAL "")
endif()
if(_scheduler STREQUAL "STATIC-PRIORITY" OR _all)
hpx_add_config_define(HPX_STATIC_PRIORITY_SCHEDULER)
set(HPX_STATIC_PRIORITY_SCHEDULER ON CACHE INTERNAL "")
endif()
if(_scheduler STREQUAL "HIERARCHY" OR _all)
hpx_add_config_define(HPX_HIERARCHY_SCHEDULER)
set(HPX_HIERARCHY_SCHEDULER ON CACHE INTERNAL "")
endif()
if(_scheduler STREQUAL "PERIODIC-PRIORITY" OR _all)
hpx_add_config_define(HPX_PERIODIC_PRIORITY_SCHEDULER)
set(HPX_PERIODIC_PRIORITY_SCHEDULER ON CACHE INTERNAL "")
endif()
unset(_all)
endforeach()
## AGAS related build options
hpx_option(HPX_AGAS_DUMP_REFCNT_ENTRIES BOOL
"Enable dumps of the AGAS refcnt tables to logs (default: OFF)"
OFF CATEGORY "AGAS" ADVANCED)
if(HPX_AGAS_DUMP_REFCNT_ENTRIES)
hpx_add_config_define(HPX_AGAS_DUMP_REFCNT_ENTRIES)
endif()
## Parcelport related build options
hpx_option(HPX_PARCELPORT_IBVERBS BOOL "Enable the ibverbs based parcelport. This is currently an experimental feature" OFF CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_PARCELPORT_IPC BOOL "Enable the IPC (inter process communication) based parcelport. This is currently an experimental feature" OFF CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_PARCELPORT_MPI BOOL "Enable the MPI based parcelport." OFF CATEGORY "Parcelport")
hpx_option(HPX_PARCELPORT_TCP BOOL "Enable the TCP based parcelport." ON CATEGORY "Parcelport")
## ibverbs parcelport settings
hpx_option(HPX_PARCELPORT_IBVERBS_IFNAME STRING "The interface name of the ibverbs capable network adapter (default: ib0)" "ib0" CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_PARCELPORT_IBVERBS_MESSAGE_PAYLOAD STRING "Size of the message payload not sent with RDMA (default: 512 byte)" "512" CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_PARCELPORT_IBVERBS_MEMORY_CHUNK_SIZE STRING "Number of bytes a chunk in the memory pool can hold (default: 64MB)" "67108864" CATEGORY "Parcelport" ADVANCED)
hpx_option(HPX_PARCELPORT_IBVERBS_MAX_MEMORY_CHUNKS STRING "Maximum number of chunks that can be allocated (default: 100)" "100" CATEGORY "Parcelport" ADVANCED)
## mpi parcelport settings
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" CATEGORY "Parcelport" ADVANCED)
## Profiling related build options
hpx_option(HPX_WITH_APEX BOOL "Enable APEX instrumentation support." OFF CATEGORY "Profiling")
hpx_option(HPX_WITH_PAPI BOOL "Enable the PAPI based performance counter." OFF CATEGORY "Profiling")
hpx_option(HPX_WITH_TAU BOOL "Enable TAU profiling support." OFF CATEGORY "Profiling")
hpx_option(HPX_WITH_GOOGLE_PERFTOOLS BOOL "Enable Google Perftools instrumentation support." OFF CATEGORY "Profiling")
hpx_option(HPX_WITH_ITTNOTIFY BOOL "Enable Amplifier (ITT) instrumentation support." OFF CATEGORY "Profiling")
## Debugging related build options
hpx_option(HPX_WITH_VALGRIND BOOL "Enable Valgrind instrumentation support." OFF CATEGORY "Debugging")
hpx_option(HPX_VERIFY_LOCKS BOOL
"Enable lock verification code (default: OFF, implicitly enabled in debug builds)"
OFF
CATEGORY "Debugging" ADVANCED)
hpx_option(HPX_VERIFY_LOCKS_GLOBALLY BOOL
"Enable global lock verification code (default: OFF, implicitly enabled in debug builds)"
OFF
CATEGORY "Debugging" ADVANCED)
hpx_option(HPX_VERIFY_LOCKS_BACKTRACE BOOL
"Enable thred stack back trace being captured on lock registration (to be used in combination with HPX_VERIFY_LOCKS=ON, default: OFF)"
OFF
CATEGORY "Debugging" ADVANCED)
hpx_option(HPX_THREAD_DEBUG_INFO BOOL
"Enable thread debugging information (default: OFF, implicitly enabled in debug builds)"
OFF
CATEGORY "Debugging" ADVANCED)
hpx_option(HPX_THREAD_GUARD_PAGE BOOL
"Enable thread guard page (default: ON)"
ON
CATEGORY "Debugging" ADVANCED)
if(HPX_VERIFY_LOCKS)
hpx_add_config_define(HPX_HAVE_VERIFY_LOCKS)
if(HPX_VERIFY_LOCKS_BACKTRACE)
hpx_add_config_define(HPX_HAVE_VERIFY_LOCKS_BACKTRACE)
endif()
endif()
if(HPX_VERIFY_LOCKS_GLOBALLY)
hpx_add_config_define(HPX_HAVE_VERIFY_LOCKS_GLOBALLY)
endif()
# Additional debug support
if(NOT MSVC AND HPX_THREAD_GUARD_PAGE)
hpx_add_config_define(HPX_THREAD_GUARD_PAGE)
endif()
if(NOT MSVC AND HPX_THREAD_STACK_MMAP)
hpx_add_config_define(HPX_USE_MMAP)
endif()
if(HPX_THREAD_MANAGER_IDLE_BACKOFF)
hpx_add_config_define(HPX_THREAD_BACKOFF_ON_IDLE)
endif()
if(HPX_THREAD_DEBUG_INFO)
hpx_add_config_define(HPX_THREAD_MAINTAIN_PARENT_REFERENCE)
hpx_add_config_define(HPX_THREAD_MAINTAIN_PHASE_INFORMATION)
hpx_add_config_define(HPX_THREAD_MAINTAIN_DESCRIPTION)
hpx_add_config_define(HPX_THREAD_MAINTAIN_DEADLOCK_DETECTION)
endif()
# run hpx_main on all localities by default
hpx_option(HPX_RUN_MAIN_EVERYWHERE BOOL "Run hpx_main by default on all localities (default: OFF)." OFF ADVANCED)
if(HPX_RUN_MAIN_EVERYWHERE)
hpx_add_config_define(HPX_RUN_MAIN_EVERYWHERE)
endif()
# Options for our plugins
hpx_option(HPX_WITH_COMPRESSION_BZIP2 BOOL "Enable bzip2 compression for parcel data (default: OFF)." OFF ADVANCED)
hpx_option(HPX_WITH_COMPRESSION_SNAPPY BOOL "Enable snappy compression for parcel data (default: OFF)." OFF ADVANCED)
hpx_option(HPX_WITH_COMPRESSION_ZLIB BOOL "Enable zlib compression for parcel data (default: OFF)." OFF ADVANCED)
################################################################################
################################################################################
# Set basic search paths for HPX
################################################################################
include_directories("${hpx_SOURCE_DIR}" "${CMAKE_BINARY_DIR}")
link_directories(${CMAKE_BINARY_DIR}/lib)
################################################################################
##############################################################################
# Find Our dependencies:
# These are all dependencies needed to build the core library. Dependencies
# that are only needed by plugins, examples or tests should be found
# seperately in the appropriate subdirectory.
# When a package is found, the necessary include paths are set, and the libraries
# are added to the HPX_LIBRARIES variables
# Setting up our required Boost libraries. This will find all required boost
# libraries and add possibly needed boost headers shipped with the hpx source
include(HPX_SetupBoost)
# Find all allocators which are currently supported.
include(HPX_SetupAllocator)
if(HPX_WITH_HWLOC)
find_package(Hwloc)
if(NOT HWLOC_FOUND)
hpx_error("Hwloc could not be found and HPX_WITH_HWLOC=ON, please specify HWLOC_ROOT to point to the correct location or set HPX_WITH_HWLOC to OFF")
endif()
hpx_libraries(${HWLOC_LIBRARIES})
include_directories(${HWLOC_INCLUDE_DIR})
hpx_add_config_define(HPX_HAVE_HWLOC)
endif()
################################################################################
# Decide whether to use the ibverbs based parcelport
################################################################################
if(HPX_PARCELPORT_IBVERBS)
find_package(Ibverbs)
if(NOT IBVERBS_FOUND)
hpx_error("The ibverbs libraries could not be found and HPX_PARCELPORT_IBVERBS=ON, please specify IBVERBS_ROOT to point to the correct location or set HPX_PARCELPORT_IBVERBS to OFF")
endif()
hpx_libraries(${IBVERBS_LIBRARIES})
include_directories(${IBVERBS_INCLUDE_DIR})
find_package(Rdmacm)
if(NOT RDMACM_FOUND)
hpx_error("The ibverbs libraries could not be found and HPX_PARCELPORT_IBVERBS=ON, please specify RDMACM_ROOT to point to the correct location or set HPX_PARCELPORT_IBVERBS to OFF")
endif()
hpx_libraries(${RDMACM_LIBRARIES})
include_directories(${RDMACM_INCLUDE_DIR})
hpx_add_config_define(HPX_PARCELPORT_IBVERBS)
hpx_add_config_define(HPX_PARCELPORT_IBVERBS_IFNAME "\"${HPX_PARCELPORT_IBVERBS_IFNAME}\"")
hpx_add_config_define(HPX_PARCELPORT_IBVERBS_MESSAGE_PAYLOAD "${HPX_PARCELPORT_IBVERBS_MESSAGE_PAYLOAD}")
hpx_add_config_define(HPX_PARCELPORT_IBVERBS_MEMORY_CHUNK_SIZE "${HPX_PARCELPORT_IBVERBS_MEMORY_CHUNK_SIZE}")
hpx_add_config_define(HPX_PARCELPORT_IBVERBS_MAX_MEMORY_CHUNKS "${HPX_PARCELPORT_IBVERBS_MAX_MEMORY_CHUNKS}")
endif()
################################################################################
# Decide whether to use shared memory based parcelport (starting with
# Boost V1.52)
################################################################################
if(HPX_PARCELPORT_IPC)
if(Boost_VERSION GREATER 105100)
hpx_add_config_define(HPX_PARCELPORT_IPC)
endif()
endif()
################################################################################
# Decide whether to use the MPI based parcelport
################################################################################
if(HPX_PARCELPORT_MPI)
find_package(MPI)
if(NOT MPI_CXX_FOUND)
hpx_error("MPI could not be found and HPX_PARCELPORT_MPI=On, please specify MPI_CXX_COMPILER to point to a working MPI C++ compiler for your platform")
endif()
hpx_add_config_define(HPX_PARCELPORT_MPI)
if(MPI_CXX_COMPILE_FLAGS)
hpx_add_compile_flag(${MPI_CXX_COMPILE_FLAGS})
endif()
if(MPI_CXX_LINK_FLAGS)
# hpx_add_link_flag_if_available(${MPI_CXX_LINK_FLAGS})
endif()
if(MPI_CXX_INCLUDE_PATH)
include_directories(${MPI_CXX_INCLUDE_PATH})
endif()
if(MPI_CXX_LIBRARIES)
hpx_libraries(${MPI_CXX_LIBRARIES})
endif()
if(MPI_LIBRARY)
hpx_libraries(${MPI_LIBRARY})
endif()
if(MPI_EXTRA_LIBRARY)
hpx_libraries(${MPI_LIBRARY})
endif()
# This list is to detect whether 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
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()
endif()
################################################################################
# Decide whether to use the TCP/IP based parcelport
################################################################################
if(HPX_PARCELPORT_TCP)
hpx_add_config_define(HPX_PARCELPORT_TCP)
endif()
################################################################################
# Enable integration with Intel Amplifier and Inspector tools
################################################################################
if(WITH_AMPLIFIER)
find_package(Amplifier)
if(NOT AMPLIFIER_FOUND)
hpx_error("Intel Amplifier could not be found and WITH_AMPLIFIER=On, please specify AMPLIFIER_ROOT to point to the root of your Amplifier installation")
endif()
hpx_libraries(${AMPLIFIER_LIBRARIES})
include_directories(${AMPLIFIER_INCLUDE_DIR})
hpx_add_config_define(HPX_HAVE_ITTNOTIFY)
endif()
if(HPX_WITH_TAU)
find_package(TAU)
if(NOT TAU_FOUND)
hpx_error("TAU could not be found and HPX_WITH_TAU=On, please specify TAU_ROOT to point to the root of your TAU installation")
endif()
hpx_libraries(${TAU_LIBRARIES})
include_directories(${TAU_INCLUDE_DIR})
endif()
################################################################################
# Enable integration with Apex event counters
################################################################################
if(HPX_WITH_APEX)
find_package(APEX)
if(NOT APEX_FOUND)
hpx_error("Apex could not be found and HPX_WITH_APEX=On, please specify APEX_ROOT to point to the root of your Apex installation")
endif()
hpx_libraries(${APEX_LIBRARIES})
include_directories(${APEX_INCLUDE_DIR})
if(AMPLIFIER_FOUND)
hpx_error("AMPLIFIER_FOUND has been set. Please disable the use of the Intel Amplifier (WITH_AMPLIFIER=Off) in order to use Apex")
endif()
hpx_add_config_define(HPX_HAVE_ITTNOTIFY)
endif()
if(HPX_WITH_GOOGLE_PERFTOOLS)
find_package(GooglePerftools)
if(NOT GOOGLE_PERFTOOLS_FOUND)
hpx_error("Google Perftools could not be found and HPX_WITH_GOOGLE_PERFTOOLS=On, please specify GOOGLE_PERFTOOLS to point to the root of your Google Perftools installation")
endif()
hpx_libraries(${GOOGLE_PERFTOOLS_LIBRARIES})
include_directories(${GOOGLE_PERFTOOLS_INCLUDE_DIR})
endif()
if(HPX_WITH_VALGRIND)
find_package(Valgrind)
if(NOT VALGRIND_FOUND)
hpx_error("Valgrind could not be found and HPX_WITH_VALGRIND=On, please specify VALGRIND_ROOT to point to the root of your Valgrind installation")
endif()
include_directories(${VALGRIND_INCLUDE_DIR})
hpx_add_config_define(HPX_HAVE_VALGRIND)
endif()
################################################################################
# Security, libsodium: P(ortable|ackageable) NaCl
################################################################################
if(HPX_WITH_SECURITY)
find_package(Sodium)
if(NOT SODIUM_FOUND)
hpx_error("Sodium could not be found and WITH_SODIUM=On, please specify Sodium_ROOT to point to the root of your Sodium installation")
endif()
hpx_add_config_define(HPX_HAVE_SODIUM)
include_directories(${SODIUM_INCLUDE_DIR})
if(MSVC)
hpx_add_config_define(SODIUM_STATIC)
endif()
hpx_libraries(${SODIUM_LIBRARIES})
hpx_add_config_define(HPX_HAVE_SECURITY)
endif()
################################################################################
##############################################################################
# Check for compiler compatibility
#
# Check if the selected compiler versions are supposed to work with our codebase
if(CMAKE_COMPILER_IS_GNUCXX AND HPX_GCC_VERSION_CHECK)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.4.4)
hpx_error("GCC 4.4.5 or higher is required. Specify HPX_GCC_VERSION_CHECK=OFF to ignore this error.")
endif()
endif()
if(MSVC)
if(NOT (MSVC11 OR MSVC12 OR MSVC13))
hpx_error("MSVC x64 2012 or higher is required.")
elseif(NOT CMAKE_CL_64)
hpx_warn("MSVC (32Bit) will compile but will fail running larger applications because of limitations in the Windows OS.")
endif()
endif()
# Setup platform specific compiler options and check for compatible compilers
if("${HPX_PLATFORM_UC}" STREQUAL "NATIVE")
hpx_info("Compiling with the native toolset")
elseif("${HPX_PLATFORM_UC}" STREQUAL "ANDROID")
hpx_info("Compiling for Android devices")
elseif("${HPX_PLATFORM_UC}" STREQUAL "XEONPHI")
hpx_info("Compiling for Intel Xeon Phi devices")
if(NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
hpx_error("HPX on the MIC can only be compiled with the Intel compiler.")
endif()
elseif("${HPX_PLATFORM_UC}" STREQUAL "BLUEGENEQ")
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
hpx_error("HPX on the BG/Q can only be compiled with bgclang")
endif()
hpx_info("Compiling for BlueGene/Q")
endif()
################################################################################
################################################################################
# Add necessary compiler flags. Flags added here include flags to disable/enable
# certain warnings, enabling C++11 mode and disabling asserts. Setting of
# optimization flags is not handled here and is left to the responsibility of
# the user to avoid conflicts in the resulting binaries
hpx_add_compile_flag(-D_DEBUG
CONFIGURATIONS Debug LANGUAGES CXX C Fortran)
hpx_add_compile_flag(-DDEBUG
CONFIGURATIONS Debug LANGUAGES CXX C Fortran)
hpx_add_compile_flag(-DHPX_DISABLE_ASSERTS
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease LANGUAGES CXX C Fortran)
hpx_add_compile_flag(-DBOOST_DISABLE_ASSERTS
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease LANGUAGES CXX C Fortran)
# Make sure we compile in C++11 mode (MSVC uses it automatically)
if(NOT MSVC)
#set(_cxx11_support FALSE)
# Try -std=c++11 first
check_cxx_compiler_flag(-std=c++11 HPX_WITH_CXX11)
# ... If it failed try -std=c++0x
if(NOT HPX_WITH_CXX11)
check_cxx_compiler_flag(-std=c++0x HPX_WITH_CXX0X)
if(HPX_WITH_CXX0X)
set(CXX11_FLAG -std=c++0x)
set(HPX_WITH_CXX11 TRUE)
endif()
else()
set(CXX11_FLAG -std=c++11)
endif()
if(NOT HPX_WITH_CXX11)
hpx_error("Unable to compile HPX without C++11 support in your compiler. HPX needs at the very least rvalue references with proper move semantics")
endif()
hpx_add_compile_flag(${CXX11_FLAG})
##############################################################################
# Macro definitions for system headers
##############################################################################
add_definitions(-D_GNU_SOURCE)
if(APPLE)
hpx_add_config_define(BOOST_HAS_INT128)
endif()
##############################################################################
# System libraries
##############################################################################
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
hpx_libraries(dl)
endif()
if(NOT APPLE AND NOT ("${HPX_PLATFORM_UC}" STREQUAL "ANDROID"))
hpx_libraries(rt)
endif()
if("${HPX_PLATFORM_UC}" STREQUAL "ANDROID")
hpx_libraries(log)
endif()
if(APPLE)
hpx_add_compile_flag_if_available(-ftemplate-depth=256 LANGUAGES CXX)
endif()
endif()
if(MSVC)
enable_language(ASM_MASM)
hpx_add_compile_flag(-Ox
CONFIGURATIONS Release LANGUAGES CXX C)
hpx_add_compile_flag(-RTC1
CONFIGURATIONS Debug LANGUAGES CXX C)
# VS2012 and above has a special flag for improving the debug experience by
# adding more symbol information to the build (-d2Zi)
hpx_add_compile_flag(-d2Zi+
CONFIGURATIONS RelWithDebInfo)
# VS2013 and above know how to do link time constant data segment folding
# VS2013 update 2 and above know how to remove debug information for
# non-referenced functions and data (-Zc:inline)
if(MSVC12 OR MSVC13)
hpx_add_compile_flag(-Zc:inline)
hpx_add_compile_flag(-Gw
CONFIGURATIONS Release RelWithDebInfo MinSizeRelease)
hpx_add_compile_flag(-Zo
CONFIGURATIONS RelWithDebInfo)
endif()
# Exceptions
hpx_add_compile_flag(-EHsc)
# Runtime type information
hpx_add_compile_flag(-GR)
# Multiprocessor build
hpx_add_compile_flag(-MP)
# Increase the maximum size of object file sections
hpx_add_compile_flag(-bigobj)
hpx_libraries(psapi shlwapi)
##############################################################################
# Macro definitions for system headers
##############################################################################
add_definitions(-D_WINDOWS)
add_definitions(-D_WIN32)
hpx_add_config_define(_WIN32_WINNT 0x0601)
hpx_add_config_define(_SCL_SECURE_NO_WARNINGS)
hpx_add_config_define(_CRT_SECURE_NO_WARNINGS)
hpx_add_config_define(_SCL_SECURE_NO_DEPRECATE)
hpx_add_config_define(_CRT_SECURE_NO_DEPRECATE)
hpx_add_config_define(_CRT_NONSTDC_NO_WARNINGS)
hpx_add_config_define(_WINSOCK_DEPRECATED_NO_WARNINGS)
##############################################################################
# Boost
##############################################################################
hpx_add_config_define(BOOST_USE_WINDOWS_H)
hpx_add_config_define(BOOST_SERIALIZATION_DYN_LINK)
if(NOT HPX_WITH_GENERIC_CONTEXT_COROUTINES)
hpx_add_config_define(HPX_HAVE_FIBER_BASED_COROUTINES)
endif()
hpx_add_config_define(PSAPI_VERSION 1)
endif()
# Configure Warnings
if(HPX_COMPILER_WARNINGS)
if(MSVC) # Adding special warning settings for the MSVC compiler ...
hpx_add_compile_flag(-W3 LANGUAGES C CXX)
# According to the ifort Windows manual, W3 isn't supported
hpx_add_compile_flag(-W1 LANGUAGES Fortran)
# Boost.Lockfree triggers 'warning C4307: '+' : integral constant overflow'
# which is benign
hpx_add_compile_flag(-wd4307)
#MSVC2012/2013 are overeager to report 'qualifier applied to function type has no meaning; ignored'
hpx_add_compile_flag(-wd4180)
# OpenMPI triggers a lot of forcing value to bool 'true' or 'false' (performance warning)
if(MPI_FOUND)
hpx_add_compile_flag(-wd4800)
endif()
else() # Trial and error approach for any other compiler ...
hpx_add_compile_flag_if_available(-Wall LANGUAGES CXX C Fortran)
hpx_add_compile_flag_if_available(-Wextra LANGUAGES CXX C Fortran)
# This is a new warning popping up from the boost headers with no particular meaning
hpx_add_compile_flag_if_available(-Wno-unused-local-typedefs LANGUAGES CXX C Fortran)
hpx_add_compile_flag_if_available(-Wno-strict-aliasing LANGUAGES CXX C Fortran)
hpx_add_compile_flag_if_available(-Wno-sign-promo LANGUAGES CXX)
hpx_add_compile_flag_if_available(-Wno-attributes LANGUAGES CXX)
hpx_add_compile_flag_if_available(-Wno-cast-align LANGUAGES CXX)
# We never want trampolines
hpx_add_compile_flag_if_available(-Wt)
# These are usually benign and can't be suppressed because of
# interface requirements
hpx_add_compile_flag_if_available(-Wno-unused-parameter)
# There are ignored qualifiers in Boost, so we have to ignore them
hpx_add_compile_flag_if_available(-Wno-ignored-qualifiers)
# Be extra strict about format checks
# Boost.Logging is built on fprintf, sadly
hpx_add_compile_flag_if_available(-Wformat=2)
hpx_add_compile_flag_if_available(-Wno-format-nonliteral)
# Self initialization is dangerous
hpx_add_compile_flag_if_available(-Winit-self)
# For portability
hpx_add_compile_flag_if_available(-Wdouble-promotion)
# Warn about casting that violates qualifiers or alignment
hpx_add_compile_flag_if_available(-Wcast-qual)
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# Clang is overeager in reporting cast alignment problems in Boost
hpx_add_compile_flag_if_available(-Wcast-align)
endif()
hpx_add_compile_flag_if_available(-Werror=trampolines)
hpx_add_compile_flag_if_available(-Werror=parentheses)
hpx_add_compile_flag_if_available(-Werror=reorder)
hpx_add_compile_flag_if_available(-Werror=return-type)
hpx_add_compile_flag_if_available(-Werror=sequence-point)
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)
# Uninitialized variables are bad, earlier compilers issue spurious
# warnings
hpx_add_compile_flag_if_available(-Werror=uninitialized)
endif()
#hpx_add_compile_flag_if_available(-Werror=missing-field-initializers)
hpx_add_compile_flag_if_available(-Werror=format)
hpx_add_compile_flag_if_available(-Werror=missing-braces)
hpx_add_compile_flag_if_available(-Werror=sign-compare)
endif()
endif()
# Diagnostics
if(MSVC)
# Display full paths in diagnostics
hpx_add_compile_flag(-FC LANGUAGES C CXX)
else()
# Show the flags that toggle each warning
hpx_add_compile_flag_if_available(-fdiagnostics-show-option LANGUAGES CXX C Fortran)
# VLAs are a GNU extensions that we forbid as they are not supported on MSVC
hpx_add_compile_flag_if_available(-Werror=vla)
# No return statement in a non-void function can lead to garbage return values
# in GCC.
hpx_add_compile_flag_if_available(-Werror=return-type LANGUAGES CXX C)
# We get false positives all over the place with this. Also, detection for
# this flag fails with GCC 4.4 and 4.5.
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.5)
hpx_add_compile_flag_if_available(-Wno-unused-but-set-parameter LANGUAGES CXX C)
hpx_add_compile_flag_if_available(-Wno-unused-but-set-variable LANGUAGES CXX C)
# Uninitialized variables are bad, earlier compilers issue spurious warnings
hpx_add_compile_flag_if_available(-Werror=uninitialized LANGUAGES CXX C)
hpx_add_compile_flag_if_available(-Wno-unused-local-typedefs LANGUAGES CXX C)
endif()
# Silence warning about __sync_fetch_and_nand changing semantics
hpx_add_compile_flag_if_available(-Wno-sync-nand LANGUAGES CXX C)
# Silence warnings about deleting polymorphic objects with non-virtual dtors.
# These come from within Boost. Detection for this flag fails with GCC 4.4,
# 4.5 and 4.6.
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.6)
hpx_add_compile_flag_if_available(-Wno-delete-non-virtual-dtor LANGUAGES CXX C)
endif()
# Check if our libraries have unresolved symbols
if(NOT APPLE)
hpx_add_link_flag_if_available(-Wl,-z,defs TARGETS SHARED EXE)
endif()
if("${HPX_PLATFORM_UC}" STREQUAL "BLUEGENEQ")
hpx_add_compile_flag_if_available(-Wno-deprecated-register CXX C)
endif()
if(HPX_HIDDEN_VISIBILITY)
hpx_add_compile_flag_if_available(-fvisibility=hidden LANGUAGES CXX C Fortran)
hpx_add_link_flag_if_available(-fvisibility=hidden TARGETS SHARED EXE)
hpx_add_config_define(HPX_ELF_HIDDEN_VISIBILITY)
hpx_add_config_define(HPX_COROUTINE_GCC_HAVE_VISIBILITY)
hpx_add_config_define(HPX_PLUGIN_GCC_HAVE_VISIBILITY)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
hpx_add_compile_flag_if_available(-Wno-cast-align)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# Disable the following warnings:
# #1170: invalid redeclaration of nested class
# #858: type qualifier on return type is meaningless
# #1098: the qualifier on this friend declaration is ignored
# #488: template parameter not used in declaring the parameter type
# #2203: cast discards qualifiers from target type (needed for mvapich2
# mpi header)
hpx_add_compile_flag_if_available(-wd1170)
hpx_add_compile_flag_if_available(-wd858)
hpx_add_compile_flag_if_available(-wd1098)
hpx_add_compile_flag_if_available(-wd488)
hpx_add_compile_flag_if_available(-wd2203)
hpx_add_compile_flag_if_available(-wd2536)
endif()
# rdtsc is an x86 instruction that reads the value of a CPU time stamp
# counter. rdtscp is an extension to rdtsc. The difference is that rdtscp is
# a serializing instruction.
hpx_cpuid("rdtsc" HPX_WITH_RDTSC
DEFINITIONS HPX_HAVE_RDTSC)
# XeonPhi's do not support RDTSCP
if(NOT ("${HPX_PLATFORM_UC}" STREQUAL "XEONPHI"))
hpx_cpuid("rdtscp" HPX_WITH_RDTSCP
DEFINITIONS HPX_HAVE_RDTSCP)
endif()
if(NOT HPX_WITH_RDTSC AND NOT HPX_WITH_RDTSCP)
hpx_warn("Neither rdtsc nor rdtscp is available; some performance counters may report incorrect results")
endif()
endif()
##############################################################################
##############################################################################
# Check the availability of certain C++11 language features
hpx_check_for_cxx11_rvalue_references()