[PATCH] D28153: [clang] Fix clean build of generate-order-file
This revision was automatically updated to reflect the committed changes. Closed by commit rL290781: [clang] Fix clean build of generate-order-file (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D28153?vs=82715=82755#toc Repository: rL LLVM https://reviews.llvm.org/D28153 Files: cfe/trunk/CMakeLists.txt cfe/trunk/utils/perf-training/CMakeLists.txt Index: cfe/trunk/CMakeLists.txt === --- cfe/trunk/CMakeLists.txt +++ cfe/trunk/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(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) Index: cfe/trunk/utils/perf-training/CMakeLists.txt === --- cfe/trunk/utils/perf-training/CMakeLists.txt +++ cfe/trunk/utils/perf-training/CMakeLists.txt @@ -40,7 +40,7 @@ endif() find_program(DTRACE dtrace) -if(DTRACE) +if(APPLE AND DTRACE) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg @@ -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 $ --output ${CLANG_ORDER_FILE} ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating order file" Index: cfe/trunk/CMakeLists.txt === --- cfe/trunk/CMakeLists.txt +++ cfe/trunk/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(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
[PATCH] D28153: [clang] Fix clean build of generate-order-file
mehdi_amini accepted this revision. mehdi_amini added a comment. This revision is now accepted and ready to land. LGTM. https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
alexshap added inline comments. Comment at: utils/perf-training/CMakeLists.txt:61 +message(FATAL_ERROR "Output clang order file is not set") + endif() + alexshap wrote: > mehdi_amini wrote: > > I'm missing something: the code in the main CMakeLists seems to allows to > > have an empty value for the CLANG_ORDER_FILE? > if i understand correctly: CMakeLists.txt: lines 424 - 433: > 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 > > but the file (CLANG_ORDER_FILE) itself can be empty, not the variable. If > CLANG_ORDER_FILE is empty that command line won't be correct > i've added this check to catch potential issues here earlier. https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
alexshap removed rL LLVM as the repository for this revision. alexshap updated this revision to Diff 82715. alexshap added a comment. upd 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 @@ -40,7 +40,7 @@ endif() find_program(DTRACE dtrace) -if(DTRACE) +if(APPLE AND DTRACE) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg @@ -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 $ --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(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) Index: utils/perf-training/CMakeLists.txt === --- utils/perf-training/CMakeLists.txt +++ utils/perf-training/CMakeLists.txt @@ -40,7 +40,7 @@ endif() find_program(DTRACE dtrace) -if(DTRACE) +if(APPLE AND DTRACE) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg @@ -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 $ --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(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") +
[PATCH] D28153: [clang] Fix clean build of generate-order-file
mehdi_amini added a comment. I mean the two checks being out-of-sync is weird, so I rather have them reconciled. Repository: rL LLVM https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
alexshap added inline comments. Comment at: CMakeLists.txt:436 + + if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE}) +string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START) mehdi_amini wrote: > So why `if(CLANG_ORDER_FILE ` here? i don't know why originally it was this way, if my understanding is correct - you are right - if(CLANG_ORDER_FILE is not necessary here - this condition should be replaced just with if(NOT EXISTS ${CLANG_ORDER_FILE}) so yea, i can update this as well. In the first version of this patch i moved this entire block "as is" without changes. (this resolved the issue with the empty CLANG_ORDER_FILE in utils/perf-training/CMakeLists.txt). Repository: rL LLVM https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
mehdi_amini added inline comments. Comment at: CMakeLists.txt:436 + + if(CLANG_ORDER_FILE AND NOT EXISTS ${CLANG_ORDER_FILE}) +string(FIND "${CLANG_ORDER_FILE}" "${CMAKE_CURRENT_BINARY_DIR}" PATH_START) So why `if(CLANG_ORDER_FILE ` here? Repository: rL LLVM https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
alexshap added inline comments. Comment at: utils/perf-training/CMakeLists.txt:61 +message(FATAL_ERROR "Output clang order file is not set") + endif() + mehdi_amini wrote: > I'm missing something: the code in the main CMakeLists seems to allows to > have an empty value for the CLANG_ORDER_FILE? if i understand correctly: CMakeLists.txt: lines 424 - 433: 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 but the file (CLANG_ORDER_FILE) itself can be empty, not the variable. If CLANG_ORDER_FILE is empty that command line won't be correct Repository: rL LLVM https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
mehdi_amini added inline comments. Comment at: utils/perf-training/CMakeLists.txt:61 +message(FATAL_ERROR "Output clang order file is not set") + endif() + I'm missing something: the code in the main CMakeLists seems to allows to have an empty value for the CLANG_ORDER_FILE? Repository: rL LLVM https://reviews.llvm.org/D28153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D28153: [clang] Fix clean build of generate-order-file
alexshap updated this revision to Diff 82703. alexshap added a comment. minor changes 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 @@ -40,7 +40,7 @@ endif() find_program(DTRACE dtrace) -if(DTRACE) +if(APPLE AND DTRACE) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg @@ -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 $ --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) Index: utils/perf-training/CMakeLists.txt === --- utils/perf-training/CMakeLists.txt +++ utils/perf-training/CMakeLists.txt @@ -40,7 +40,7 @@ endif() find_program(DTRACE dtrace) -if(DTRACE) +if(APPLE AND DTRACE) configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/order-files.lit.site.cfg.in ${CMAKE_CURRENT_BINARY_DIR}/order-files/lit.site.cfg @@ -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 $ --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
[PATCH] D28153: [clang] Fix clean build of generate-order-file
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 $ --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) 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 $ --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) +