build_llvm.cmake 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. # This script downloads LLVM source and builds it with Visual Studio.
  2. include("${CMAKE_CURRENT_LIST_DIR}/helpers.cmake")
  3. function(build_llvm CONFIGURATION)
  4. if (CONFIGURATION STREQUAL "Release")
  5. set(ASSERTS OFF)
  6. set(CONFIG "Release")
  7. elseif (CONFIGURATION STREQUAL "Debug")
  8. set(ASSERTS ON)
  9. set(CONFIG "RelWithDebInfo")
  10. else()
  11. message(FATAL_ERROR "Wrong configuration")
  12. endif()
  13. set(INSTALL_DIR "${INSTALL_DIR}/win64/${CONFIGURATION}")
  14. execute_process(COMMAND cmake ${SOURCE_DIR} -G "Visual Studio 14 2015 Win64"
  15. -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
  16. -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_TOOLS=OFF
  17. -DLLVM_ENABLE_ASSERTIONS=${ASSERTS}
  18. WORKING_DIRECTORY ${BUILD_DIR})
  19. execute_process(COMMAND cmake --build ${BUILD_DIR}
  20. --target install --config ${CONFIG})
  21. endfunction(build_llvm)
  22. prepare_package_source(llvm 3.8.0 http://llvm.org/releases/3.8.0/llvm-3.8.0.src.tar.xz)
  23. build_llvm("Release")
  24. # build_llvm("Debug")
  25. create_package(${PACKAGE_NAME} ${INSTALL_DIR})