mirror of
https://github.com/boostorg/dll.git
synced 2026-07-21 13:13:30 +00:00
feat boost.dll: support import std (#112)
The PR adds support `import std` and CI tests for the usage
This commit is contained in:
@@ -105,6 +105,25 @@ jobs:
|
||||
./b2 -d0 headers
|
||||
./b2 -j4 variant=debug tools/inspect
|
||||
|
||||
- name: Run modules tests
|
||||
if: ${{matrix.toolset == 'clang-19'}}
|
||||
run: |
|
||||
cd ../boost-root/libs/$LIBRARY
|
||||
cmake -S test/cmake_subdir_test -B __build \
|
||||
-GNinja \
|
||||
-DBUILD_TESTING=1 \
|
||||
-DBOOST_DLL_USE_STD_FS=1 \
|
||||
-DBOOST_USE_MODULES=1 \
|
||||
-DCMAKE_CXX_COMPILER=${{matrix.compiler}} \
|
||||
-DCMAKE_CXX_FLAGS="-stdlib=libc++" \
|
||||
-DCMAKE_CXX_STANDARD=23 \
|
||||
-DCMAKE_CXX_MODULE_STD=ON \
|
||||
-DCMAKE_EXPERIMENTAL_CXX_IMPORT_STD=0e5b6991-d74f-4b3d-a41c-cf096e0b2508
|
||||
|
||||
cmake --build __build
|
||||
ctest --test-dir __build --output-on-failure --no-tests=error -VV
|
||||
rm -rf __build
|
||||
|
||||
- name: Run modules tests without 'import std;'
|
||||
if: ${{matrix.toolset == 'clang-19'}}
|
||||
run: |
|
||||
|
||||
+12
-1
@@ -54,7 +54,18 @@ target_link_libraries(boost_dll_boost_fs
|
||||
if (BOOST_USE_MODULES)
|
||||
add_library(boost_dll)
|
||||
target_compile_definitions(boost_dll PUBLIC BOOST_USE_MODULES)
|
||||
target_compile_features(boost_dll PUBLIC cxx_std_20)
|
||||
|
||||
get_property(__standard TARGET boost_dll PROPERTY CXX_STANDARD)
|
||||
if (__standard IN_LIST CMAKE_CXX_COMPILER_IMPORT_STD AND CMAKE_CXX_MODULE_STD)
|
||||
target_compile_features(boost_dll PUBLIC cxx_std_23)
|
||||
target_compile_definitions(boost_dll PRIVATE BOOST_DLL_USE_STD_MODULE)
|
||||
message(STATUS "Using `import std;`")
|
||||
else()
|
||||
target_compile_features(boost_dll PUBLIC cxx_std_20)
|
||||
message(STATUS "`import std;` is not available")
|
||||
endif()
|
||||
unset(__standard)
|
||||
|
||||
target_sources(boost_dll
|
||||
PUBLIC
|
||||
FILE_SET CXX_MODULES
|
||||
|
||||
@@ -47,8 +47,10 @@ using system_error = std::conditional_t<BOOST_DLL_USE_STD_FS, std::system_error,
|
||||
#ifdef BOOST_DLL_USE_STD_FS
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <filesystem>
|
||||
#include <system_error>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace fs {
|
||||
@@ -94,7 +96,9 @@ namespace boost { namespace dll { namespace detail {
|
||||
#else // BOOST_DLL_USE_STD_FS
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <memory>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <cstring> // std::memcpy
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#if defined(__GNUC__) && defined(__GNUC_MINOR__) && (__GNUC__ * 100 + __GNUC_MINOR__ > 301)
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
#include <boost/dll/config.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#if defined(_MSC_VER) // MSVC, Clang-cl, and ICC on Windows
|
||||
|
||||
@@ -8,9 +8,11 @@
|
||||
#define BOOST_DLL_DETAIL_DEMANGLING_ITANIUM_HPP_
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/detail/demangling/mangled_storage_base.hpp>
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#include <boost/type_index/ctti_type_index.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/detail/demangling/demangle_symbol.hpp>
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#include <boost/core/detail/string_view.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/detail/demangling/mangled_storage_base.hpp>
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace experimental { namespace detail {
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <string> // for std::getline
|
||||
#include <vector>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <fstream>
|
||||
#include <string> // for std::getline
|
||||
#include <vector>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
# include <mach-o/dyld.h>
|
||||
# include <mach-o/nlist.h>
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
# include <cstddef> // for std::ptrdiff_t
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
#if BOOST_OS_MACOS || BOOST_OS_IOS
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <string>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <mach-o/dyld.h>
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
@@ -51,7 +53,9 @@ namespace boost { namespace dll { namespace detail {
|
||||
#elif BOOST_OS_SOLARIS
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <stdlib.h>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
@@ -65,10 +69,12 @@ namespace boost { namespace dll { namespace detail {
|
||||
#elif BOOST_OS_BSD_FREE
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <string>
|
||||
#include <stdlib.h>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <stdlib.h>
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
@@ -133,8 +139,10 @@ namespace boost { namespace dll { namespace detail {
|
||||
#elif BOOST_OS_QNX
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <fstream>
|
||||
#include <string> // for std::getline
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
#include <boost/predef/os.h>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <utility> // std::move
|
||||
#include <cstring> // strncmp
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include <cstring> // strncmp
|
||||
#if !BOOST_OS_MACOS && !BOOST_OS_IOS && !BOOST_OS_QNX && !BOOST_OS_CYGWIN
|
||||
# include <link.h>
|
||||
#elif BOOST_OS_QNX
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
# include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <system_error>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
|
||||
@@ -16,8 +16,10 @@
|
||||
# include <boost/winapi/basic_types.hpp>
|
||||
# endif
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <typeinfo>
|
||||
#include <cstring>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
namespace boost { namespace dll { namespace detail {
|
||||
|
||||
@@ -10,16 +10,19 @@
|
||||
|
||||
#include <boost/dll/config.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
# pragma once
|
||||
#endif
|
||||
#include <boost/dll/shared_library_load_mode.hpp>
|
||||
#include <boost/dll/detail/aggressive_ptr_cast.hpp>
|
||||
#include <boost/dll/detail/system_error.hpp>
|
||||
#include <boost/dll/detail/windows/path_from_handle.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#include <boost/core/invoke_swap.hpp>
|
||||
|
||||
#include <boost/winapi/dll.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <utility> // std::move
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/shared_library_load_mode.hpp>
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <memory> // std::addressof
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/config.hpp>
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <memory>
|
||||
#include <utility> // std::move
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/smart_library.hpp>
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <memory> // std::addressof
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/config.hpp>
|
||||
#include <boost/dll/smart_library.hpp>
|
||||
#include <boost/dll/detail/import_mangled_helpers.hpp>
|
||||
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
#include <boost/predef/architecture.h>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <fstream>
|
||||
#include <type_traits>
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/detail/pe_info.hpp>
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
#include <boost/predef/os.h>
|
||||
#include <boost/predef/compiler/visualc.h>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <memory> // std::addressof
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#if BOOST_OS_WINDOWS
|
||||
|
||||
@@ -27,8 +27,10 @@
|
||||
#include <boost/core/enable_if.hpp>
|
||||
#include <boost/core/explicit_operator_bool.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <type_traits>
|
||||
#include <utility> // std::move
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#include <boost/dll/detail/system_error.hpp>
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
#include <boost/dll/config.hpp>
|
||||
|
||||
#if !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
#if !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#include <type_traits>
|
||||
#include <utility> // std::move
|
||||
#endif // !defined(BOOST_DLL_USE_STD_MODULE)
|
||||
#endif // !defined(BOOST_DLL_INTERFACE_UNIT)
|
||||
|
||||
#if (__cplusplus < 201103L) && (!defined(_MSVC_LANG) || _MSVC_LANG < 201103L)
|
||||
|
||||
@@ -16,8 +16,10 @@ module;
|
||||
#include <boost/type_index/ctti_type_index.hpp>
|
||||
|
||||
#ifdef BOOST_DLL_USE_STD_FS
|
||||
# ifndef BOOST_DLL_USE_STD_MODULE
|
||||
# include <filesystem>
|
||||
# include <system_error>
|
||||
# endif
|
||||
#else
|
||||
# include <boost/filesystem/path.hpp>
|
||||
# include <boost/filesystem/operations.hpp>
|
||||
@@ -30,12 +32,14 @@ module;
|
||||
# include <link.h>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_DLL_USE_STD_MODULE
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#endif
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#include <boost/core/demangle.hpp>
|
||||
@@ -45,6 +49,10 @@ module;
|
||||
|
||||
export module boost.dll;
|
||||
|
||||
#ifdef BOOST_DLL_USE_STD_MODULE
|
||||
import std;
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic ignored "-Winclude-angled-in-module-purview"
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
module;
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <my_plugin_api.hpp>
|
||||
|
||||
export module sample_plugin;
|
||||
|
||||
Reference in New Issue
Block a user