@@ -12,7 +12,7 @@ if(POLICY CMP0075)
12
12
endif ()
13
13
14
14
if (NOT DEFINED LLVM_VERSION_MAJOR )
15
- set (LLVM_VERSION_MAJOR 8 )
15
+ set (LLVM_VERSION_MAJOR 9 )
16
16
endif ()
17
17
if (NOT DEFINED LLVM_VERSION_MINOR )
18
18
set (LLVM_VERSION_MINOR 0 )
@@ -104,27 +104,60 @@ endif()
104
104
# LLVM_EXTERNAL_${project}_SOURCE_DIR using LLVM_ALL_PROJECTS
105
105
# This allows an easy way of setting up a build directory for llvm and another
106
106
# one for llvm+clang+... using the same sources.
107
- set (LLVM_ALL_PROJECTS "clang;libcxx;libcxxabi;libunwind;lldb;compiler-rt;lld; polly;debuginfo-tests " )
107
+ set (LLVM_ALL_PROJECTS "clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc; libcxx;libcxxabi;libunwind;lld; lldb;llgo;openmp;parallel-libs; polly;pstl " )
108
108
set (LLVM_ENABLE_PROJECTS "" CACHE STRING
109
109
"Semicolon-separated list of projects to build (${LLVM_ALL_PROJECTS} ), or \" all\" ." )
110
110
if ( LLVM_ENABLE_PROJECTS STREQUAL "all" )
111
111
set ( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS} )
112
112
endif ()
113
- foreach (proj ${LLVM_ENABLE_PROJECTS} )
114
- set (PROJ_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../${proj} " )
115
- if (NOT EXISTS "${PROJ_DIR} " OR NOT IS_DIRECTORY "${PROJ_DIR} " )
116
- message (FATAL_ERROR "LLVM_ENABLE_PROJECTS requests ${proj} but directory not found: ${PROJ_DIR} " )
117
- endif ()
118
- string (TOUPPER "${proj} " upper_proj )
119
- STRING (REGEX REPLACE "-" "_" upper_proj ${upper_proj} )
120
- set (LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../${proj} " )
121
- # There is a widely spread opinion that clang-tools-extra should be merged
122
- # into clang. The following simulates it by always enabling clang-tools-extra
123
- # when enabling clang.
124
- if (proj STREQUAL "clang" )
125
- set (LLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../clang-tools-extra" )
126
- endif ()
127
- endforeach ()
113
+
114
+ # LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
115
+ # `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
116
+ # several reasons:
117
+ #
118
+ # * As an indicator that the `LLVM_ENABLE_PROJECTS` list is now the single
119
+ # source of truth for which projects to build. This means we will ignore user
120
+ # supplied `LLVM_TOOL_<project>_BUILD` CMake cache variables and overwrite
121
+ # them.
122
+ #
123
+ # * The case where the user previously had `LLVM_ENABLE_PROJECTS` set to a
124
+ # non-empty list but now the user wishes to disable building all other projects
125
+ # by setting `LLVM_ENABLE_PROJECTS` to an empty string. In that case we still
126
+ # need to set the `LLVM_TOOL_${upper_proj}_BUILD` variables so that we disable
127
+ # building all the projects that were previously enabled.
128
+ set (LLVM_ENABLE_PROJECTS_USED OFF CACHE BOOL "" )
129
+ mark_as_advanced (LLVM_ENABLE_PROJECTS_USED )
130
+
131
+ if (LLVM_ENABLE_PROJECTS_USED OR NOT LLVM_ENABLE_PROJECTS STREQUAL "" )
132
+ set (LLVM_ENABLE_PROJECTS_USED ON CACHE BOOL "" FORCE )
133
+ foreach (proj ${LLVM_ALL_PROJECTS} ${LLVM_EXTERNAL_PROJECTS} )
134
+ string (TOUPPER "${proj} " upper_proj )
135
+ string (REGEX REPLACE "-" "_" upper_proj ${upper_proj} )
136
+ if ("${proj} " IN_LIST LLVM_ENABLE_PROJECTS )
137
+ message (STATUS "${proj} project is enabled" )
138
+ set (SHOULD_ENABLE_PROJECT TRUE )
139
+ set (PROJ_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../${proj} " )
140
+ if (NOT EXISTS "${PROJ_DIR} " OR NOT IS_DIRECTORY "${PROJ_DIR} " )
141
+ message (FATAL_ERROR "LLVM_ENABLE_PROJECTS requests ${proj} but directory not found: ${PROJ_DIR} " )
142
+ endif ()
143
+ set (LLVM_EXTERNAL_${upper_proj}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR} /../${proj} " CACHE STRING "" )
144
+ else ()
145
+ message (STATUS "${proj} project is disabled" )
146
+ set (SHOULD_ENABLE_PROJECT FALSE )
147
+ endif ()
148
+ # Force `LLVM_TOOL_${upper_proj}_BUILD` variables to have values that
149
+ # corresponds with `LLVM_ENABLE_PROJECTS`. This prevents the user setting
150
+ # `LLVM_TOOL_${upper_proj}_BUILD` variables externally. At some point
151
+ # we should deprecate allowing users to set these variables by turning them
152
+ # into normal CMake variables rather than cache variables.
153
+ set (LLVM_TOOL_${upper_proj}_BUILD
154
+ ${SHOULD_ENABLE_PROJECT}
155
+ CACHE
156
+ BOOL "Whether to build ${upper_proj} as part of LLVM" FORCE
157
+ )
158
+ endforeach ()
159
+ endif ()
160
+ unset (SHOULD_ENABLE_PROJECT )
128
161
129
162
# Build llvm with ccache if the package is present
130
163
set (LLVM_CCACHE_BUILD OFF CACHE BOOL "Set to ON for a ccache enabled build" )
@@ -200,7 +233,7 @@ endif()
200
233
include (VersionFromVCS )
201
234
202
235
option (LLVM_APPEND_VC_REV
203
- "Embed the version control system revision id in LLVM" ON )
236
+ "Embed the version control system revision in LLVM" ON )
204
237
205
238
set (PACKAGE_NAME LLVM )
206
239
set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION} " )
@@ -318,6 +351,8 @@ if(LLVM_ENABLE_BACKTRACES)
318
351
set (ENABLE_BACKTRACES 1 )
319
352
endif ()
320
353
354
+ option (LLVM_ENABLE_UNWIND_TABLES "Emit unwind tables for the libraries" ON )
355
+
321
356
option (LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON )
322
357
if (LLVM_ENABLE_CRASH_OVERRIDES )
323
358
set (ENABLE_CRASH_OVERRIDES 1 )
@@ -344,6 +379,31 @@ option(LLVM_ENABLE_THREADS "Use threads if available." ON)
344
379
345
380
option (LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON )
346
381
382
+ set (LLVM_Z3_INSTALL_DIR "" CACHE STRING "Install directory of the Z3 solver." )
383
+
384
+ find_package (Z3 4.7.1 )
385
+
386
+ if (LLVM_Z3_INSTALL_DIR )
387
+ if (NOT Z3_FOUND )
388
+ message (FATAL_ERROR "Z3 >= 4.7.1 has not been found in LLVM_Z3_INSTALL_DIR: ${LLVM_Z3_INSTALL_DIR} ." )
389
+ endif ()
390
+ endif ()
391
+
392
+ set (LLVM_ENABLE_Z3_SOLVER_DEFAULT "${Z3_FOUND} " )
393
+
394
+ option (LLVM_ENABLE_Z3_SOLVER
395
+ "Enable Support for the Z3 constraint solver in LLVM."
396
+ ${LLVM_ENABLE_Z3_SOLVER_DEFAULT}
397
+ )
398
+
399
+ if (LLVM_ENABLE_Z3_SOLVER )
400
+ if (NOT Z3_FOUND )
401
+ message (FATAL_ERROR "LLVM_ENABLE_Z3_SOLVER cannot be enabled when Z3 is not available." )
402
+ endif ()
403
+
404
+ set (LLVM_WITH_Z3 1 )
405
+ endif ()
406
+
347
407
if ( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
348
408
set ( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
349
409
endif ()
@@ -363,8 +423,6 @@ else()
363
423
option (LLVM_ENABLE_MODULE_DEBUGGING "Compile with -gmodules." OFF )
364
424
option (LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY "Compile with -fmodules-local-submodule-visibility." ON )
365
425
endif ()
366
- option (LLVM_ENABLE_CXX1Y "Compile with C++1y enabled." OFF )
367
- option (LLVM_ENABLE_CXX1Z "Compile with C++1z enabled." OFF )
368
426
option (LLVM_ENABLE_LIBCXX "Use libc++ if available." OFF )
369
427
option (LLVM_ENABLE_LLD "Use lld as C and C++ linker." OFF )
370
428
option (LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON )
@@ -383,9 +441,12 @@ option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
383
441
set (LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING
384
442
"Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF." )
385
443
386
- option (LLVM_FORCE_USE_OLD_HOST_TOOLCHAIN
444
+ option (LLVM_FORCE_USE_OLD_TOOLCHAIN
387
445
"Set to ON to force using an old, unsupported host toolchain." OFF )
388
446
447
+ option (LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN
448
+ "Set to ON to only warn when using a toolchain which is about to be deprecated, instead of emitting an error." OFF )
449
+
389
450
option (LLVM_USE_INTEL_JITEVENTS
390
451
"Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code"
391
452
OFF )
@@ -534,7 +595,7 @@ if(NOT DEFINED LLVM_DYLIB_COMPONENTS)
534
595
endif ()
535
596
option (LLVM_LINK_LLVM_DYLIB "Link tools against the libllvm dynamic library" OFF )
536
597
if (MSVC )
537
- option (LLVM_BUILD_LLVM_C_DYLIB "Build LLVM-C.dll (Windows only)" OFF )
598
+ option (LLVM_BUILD_LLVM_C_DYLIB "Build LLVM-C.dll (Windows only)" ON )
538
599
else ()
539
600
option (LLVM_BUILD_LLVM_C_DYLIB "Build libllvm-c re-export library (Darwin only)" OFF )
540
601
endif ()
@@ -568,6 +629,12 @@ if (LLVM_BUILD_INSTRUMENTED OR LLVM_BUILD_INSTRUMENTED_COVERAGE OR
568
629
endif ()
569
630
file (TO_NATIVE_PATH "${LLVM_PROFILE_DATA_DIR} /%${LLVM_PROFILE_MERGE_POOL_SIZE} m.profraw" LLVM_PROFILE_FILE_PATTERN )
570
631
endif ()
632
+ if (NOT LLVM_CSPROFILE_FILE_PATTERN )
633
+ if (NOT LLVM_CSPROFILE_DATA_DIR )
634
+ file (TO_NATIVE_PATH "${LLVM_BINARY_DIR} /csprofiles" LLVM_CSPROFILE_DATA_DIR )
635
+ endif ()
636
+ file (TO_NATIVE_PATH "${LLVM_CSPROFILE_DATA_DIR} /%${LLVM_PROFILE_MERGE_POOL_SIZE} m.profraw" LLVM_CSPROFILE_FILE_PATTERN )
637
+ endif ()
571
638
endif ()
572
639
573
640
if (LLVM_BUILD_STATIC )
@@ -752,13 +819,12 @@ set(LLVM_SRPM_USER_BINARY_SPECFILE ${CMAKE_CURRENT_SOURCE_DIR}/llvm.spec.in
752
819
set (LLVM_SRPM_BINARY_SPECFILE ${CMAKE_CURRENT_BINARY_DIR} /llvm.spec )
753
820
set (LLVM_SRPM_DIR "${CMAKE_CURRENT_BINARY_DIR} /srpm" )
754
821
755
- # SVN_REVISION and GIT_COMMIT get set by the call to add_version_info_from_vcs.
756
- # DUMMY_VAR contains a version string which we don't care about.
757
- add_version_info_from_vcs (DUMMY_VAR )
758
- if ( SVN_REVISION )
759
- set (LLVM_RPM_SPEC_REVISION "r${SVN_REVISION} " )
760
- elseif ( GIT_COMMIT )
761
- set (LLVM_RPM_SPEC_REVISION "g${GIT_COMMIT} " )
822
+ get_source_info (${CMAKE_CURRENT_SOURCE_DIR} revision repository )
823
+ string (LENGTH "${revision} " revision_length )
824
+ if (revision MATCHES "^[0-9]+$" AND revision_length LESS 40 )
825
+ set (LLVM_RPM_SPEC_REVISION "r${revision} " )
826
+ else ()
827
+ set (LLVM_RPM_SPEC_REVISION "${revision} " )
762
828
endif ()
763
829
764
830
configure_file (
0 commit comments