2011-12-18 16:27:59 +08:00
|
|
|
set(LLVM_SOURCE_DIR "${LLVM_MAIN_SRC_DIR}")
|
|
|
|
set(LLVM_BINARY_DIR "${LLVM_BINARY_DIR}")
|
|
|
|
set(LLVM_BUILD_MODE "%(build_mode)s")
|
|
|
|
set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s")
|
|
|
|
set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib/%(build_config)s")
|
|
|
|
set(CLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..")
|
|
|
|
set(CLANG_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
|
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
set(ENABLE_SHARED 1)
|
|
|
|
else()
|
|
|
|
set(ENABLE_SHARED 0)
|
|
|
|
endif(BUILD_SHARED_LIBS)
|
|
|
|
|
2013-01-13 09:09:51 +08:00
|
|
|
configure_lit_site_cfg(
|
2011-12-18 16:27:59 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
2013-07-24 07:42:17 +08:00
|
|
|
configure_lit_site_cfg(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
|
|
|
)
|
2011-12-18 16:27:59 +08:00
|
|
|
|
2012-08-01 02:44:52 +08:00
|
|
|
if ( NOT LLD_BUILT_STANDALONE )
|
|
|
|
|
|
|
|
set(LLD_TEST_DEPS
|
|
|
|
FileCheck not llvm-nm
|
2014-10-17 20:55:58 +08:00
|
|
|
lld llvm-config llvm-objdump llvm-readobj yaml2obj obj2yaml
|
2014-10-28 14:30:34 +08:00
|
|
|
linker-script-test macho-dump llvm-mc
|
2013-07-17 02:46:48 +08:00
|
|
|
LLDUnitTests
|
2012-08-01 02:44:52 +08:00
|
|
|
)
|
|
|
|
set(LLD_TEST_PARAMS
|
|
|
|
lld_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
)
|
|
|
|
|
2013-07-24 07:42:17 +08:00
|
|
|
add_lit_testsuite(check-lld "Running lld test suite"
|
2012-08-01 02:44:52 +08:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
2013-07-24 07:42:17 +08:00
|
|
|
PARAMS lld_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
lld_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
2012-08-01 02:44:52 +08:00
|
|
|
DEPENDS ${LLD_TEST_DEPS}
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(check-lld PROPERTIES FOLDER "lld tests")
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
include(FindPythonInterp)
|
|
|
|
if (PYTHONINTERP_FOUND)
|
|
|
|
if (LLVM_MAIN_SRC_DIR)
|
|
|
|
set(LIT "${LLVM_SOURCE_DIR}/utils/lit/lit.py")
|
|
|
|
else()
|
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/${CMAKE_CFG_INTDIR}/llvm-lit")
|
|
|
|
# Installed LLVM does not contain ${CMAKE_CFG_INTDIR} in paths.
|
|
|
|
if (NOT EXISTS ${LIT})
|
|
|
|
set(LIT "${PATH_TO_LLVM_BUILD}/bin/llvm-lit")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (PATH_TO_LLVM_BUILD)
|
|
|
|
set(LLD_TEST_EXTRA_ARGS "--path=${LLD_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}")
|
2011-12-18 16:27:59 +08:00
|
|
|
endif()
|
|
|
|
|
2012-08-01 02:44:52 +08:00
|
|
|
set(LIT_ARGS "${LLD_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}")
|
|
|
|
separate_arguments(LIT_ARGS)
|
|
|
|
|
|
|
|
add_custom_target(lld-test.deps)
|
|
|
|
set_target_properties(lld-test.deps PROPERTIES FOLDER "lld tests")
|
|
|
|
|
|
|
|
add_custom_target(check-lld
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE}
|
|
|
|
${LIT}
|
|
|
|
--param lld_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
|
|
|
--param build_config=${CMAKE_CFG_INTDIR}
|
|
|
|
--param build_mode=${RUNTIME_BUILD_MODE}
|
|
|
|
${LIT_ARGS}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
COMMENT "Running lld regression tests"
|
2013-04-05 02:59:24 +08:00
|
|
|
DEPENDS lld-test.deps
|
2012-08-01 02:44:52 +08:00
|
|
|
)
|
|
|
|
set_target_properties(check-lld PROPERTIES FOLDER "lld tests")
|
2011-12-18 16:27:59 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|
2012-08-01 02:44:52 +08:00
|
|
|
|
|
|
|
# Add a legacy target spelling: lld-test
|
|
|
|
add_custom_target(lld-test)
|
|
|
|
add_dependencies(lld-test check-lld)
|
|
|
|
set_target_properties(lld-test PROPERTIES FOLDER "lld tests")
|