config.debug_build = @LIBCXX_DEBUG_BUILD@
config.libcxxabi_shared = @LIBCXXABI_ENABLE_SHARED@
config.cxx_ext_threads = @LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY@
-config.pstl_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
+config.pstl_src_root = "@ParallelSTL_SOURCE_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
+config.pstl_obj_root = "@ParallelSTL_BINARY_DIR@" if @LIBCXX_ENABLE_PARALLEL_ALGORITHMS@ else None
# Let the main config do the real work.
config.loaded_site_config = True
self.cxx.compile_flags += ['-I' + support_path]
# Add includes for the PSTL headers
- pstl_root = self.get_lit_conf('pstl_root')
- if pstl_root is not None:
- self.cxx.compile_flags += ['-I' + os.path.join(pstl_root, 'include')]
- self.cxx.compile_flags += ['-I' + os.path.join(pstl_root, 'test')]
+ pstl_src_root = self.get_lit_conf('pstl_src_root')
+ pstl_obj_root = self.get_lit_conf('pstl_obj_root')
+ if pstl_src_root is not None and pstl_obj_root is not None:
+ self.cxx.compile_flags += ['-I' + os.path.join(pstl_src_root, 'include')]
+ self.cxx.compile_flags += ['-I' + os.path.join(pstl_obj_root, 'generated_headers')]
+ self.cxx.compile_flags += ['-I' + os.path.join(pstl_src_root, 'test')]
self.config.available_features.add('parallel-algorithms')
# FIXME(EricWF): variant_size.pass.cpp requires a slightly larger
if (PARALLELSTL_BACKEND STREQUAL "serial")
message(STATUS "Parallel STL uses the serial backend")
- target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_SERIAL)
+ set(_PSTL_PAR_BACKEND_SERIAL ON)
elseif (PARALLELSTL_BACKEND STREQUAL "tbb")
find_package(TBB 2018 REQUIRED tbb OPTIONAL_COMPONENTS tbbmalloc)
message(STATUS "Parallel STL uses TBB ${TBB_VERSION} (interface version: ${TBB_INTERFACE_VERSION})")
target_link_libraries(ParallelSTL INTERFACE TBB::tbb)
- target_compile_definitions(ParallelSTL INTERFACE -D_PSTL_PAR_BACKEND_TBB)
+ set(_PSTL_PAR_BACKEND_TBB ON)
else()
message(FATAL_ERROR "Requested unknown Parallel STL backend '${PARALLELSTL_BACKEND}'.")
endif()
+set(PSTL_GENERATED_HEADERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated_headers")
+set(PSTL_CONFIG_SITE_PATH "${PSTL_GENERATED_HEADERS_DIR}/__pstl_config_site")
+configure_file("include/__pstl_config_site.in"
+ "${PSTL_CONFIG_SITE_PATH}"
+ @ONLY)
+
target_include_directories(ParallelSTL
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${PSTL_GENERATED_HEADERS_DIR}>
$<INSTALL_INTERFACE:include>)
###############################################################################
DESTINATION lib/cmake/ParallelSTL)
install(DIRECTORY include/
DESTINATION include)
+install(FILES "${PSTL_CONFIG_SITE_PATH}"
+ DESTINATION include)
add_custom_target(install-pstl
COMMAND "${CMAKE_COMMAND}" -P "${PROJECT_BINARY_DIR}/cmake_install.cmake" -DCOMPONENT=ParallelSTL)
--- /dev/null
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __PSTL_CONFIG_SITE
+#define __PSTL_CONFIG_SITE
+
+#cmakedefine _PSTL_PAR_BACKEND_SERIAL
+#cmakedefine _PSTL_PAR_BACKEND_TBB
+
+#endif // __PSTL_CONFIG_SITE
#ifndef _PSTL_CONFIG_H
#define _PSTL_CONFIG_H
+#include <__pstl_config_site>
+
// The version is XYYZ, where X is major, YY is minor, and Z is patch (i.e. X.YY.Z)
#define _PSTL_VERSION 10000
#define _PSTL_VERSION_MAJOR (_PSTL_VERSION / 1000)