| OLD | NEW |
| 1 cmake_minimum_required(VERSION 2.8.8) | 1 cmake_minimum_required(VERSION 2.8.8) |
| 2 project(ChromeExtras) | 2 project(ChromeExtras) |
| 3 enable_testing() | 3 enable_testing() |
| 4 | 4 |
| 5 list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake") | 5 list(APPEND CMAKE_MODULE_PATH "${LLVM_BUILD_DIR}/share/llvm/cmake") |
| 6 | 6 |
| 7 # These tools are built using LLVM's build system, not Chromium's. | 7 # These tools are built using LLVM's build system, not Chromium's. |
| 8 # It expects LLVM_SRC_DIR and LLVM_BUILD_DIR to be set. | 8 # The build script generates a shim CMakeLists.txt in the LLVM source tree, |
| 9 # For example: | 9 # which simply forwards to this file. |
| 10 # | |
| 11 # cmake -GNinja \ | |
| 12 # -DLLVM_BUILD_DIR=$CHROMIUM_SRC_DIR/third_party/llvm-build/Release+Asserts \ | |
| 13 # -DLLVM_SRC_DIR=$CHROMIUM_SRC_DIR/third_party/llvm \ | |
| 14 # -DCHROMIUM_TOOLS=blink_gc_plugin;plugin \ | |
| 15 # $CHROMIUM_SRC_DIR/tools/clang/ | |
| 16 # ninja | |
| 17 | 10 |
| 18 | 11 |
| 19 include(LLVMConfig) | |
| 20 include(AddLLVM) | |
| 21 include(HandleLLVMOptions) | |
| 22 | |
| 23 # Use rpath to find the bundled standard C++ library. | 12 # Use rpath to find the bundled standard C++ library. |
| 24 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) | 13 set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) |
| 25 if (APPLE) | 14 if (APPLE) |
| 26 set(CMAKE_INSTALL_NAME_DIR "@rpath") | 15 set(CMAKE_INSTALL_NAME_DIR "@rpath") |
| 27 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") | 16 set(CMAKE_INSTALL_RPATH "@executable_path/../lib") |
| 28 else(UNIX) | 17 else(UNIX) |
| 29 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") | 18 set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib") |
| 30 endif() | 19 endif() |
| 31 | 20 |
| 32 set(LLVM_RUNTIME_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin") | 21 include_directories("${CMAKE_SOURCE_DIR}/include" |
| 33 set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib") | 22 "${CMAKE_SOURCE_DIR}/tools/clang/include" |
| 23 "${CMAKE_BINARY_DIR}/include" |
| 24 "${CMAKE_BINARY_DIR}/tools/clang/include") |
| 34 | 25 |
| 35 include_directories("${LLVM_SRC_DIR}/include" | 26 link_directories("${CMAKE_SOURCE_DIR}/lib" |
| 36 "${LLVM_SRC_DIR}/tools/clang/include" | 27 "${CMAKE_SOURCE_DIR}/tools/clang/lib" |
| 37 "${LLVM_BUILD_DIR}/include" | 28 "${CMAKE_BINARY_DIR}/lib" |
| 38 "${LLVM_BUILD_DIR}/tools/clang/include") | 29 "${CMAKE_BINARY_DIR}/tools/clang/lib") |
| 39 | |
| 40 link_directories("${LLVM_SRC_DIR}/lib" | |
| 41 "${LLVM_SRC_DIR}/tools/clang/lib" | |
| 42 "${LLVM_BUILD_DIR}/lib" | |
| 43 "${LLVM_BUILD_DIR}/tools/clang/lib") | |
| 44 | 30 |
| 45 # cr_add_test( | 31 # cr_add_test( |
| 46 # name | 32 # name |
| 47 # testprog | 33 # testprog |
| 48 # arguments... | 34 # arguments... |
| 49 # ) | 35 # ) |
| 50 function(cr_add_test name testprog) | 36 function(cr_add_test name testprog) |
| 51 add_test(NAME ${name} COMMAND ${testprog} ${ARGN}) | 37 add_test(NAME ${name} COMMAND ${testprog} ${ARGN}) |
| 52 add_dependencies(check-all ${name}) | 38 add_dependencies(cr-check-all ${name}) |
| 53 endfunction(cr_add_test) | 39 endfunction(cr_add_test) |
| 54 | 40 |
| 55 # Tests for all enabled tools can be run by building this target. | 41 # Tests for all enabled tools can be run by building this target. |
| 56 add_custom_target(check-all COMMAND ${CMAKE_CTEST_COMMAND} -V) | 42 add_custom_target(cr-check-all COMMAND ${CMAKE_CTEST_COMMAND} -V) |
| 43 |
| 44 function(cr_install) |
| 45 install(${ARGN} COMPONENT chrome-tools OPTIONAL) |
| 46 endfunction(cr_install) |
| 47 |
| 48 # Custom install target, so the chrome tools can be installed without installing |
| 49 # all the other LLVM targets. |
| 50 add_custom_target(cr-install COMMAND |
| 51 ${CMAKE_COMMAND} -D COMPONENT=chrome-tools -P cmake_install.cmake) |
| 57 | 52 |
| 58 foreach(tool ${CHROMIUM_TOOLS}) | 53 foreach(tool ${CHROMIUM_TOOLS}) |
| 59 add_subdirectory(${tool}) | 54 add_subdirectory(${tool}) |
| 60 endforeach(tool) | 55 endforeach(tool) |
| OLD | NEW |