[pstl] Initial integration with LLVM's CMake
Summary: This commit adds a check-pstl CMake target that will run the tests we currently have for pstl. Those tests are not using LLVM lit yet, but switching them over should be a transparent change. With this change, we can start relying on the `check-pstl` target for workflows and CI. Note that this commit purposefully does not support the pre-monorepo layout (with subprojects in projects/), since LLVM is moving towards the monorepo layout anyway. Reviewers: jfb Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits, mclow.lists, rodgert Differential Revision: https://reviews.llvm.org/D55963 llvm-svn: 349919
This commit is contained in:
parent
96c11eceb2
commit
5e334b516b
@ -31,6 +31,7 @@ if(${LLVM_BUILD_RUNTIME})
|
|||||||
# dependent projects can see the target names of their dependencies.
|
# dependent projects can see the target names of their dependencies.
|
||||||
add_llvm_external_project(libunwind)
|
add_llvm_external_project(libunwind)
|
||||||
add_llvm_external_project(libcxxabi)
|
add_llvm_external_project(libcxxabi)
|
||||||
|
add_llvm_external_project(pstl)
|
||||||
add_llvm_external_project(libcxx)
|
add_llvm_external_project(libcxx)
|
||||||
endif()
|
endif()
|
||||||
if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT)
|
if(NOT LLVM_BUILD_EXTERNAL_COMPILER_RT)
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
# Source Licenses. See LICENSE.TXT for details.
|
# Source Licenses. See LICENSE.TXT for details.
|
||||||
#
|
#
|
||||||
#===----------------------------------------------------------------------===##
|
#===----------------------------------------------------------------------===##
|
||||||
|
cmake_minimum_required(VERSION 3.4.3)
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.1)
|
set(PARALLELSTL_VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/include/pstl/internal/pstl_config.h")
|
||||||
|
|
||||||
set(PARALLELSTL_VERSION_FILE "include/pstl/internal/pstl_config.h")
|
|
||||||
file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define PSTL_VERSION .*$")
|
file(STRINGS "${PARALLELSTL_VERSION_FILE}" PARALLELSTL_VERSION_SOURCE REGEX "#define PSTL_VERSION .*$")
|
||||||
string(REGEX MATCH "#define PSTL_VERSION (.*)$" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
|
string(REGEX MATCH "#define PSTL_VERSION (.*)$" PARALLELSTL_VERSION_SOURCE "${PARALLELSTL_VERSION_SOURCE}")
|
||||||
math(EXPR VERSION_MAJOR "${PARALLELSTL_VERSION_SOURCE} / 100")
|
math(EXPR VERSION_MAJOR "${PARALLELSTL_VERSION_SOURCE} / 100")
|
||||||
@ -30,8 +30,6 @@ if (NOT TBB_DIR)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
||||||
|
|
||||||
add_library(ParallelSTL INTERFACE)
|
add_library(ParallelSTL INTERFACE)
|
||||||
add_library(pstl::ParallelSTL ALIAS ParallelSTL)
|
add_library(pstl::ParallelSTL ALIAS ParallelSTL)
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ endif()
|
|||||||
|
|
||||||
target_include_directories(ParallelSTL
|
target_include_directories(ParallelSTL
|
||||||
INTERFACE
|
INTERFACE
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include>)
|
$<INSTALL_INTERFACE:include>)
|
||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
@ -69,3 +67,6 @@ configure_file(
|
|||||||
|
|
||||||
export(TARGETS ParallelSTL NAMESPACE pstl:: FILE ParallelSTLTargets.cmake)
|
export(TARGETS ParallelSTL NAMESPACE pstl:: FILE ParallelSTLTargets.cmake)
|
||||||
export(PACKAGE ParallelSTL)
|
export(PACKAGE ParallelSTL)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(test)
|
||||||
|
@ -9,17 +9,6 @@
|
|||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
# Firstly search for TBB in config mode (i.e. search for TBBConfig.cmake).
|
|
||||||
find_package(TBB QUIET CONFIG)
|
|
||||||
if (TBB_FOUND)
|
|
||||||
find_package_handle_standard_args(TBB
|
|
||||||
REQUIRED_VARS TBB_IMPORTED_TARGETS
|
|
||||||
HANDLE_COMPONENTS
|
|
||||||
VERSION_VAR TBB_VERSION
|
|
||||||
CONFIG_MODE)
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT TBB_FIND_COMPONENTS)
|
if (NOT TBB_FIND_COMPONENTS)
|
||||||
set(TBB_FIND_COMPONENTS tbb tbbmalloc)
|
set(TBB_FIND_COMPONENTS tbb tbbmalloc)
|
||||||
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
|
foreach (_tbb_component ${TBB_FIND_COMPONENTS})
|
||||||
|
34
pstl/test/CMakeLists.txt
Normal file
34
pstl/test/CMakeLists.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#===-- CMakeLists.txt ----------------------------------------------------===##
|
||||||
|
#
|
||||||
|
# The LLVM Compiler Infrastructure
|
||||||
|
#
|
||||||
|
# This file is dual licensed under the MIT and the University of Illinois Open
|
||||||
|
# Source Licenses. See LICENSE.TXT for details.
|
||||||
|
#
|
||||||
|
#===----------------------------------------------------------------------===##
|
||||||
|
|
||||||
|
# TODO(ldionne): This CMake testing infrastructure should be replaced with a
|
||||||
|
# llvm-lit test suite.
|
||||||
|
|
||||||
|
add_custom_target(pstl-build-tests
|
||||||
|
COMMENT "Build all the pstl tests.")
|
||||||
|
|
||||||
|
add_custom_target(check-pstl
|
||||||
|
COMMAND "${CMAKE_CTEST_COMMAND}" --output-on-failure
|
||||||
|
USES_TERMINAL
|
||||||
|
DEPENDS pstl-build-tests
|
||||||
|
COMMENT "Build and run all the unit tests.")
|
||||||
|
|
||||||
|
file(GLOB_RECURSE UNIT_TESTS "test_*.cpp")
|
||||||
|
foreach(_file IN LISTS UNIT_TESTS)
|
||||||
|
file(RELATIVE_PATH _target "${CMAKE_CURRENT_SOURCE_DIR}" "${_file}")
|
||||||
|
string(REPLACE ".cpp" "" _target "${_target}")
|
||||||
|
set(_target "pstl-${_target}")
|
||||||
|
|
||||||
|
add_executable(${_target} EXCLUDE_FROM_ALL "${_file}")
|
||||||
|
target_link_libraries(${_target} PRIVATE pstl::ParallelSTL)
|
||||||
|
set_target_properties(${_target} PROPERTIES CXX_EXTENSIONS NO
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
add_test(${_target} "${CMAKE_CURRENT_BINARY_DIR}/${_target}")
|
||||||
|
add_dependencies(pstl-build-tests ${_target})
|
||||||
|
endforeach()
|
Loading…
x
Reference in New Issue
Block a user