55 lines
1.6 KiB
CMake
55 lines
1.6 KiB
CMake
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
message(STATUS "Building tests with Clang")
|
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
message(STATUS "Building tests with GCC; modules support is experimental")
|
|
else()
|
|
message(WARNING "Unsupported compiler for test modules: ${CMAKE_CXX_COMPILER_ID}. Build may fail.")
|
|
endif()
|
|
|
|
if(WIN32)
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".lib" ".dll.a")
|
|
else()
|
|
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ".so")
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_ast/CMakeLists.txt)
|
|
add_subdirectory(test_ast)
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_lsp_any/CMakeLists.txt)
|
|
add_subdirectory(test_lsp_any)
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_symbol/CMakeLists.txt)
|
|
add_subdirectory(test_symbol)
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_scheduler/CMakeLists.txt)
|
|
add_subdirectory(test_scheduler)
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_semantic/CMakeLists.txt)
|
|
add_subdirectory(test_semantic)
|
|
endif()
|
|
|
|
# test_module 由顶层 add_subdirectory(test) 自动拉入,无需单独处理
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_module/CMakeLists.txt)
|
|
add_subdirectory(test_module)
|
|
endif()
|
|
|
|
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/test_provider/CMakeLists.txt)
|
|
add_subdirectory(test_provider)
|
|
endif()
|
|
|
|
if(BUILD_TESTS)
|
|
find_program(PYTHON3_EXECUTABLE python3)
|
|
if(PYTHON3_EXECUTABLE)
|
|
add_test(NAME test_lsp_json
|
|
COMMAND ${PYTHON3_EXECUTABLE}
|
|
${CMAKE_CURRENT_LIST_DIR}/run_lsp_json_tests.py
|
|
--server $<TARGET_FILE:tsl-server>)
|
|
else()
|
|
message(WARNING "python3 not found; skipping test_lsp_json registration")
|
|
endif()
|
|
endif()
|