Revert "[CMake] Improve the clang order-file generation workflow"

This reverts commit r259862, and attempts to fix builder CMakeCaches.

Will try this again some other time...

Conflicts:

	CMakeLists.txt
	tools/driver/CMakeLists.txt

llvm-svn: 259872
This commit is contained in:
Chris Bieneman 2016-02-05 03:40:37 +00:00
parent 16638f9a2c
commit dc76e70b2a
3 changed files with 6 additions and 19 deletions

View File

@ -586,24 +586,14 @@ if( CLANG_INCLUDE_DOCS )
add_subdirectory(docs)
endif()
# this line is needed as a cleanup to ensure that any CMakeCaches with the old
# default value get updated to the new default.
if(CLANG_ORDER_FILE STREQUAL "")
if(CLANG_ORDER_FILE STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/clang.order")
unset(CLANG_ORDER_FILE CACHE)
unset(CLANG_ORDER_FILE)
endif()
set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
set(CLANG_ORDER_FILE "" CACHE FILEPATH
"Order file to use when compiling clang in order to improve startup time.")
file(READ ${CLANG_ORDER_FILE} order_file 20)
if(order_file STREQUAL "")
file(REMOVE ${CLANG_ORDER_FILE})
endif()
if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
file(WRITE ${CLANG_ORDER_FILE} "\n")
endif()
if (CLANG_BUILT_STANDALONE OR CMAKE_VERSION VERSION_EQUAL 3 OR
CMAKE_VERSION VERSION_GREATER 3)
# Generate a list of CMake library targets so that other CMake projects can

View File

@ -87,12 +87,8 @@ if (APPLE)
set(TOOL_INFO_BUILD_VERSION)
endif()
check_cxx_compiler_flag("-Wl,-order_file,${CLANG_ORDER_FILE}"
LINKER_HAS_ORDER_FILE_FLAG)
if(LINKER_HAS_ORDER_FILE_FLAG AND CLANG_ORDER_FILE)
if(CLANG_ORDER_FILE)
target_link_libraries(clang "-Wl,-order_file,${CLANG_ORDER_FILE}")
set_target_properties(clang PROPERTIES LINK_DEPENDS ${CLANG_ORDER_FILE})
endif()
if(WITH_POLLY AND LINK_POLLY_INTO_TOOLS)

View File

@ -55,8 +55,9 @@ if(DTRACE)
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
COMMENT "Clearing old dtrace data")
add_custom_target(generate-order-file
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CLANG_ORDER_FILE} ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py gen-order-file --binary $<TARGET_FILE:clang> --output ${CMAKE_CURRENT_BINARY_DIR}/clang.order ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating order file"
DEPENDS generate-dtrace-logs)
endif()