2014-01-07 14:57:25 +04:00
#------------------------------------------------------------------------------
# CLING - the C++ LLVM-based InterpreterG :)
#
# This file is dual-licensed: you can choose to license it under the University
# of Illinois Open Source License or the GNU Lesser General Public License. See
# LICENSE.TXT for details.
#------------------------------------------------------------------------------
2013-05-03 16:14:17 +04:00
set ( CLING_TEST_DIRECTORIES
" E r r o r R e c o v e r y "
" E x t e n s i o n s "
" L i b r a r y C a l l "
2013-07-21 17:10:53 +04:00
" N u l l D e r e f "
2013-05-03 16:14:17 +04:00
" P r o m p t "
" R e c u r s i o n "
" S o u r c e C a l l " )
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 ( CLING_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.." )
set ( CLING_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/.." )
2016-01-12 13:43:51 +03:00
set ( TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}" )
set ( TARGET_SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}" )
2013-05-03 16:14:17 +04:00
if ( BUILD_SHARED_LIBS )
set ( ENABLE_SHARED 1 )
else ( )
set ( ENABLE_SHARED 0 )
endif ( BUILD_SHARED_LIBS )
configure_file (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / l i t . s i t e . c f g . i n
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / l i t . s i t e . c f g )
#configure_file(
# ${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.in
# ${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
# @ONLY)
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 ( CLING_TEST_EXTRA_ARGS "--path=${CLING_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}" )
endif ( )
option ( CLING_TEST_USE_VG "Run Cling tests under Valgrind" OFF )
if ( CLING_TEST_USE_VG )
set ( CLING_TEST_EXTRA_ARGS ${ CLING_TEST_EXTRA_ARGS } "--vg" )
endif ( )
set ( LIT_ARGS "${CLING_TEST_EXTRA_ARGS} ${LLVM_LIT_ARGS}" )
separate_arguments ( LIT_ARGS )
add_custom_target ( cling-test.deps )
set_target_properties ( cling-test.deps PROPERTIES FOLDER "Cling tests" )
2016-07-08 12:16:27 +03:00
add_custom_target ( check-cling
2013-05-03 16:14:17 +04:00
C O M M A N D $ { P Y T H O N _ E X E C U T A B L E }
$ { L I T }
2015-03-30 23:47:05 +03:00
- - p a r a m c l i n g _ s i t e _ c o n f i g = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / l i t . s i t e . c f g
2013-05-03 16:14:17 +04:00
- - p a r a m c l i n g _ u n i t _ s i t e _ c o n f i g = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / U n i t / l i t . s i t e . c f g
- - p a r a m b u i l d _ c o n f i g = $ { C M A K E _ C F G _ I N T D I R }
- - p a r a m b u i l d _ m o d e = $ { R U N T I M E _ B U I L D _ M O D E }
$ { L I T _ A R G S }
2015-03-30 23:47:05 +03:00
\ $ \ ( i f $ ( T E S T D I R S ) , $ ( T E S T D I R S ) , . \ )
2013-05-03 16:14:17 +04:00
C O M M E N T " R u n n i n g C l i n g r e g r e s s i o n t e s t s " )
2016-07-08 12:16:27 +03:00
# Add a legacy target spelling: cling-test
add_custom_target ( cling-test )
add_dependencies ( cling-test check-cling )
2015-03-13 20:25:21 +03:00
add_custom_command ( OUTPUT cling-headers.stamp
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / l l v m
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / l l v m
2015-04-01 11:04:36 +03:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / l l v m - c
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / l l v m - c
2015-03-13 20:25:21 +03:00
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / . . / . . / l l v m / s r c / t o o l s / c l a n g / i n c l u d e / c l a n g
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / c l a n g
C O M M A N D $ { C M A K E _ C O M M A N D } - E c o p y _ d i r e c t o r y
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / . . / . . / l l v m / s r c / t o o l s / c l a n g / i n c l u d e / c l a n g
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / . . / . . / l l v m / s r c / i n c l u d e / c l a n g
C O M M A N D $ { C M A K E _ C O M M A N D } - E t o u c h c l i n g - h e a d e r s . s t a m p )
add_custom_target ( cling-headers DEPENDS cling-headers.stamp )
2013-05-03 16:14:17 +04:00
# if( NOT CLING_BUILT_STANDALONE )
# add_custom_target(check-all
# COMMAND ${PYTHON_EXECUTABLE}
# ${LIT}
# --param build_config=${CMAKE_CFG_INTDIR}
# --param build_mode=${RUNTIME_BUILD_MODE}
# ${LIT_ARGS}
# ${LLVM_BINARY_DIR}/test
# ${CMAKE_CURRENT_BINARY_DIR}
# COMMENT "Running Cling and LLVM regression tests")
# add_dependencies(check-all cling-test.deps)
# if ( LLVM_INCLUDE_TESTS )
# add_dependencies(cling-test.deps ClangUnitTests)
# add_dependencies(check-all check.deps)
# endif ( LLVM_INCLUDE_TESTS )
# add_dependencies(cling-test.deps
# llvm-dis llc opt
# FileCheck count not
# )
# endif()
add_dependencies ( cling-test cling-test.deps )
add_dependencies ( cling-test.deps
2015-12-09 23:02:03 +03:00
c l i n g c l a n g F i l e C h e c k c - i n d e x - t e s t d i a g t o o l a r c m t - t e s t c - a r c m t - t e s t )
2013-05-03 16:14:17 +04:00
endif ( )