summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-05-29 02:49:00 -0700
committerStephen Hines <srhines@google.com>2014-05-29 02:49:00 -0700
commitdce4a407a24b04eebc6a376f8e62b41aaa7b071f (patch)
treedcebc53f2b182f145a2e659393bf9a0472cedf23 /cmake
parent220b921aed042f9e520c26cffd8282a94c66c3d5 (diff)
downloadexternal_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.zip
external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.gz
external_llvm-dce4a407a24b04eebc6a376f8e62b41aaa7b071f.tar.bz2
Update LLVM for 3.5 rebase (r209712).
Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/config-ix.cmake19
-rw-r--r--cmake/modules/AddLLVM.cmake16
-rw-r--r--cmake/modules/AddSphinxTarget.cmake56
-rw-r--r--cmake/modules/FindSphinx.cmake25
-rw-r--r--cmake/modules/HandleLLVMOptions.cmake28
-rw-r--r--cmake/modules/LLVMConfig.cmake.in1
-rw-r--r--cmake/modules/LLVMConfigVersion.cmake.in14
-rw-r--r--cmake/modules/Makefile4
8 files changed, 148 insertions, 15 deletions
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index f007b37..1325e79 100755
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -17,6 +17,11 @@ if( UNIX AND NOT BEOS )
# Used by check_symbol_exists:
set(CMAKE_REQUIRED_LIBRARIES m)
endif()
+# x86_64 FreeBSD 9.2 requires libcxxrt to be specified explicitly.
+if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND
+ CMAKE_SIZEOF_VOID_P EQUAL 8 )
+ list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
+endif()
# Helper macros and functions
macro(add_cxx_include result files)
@@ -367,7 +372,7 @@ elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
elseif (LLVM_NATIVE_ARCH MATCHES "aarch64")
set(LLVM_NATIVE_ARCH AArch64)
elseif (LLVM_NATIVE_ARCH MATCHES "arm64")
- set(LLVM_NATIVE_ARCH ARM64)
+ set(LLVM_NATIVE_ARCH AArch64)
elseif (LLVM_NATIVE_ARCH MATCHES "arm")
set(LLVM_NATIVE_ARCH ARM)
elseif (LLVM_NATIVE_ARCH MATCHES "mips")
@@ -481,7 +486,7 @@ set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX})
if (LLVM_ENABLE_DOXYGEN)
message(STATUS "Doxygen enabled.")
- find_package(Doxygen)
+ find_package(Doxygen REQUIRED)
if (DOXYGEN_FOUND)
# If we find doxygen and we want to enable doxygen by default create a
@@ -500,3 +505,13 @@ if (LLVM_ENABLE_DOXYGEN)
else()
message(STATUS "Doxygen disabled.")
endif()
+
+if (LLVM_ENABLE_SPHINX)
+ message(STATUS "Sphinx enabled.")
+ find_package(Sphinx REQUIRED)
+ if (LLVM_BUILD_DOCS)
+ add_custom_target(sphinx ALL)
+ endif()
+else()
+ message(STATUS "Sphinx disabled.")
+endif()
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 41902d2..69ffa5b 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -276,6 +276,11 @@ function(llvm_add_library name)
endif()
if(ARG_SHARED)
+ if(WIN32)
+ set_target_properties(${name} PROPERTIES
+ PREFIX ""
+ )
+ endif()
if (MSVC)
set_target_properties(${name}
PROPERTIES
@@ -627,11 +632,12 @@ function(add_lit_target target comment)
if (NOT CMAKE_CFG_INTDIR STREQUAL ".")
list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR})
endif ()
- set(LIT_COMMAND
- ${PYTHON_EXECUTABLE}
- ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py
- ${LIT_ARGS}
- )
+ if (LLVM_MAIN_SRC_DIR)
+ set (LIT_COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
+ else()
+ find_program(LIT_COMMAND llvm-lit)
+ endif ()
+ list(APPEND LIT_COMMAND ${LIT_ARGS})
foreach(param ${ARG_PARAMS})
list(APPEND LIT_COMMAND --param ${param})
endforeach()
diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake
new file mode 100644
index 0000000..fc28a49
--- /dev/null
+++ b/cmake/modules/AddSphinxTarget.cmake
@@ -0,0 +1,56 @@
+# Handy function for creating the different Sphinx targets.
+#
+# ``builder`` should be one of the supported builders used by
+# the sphinx-build command.
+#
+# ``project`` should be the project name
+function (add_sphinx_target builder project)
+ set(SPHINX_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/${builder}")
+ set(SPHINX_DOC_TREE_DIR "${CMAKE_CURRENT_BINARY_DIR}/_doctrees")
+ set(SPHINX_TARGET_NAME docs-${project}-${builder})
+ add_custom_target(${SPHINX_TARGET_NAME}
+ COMMAND ${SPHINX_EXECUTABLE}
+ -b ${builder}
+ -d "${SPHINX_DOC_TREE_DIR}"
+ -q # Quiet: no output other than errors and warnings.
+ -W # Warnings are errors.
+ "${CMAKE_CURRENT_SOURCE_DIR}" # Source
+ "${SPHINX_BUILD_DIR}" # Output
+ COMMENT
+ "Generating ${builder} Sphinx documentation for ${project}")
+
+ # When "clean" target is run, remove the Sphinx build directory
+ set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES
+ "${SPHINX_BUILD_DIR}")
+
+ # We need to remove ${SPHINX_DOC_TREE_DIR} when make clean is run
+ # but we should only add this path once
+ get_property(_CURRENT_MAKE_CLEAN_FILES
+ DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES)
+ list(FIND _CURRENT_MAKE_CLEAN_FILES "${SPHINX_DOC_TREE_DIR}" _INDEX)
+ if (_INDEX EQUAL -1)
+ set_property(DIRECTORY APPEND PROPERTY
+ ADDITIONAL_MAKE_CLEAN_FILES
+ "${SPHINX_DOC_TREE_DIR}")
+ endif()
+
+ if (LLVM_BUILD_DOCS)
+ add_dependencies(sphinx ${SPHINX_TARGET_NAME})
+
+ # Handle installation
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if (builder STREQUAL man)
+ # FIXME: We might not ship all the tools that these man pages describe
+ install(DIRECTORY "${SPHINX_BUILD_DIR}/" # Slash indicates contents of
+ DESTINATION share/man/man1)
+
+ elseif (builder STREQUAL html)
+ install(DIRECTORY "${SPHINX_BUILD_DIR}"
+ DESTINATION "share/doc/${project}")
+ else()
+ message(WARNING Installation of ${builder} not supported)
+ endif()
+ endif()
+ endif()
+endfunction()
diff --git a/cmake/modules/FindSphinx.cmake b/cmake/modules/FindSphinx.cmake
new file mode 100644
index 0000000..a2adcae
--- /dev/null
+++ b/cmake/modules/FindSphinx.cmake
@@ -0,0 +1,25 @@
+# CMake find_package() Module for Sphinx documentation generator
+# http://sphinx-doc.org/
+#
+# Example usage:
+#
+# find_package(Sphinx)
+#
+# If successful the following variables will be defined
+# SPHINX_FOUND
+# SPHINX_EXECUTABLE
+
+find_program(SPHINX_EXECUTABLE
+ NAMES sphinx-build sphinx-build2
+ DOC "Path to sphinx-build executable")
+
+# Handle REQUIRED and QUIET arguments
+# this will also set SPHINX_FOUND to true if SPHINX_EXECUTABLE exists
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Sphinx
+ "Failed to locate sphinx-build executable"
+ SPHINX_EXECUTABLE)
+
+# Provide options for controlling different types of output
+option(SPHINX_OUTPUT_HTML "Output standalone HTML files" ON)
+option(SPHINX_OUTPUT_MAN "Output man pages" ON)
diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
index d5afc62..447ba52 100644
--- a/cmake/modules/HandleLLVMOptions.cmake
+++ b/cmake/modules/HandleLLVMOptions.cmake
@@ -56,13 +56,16 @@ if( LLVM_ENABLE_ASSERTIONS )
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
add_definitions( -UNDEBUG )
# Also remove /D NDEBUG to avoid MSVC warnings about conflicting defines.
- set(REGEXP_NDEBUG "(^| )[/-]D *NDEBUG($| )")
- string (REGEX REPLACE "${REGEXP_NDEBUG}" " "
- CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
- string (REGEX REPLACE "${REGEXP_NDEBUG}" " "
- CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
- string (REGEX REPLACE "${REGEXP_NDEBUG}" " "
- CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
+ foreach (flags_var_to_scrub
+ CMAKE_CXX_FLAGS_RELEASE
+ CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ CMAKE_CXX_FLAGS_MINSIZEREL
+ CMAKE_C_FLAGS_RELEASE
+ CMAKE_C_FLAGS_RELWITHDEBINFO
+ CMAKE_C_FLAGS_MINSIZEREL)
+ string (REGEX REPLACE "(^| )[/-]D *NDEBUG($| )" " "
+ "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
+ endforeach()
endif()
else()
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
@@ -295,6 +298,17 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
append_if(USE_NO_MAYBE_UNINITIALIZED "-Wno-maybe-uninitialized" CMAKE_CXX_FLAGS)
check_cxx_compiler_flag("-Werror -Wnon-virtual-dtor" CXX_SUPPORTS_NON_VIRTUAL_DTOR_FLAG)
append_if(CXX_SUPPORTS_NON_VIRTUAL_DTOR_FLAG "-Wnon-virtual-dtor" CMAKE_CXX_FLAGS)
+
+ # Check if -Wcomment is OK with an // comment ending with '\' if the next
+ # line is also a // comment.
+ set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -Werror -Wcomment)
+ CHECK_C_SOURCE_COMPILES("// \\\\\\n//\\nint main() {return 0;}"
+ C_WCOMMENT_ALLOWS_LINE_WRAP)
+ set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
+ if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
+ append("-Wno-comment" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
+ endif()
endif (LLVM_ENABLE_WARNINGS)
append_if(LLVM_ENABLE_WERROR "-Werror" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
if (LLVM_ENABLE_CXX1Y)
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index 2f8d037..780001a 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -4,6 +4,7 @@
set(LLVM_VERSION_MAJOR @LLVM_VERSION_MAJOR@)
set(LLVM_VERSION_MINOR @LLVM_VERSION_MINOR@)
+set(LLVM_VERSION_PATCH @LLVM_VERSION_PATCH@)
set(LLVM_PACKAGE_VERSION @PACKAGE_VERSION@)
set(LLVM_COMMON_DEPENDS @LLVM_COMMON_DEPENDS@)
diff --git a/cmake/modules/LLVMConfigVersion.cmake.in b/cmake/modules/LLVMConfigVersion.cmake.in
index add5aa9..e9ac4ed 100644
--- a/cmake/modules/LLVMConfigVersion.cmake.in
+++ b/cmake/modules/LLVMConfigVersion.cmake.in
@@ -1 +1,13 @@
-set(PACKAGE_VERSION "@PACKAGE_VERSION@") \ No newline at end of file
+set(PACKAGE_VERSION "@PACKAGE_VERSION@")
+
+# LLVM is API-compatible only with matching major.minor versions
+# and patch versions not less than that requested.
+if("@LLVM_VERSION_MAJOR@.@LLVM_VERSION_MINOR@" VERSION_EQUAL
+ "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}"
+ AND NOT "@LLVM_VERSION_PATCH@" VERSION_LESS "${PACKAGE_FIND_VERSION_PATCH}")
+ set(PACKAGE_VERSION_COMPATIBLE 1)
+ if("@LLVM_VERSION_PATCH@" VERSION_EQUAL
+ "${PACKAGE_FIND_VERSION_PATCH}")
+ set(PACKAGE_VERSION_EXACT 1)
+ endif()
+endif()
diff --git a/cmake/modules/Makefile b/cmake/modules/Makefile
index 8f20ddf..265c1f8 100644
--- a/cmake/modules/Makefile
+++ b/cmake/modules/Makefile
@@ -24,6 +24,7 @@ $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag)
-e 's/@LLVM_CONFIG_CODE@/set(LLVM_INSTALL_PREFIX "'"$(subst /,\/,$(PROJ_prefix))"'")/' \
-e 's/@LLVM_VERSION_MAJOR@/'"$(LLVM_VERSION_MAJOR)"'/' \
-e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
+ -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
-e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
-e 's/@LLVM_COMMON_DEPENDS@//' \
-e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \
@@ -51,6 +52,9 @@ $(PROJ_OBJ_DIR)/LLVMConfigVersion.cmake: LLVMConfigVersion.cmake.in
$(Echo) 'Generating LLVM CMake package version file'
$(Verb) cat $< | sed \
-e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \
+ -e 's/@LLVM_VERSION_MAJOR@/'"$(LLVM_VERSION_MAJOR)"'/' \
+ -e 's/@LLVM_VERSION_MINOR@/'"$(LLVM_VERSION_MINOR)"'/' \
+ -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \
> $@
$(PROJ_OBJ_DIR)/LLVMExports.cmake: $(LLVMBuildCMakeExportsFrag)