summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake28
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake5
-rwxr-xr-xcmake/modules/LLVM-Config.cmake3
-rw-r--r--cmake/modules/LLVMConfig.cmake.in3
4 files changed, 33 insertions, 6 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7cad190..7f8c48d 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -4,6 +4,7 @@ if( WIN32 AND NOT CYGWIN )
endif()
include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckFunctionExists)
@@ -37,6 +38,7 @@ endfunction()
check_include_file(argz.h HAVE_ARGZ_H)
check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(ctype.h HAVE_CTYPE_H)
+check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)
check_include_file(dirent.h HAVE_DIRENT_H)
check_include_file(dl.h HAVE_DL_H)
check_include_file(dld.h HAVE_DLD_H)
@@ -79,6 +81,7 @@ check_include_file(unistd.h HAVE_UNISTD_H)
check_include_file(utime.h HAVE_UTIME_H)
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
check_include_file(windows.h HAVE_WINDOWS_H)
+check_include_file(zlib.h HAVE_ZLIB_H)
check_include_file(fenv.h HAVE_FENV_H)
check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT)
check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
@@ -104,6 +107,11 @@ if( NOT PURE_WINDOWS )
endif()
check_library_exists(dl dlopen "" HAVE_LIBDL)
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
+ if (LLVM_ENABLE_ZLIB)
+ check_library_exists(z compress2 "" HAVE_LIBZ)
+ else()
+ set(HAVE_LIBZ 0)
+ endif()
endif()
# function checks
@@ -332,12 +340,13 @@ if (CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
-include(GetHostTriple)
-get_host_triple(LLVM_HOST_TRIPLE)
-
# By default, we target the host, but this can be overridden at CMake
# invocation time.
-set(LLVM_HOSTTRIPLE "${LLVM_HOST_TRIPLE}")
+include(GetHostTriple)
+get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
+
+set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING
+ "Host on which LLVM binaries will run")
# Determine the native architecture.
string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
@@ -357,6 +366,8 @@ elseif (LLVM_NATIVE_ARCH MATCHES "sparc")
set(LLVM_NATIVE_ARCH Sparc)
elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
set(LLVM_NATIVE_ARCH PowerPC)
+elseif (LLVM_NATIVE_ARCH MATCHES "aarch64")
+ set(LLVM_NATIVE_ARCH AArch64)
elseif (LLVM_NATIVE_ARCH MATCHES "arm")
set(LLVM_NATIVE_ARCH ARM)
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
@@ -367,6 +378,8 @@ elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
set(LLVM_NATIVE_ARCH MSP430)
elseif (LLVM_NATIVE_ARCH MATCHES "hexagon")
set(LLVM_NATIVE_ARCH Hexagon)
+elseif (LLVM_NATIVE_ARCH MATCHES "s390x")
+ set(LLVM_NATIVE_ARCH SystemZ)
else ()
message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
endif ()
@@ -450,4 +463,11 @@ else( LLVM_ENABLE_THREADS )
message(STATUS "Threads disabled.")
endif()
+if (LLVM_ENABLE_ZLIB )
+ # Check if zlib is available in the system.
+ if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ )
+ set(LLVM_ENABLE_ZLIB 0)
+ endif()
+endif()
+
set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX})
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index 4e59a3e..f8a017d 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -21,6 +21,9 @@ if( LLVM_ENABLE_ASSERTIONS )
# explicitly undefine it:
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
add_definitions( -UNDEBUG )
+ # Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
+ string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " "
+ CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
endif()
else()
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
@@ -249,8 +252,6 @@ if(LLVM_USE_SANITIZER)
elseif (LLVM_USE_SANITIZER MATCHES "Memory(WithOrigins)?")
append_common_sanitizer_flags()
add_flag_or_print_warning("-fsanitize=memory")
- # -pie is required for MSan.
- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
if(LLVM_USE_SANITIZER STREQUAL "MemoryWithOrigins")
add_flag_or_print_warning("-fsanitize-memory-track-origins")
endif()
diff --git a/cmake/modules/LLVM-Config.cmake b/cmake/modules/LLVM-Config.cmake
index 163401c..2ddc0b2 100755
--- a/cmake/modules/LLVM-Config.cmake
+++ b/cmake/modules/LLVM-Config.cmake
@@ -13,6 +13,9 @@ function(get_system_libs return_var)
if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
set(system_libs ${system_libs} pthread)
endif()
+ if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
+ set(system_libs ${system_libs} z)
+ endif()
endif( MINGW )
endif( NOT MSVC )
set(${return_var} ${system_libs} PARENT_SCOPE)
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index c43119e..f0b8c14 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -22,12 +22,15 @@ set(LLVM_TOOLS_BINARY_DIR @LLVM_TOOLS_BINARY_DIR@)
set(LLVM_ENABLE_THREADS @LLVM_ENABLE_THREADS@)
+set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@)
+
set(LLVM_NATIVE_ARCH @LLVM_NATIVE_ARCH@)
set(LLVM_ENABLE_PIC @LLVM_ENABLE_PIC@)
set(HAVE_LIBDL @HAVE_LIBDL@)
set(HAVE_LIBPTHREAD @HAVE_LIBPTHREAD@)
+set(HAVE_LIBZ @HAVE_LIBZ@)
set(LLVM_ON_UNIX @LLVM_ON_UNIX@)
set(LLVM_ON_WIN32 @LLVM_ON_WIN32@)
OpenPOWER on IntegriCloud