[PATCH] D28153: [clang] Fix clean build of generate-order-file
Alexander Shaposhnikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 28 21:33:16 PST 2016
alexshap created this revision.
alexshap added reviewers: beanz, bogner.
alexshap added a subscriber: cfe-commits.
alexshap set the repository for this revision to rL LLVM.
Herald added a subscriber: mgorny.
This diff fixes the clean build of the target generate-order-file.
In llvm/tools/clang/CMakeLists.txt
add_subdirectory(utils/perf-training) should go after the block where
the value of the variable CLANG_ORDER_FILE is set - otherwise
(tested with cmake's version 3.6.2) the arguments of perf-helper.py gen-order-file
will be ill-formed (CLANG_ORDER_FILE will be empty).
Repository:
rL LLVM
https://reviews.llvm.org/D28153
Files:
CMakeLists.txt
utils/perf-training/CMakeLists.txt
Index: utils/perf-training/CMakeLists.txt
===================================================================
--- utils/perf-training/CMakeLists.txt
+++ utils/perf-training/CMakeLists.txt
@@ -56,6 +56,10 @@
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/perf-helper.py clean ${CMAKE_CURRENT_BINARY_DIR} dtrace
COMMENT "Clearing old dtrace data")
+ if (NOT CLANG_ORDER_FILE)
+ message(FATAL_ERROR "Output clang order file is not set")
+ endif()
+
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}
COMMENT "Generating order file"
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -421,6 +421,29 @@
endif()
add_subdirectory(examples)
+if(APPLE)
+ # 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 "")
+ unset(CLANG_ORDER_FILE CACHE)
+ unset(CLANG_ORDER_FILE)
+ endif()
+
+
+ set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
+ "Order file to use when compiling clang in order to improve startup time (Darwin Only - requires ld64).")
+
+ if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
+ string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
+ if(PATH_START EQUAL 0)
+ file(WRITE ${CLANG_ORDER_FILE} "\n")
+ else()
+ message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not exist.")
+ endif()
+ endif()
+endif()
+
+
if( CLANG_INCLUDE_TESTS )
if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
@@ -455,29 +478,6 @@
add_subdirectory(docs)
endif()
-
-if(APPLE)
- # 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 "")
- unset(CLANG_ORDER_FILE CACHE)
- unset(CLANG_ORDER_FILE)
- endif()
-
-
- set(CLANG_ORDER_FILE ${CMAKE_CURRENT_BINARY_DIR}/clang.order CACHE FILEPATH
- "Order file to use when compiling clang in order to improve startup time (Darwin Only - requires ld64).")
-
- if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE})
- string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START)
- if(PATH_START EQUAL 0)
- file(WRITE ${CLANG_ORDER_FILE} "\n")
- else()
- message(FATAL_ERROR "Specified order file '${CLANG_ORDER_FILE}' does not exist.")
- endif()
- endif()
-endif()
-
add_subdirectory(cmake/modules)
if(CLANG_STAGE)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28153.82649.patch
Type: text/x-patch
Size: 2773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161229/c73473d1/attachment.bin>
More information about the cfe-commits
mailing list