diff --git a/CMakeLists.txt b/CMakeLists.txt index c0c1bfef..01c1bc21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,12 +7,30 @@ cmake_minimum_required(VERSION 3.5...3.16) project(boost_process VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) -add_library(boost_process INTERFACE) +add_library(boost_process + src/detail/environment_posix.cpp + src/detail/environment_win.cpp + src/detail/last_error.cpp + src/detail/process_handle_windows.cpp + src/detail/throw_error.cpp + src/detail/utf8.cpp + src/ext/cmd.cpp + src/ext/cwd.cpp + src/ext/env.cpp + src/ext/exe.cpp + src/ext/proc_info.cpp + src/posix/close_handles.cpp + src/windows/default_launcher.cpp + src/environment.cpp + src/error.cpp + src/pid.cpp + src/shell.cpp) + add_library(Boost::process ALIAS boost_process) -target_include_directories(boost_process INTERFACE include) +target_include_directories(boost_process PUBLIC include) target_link_libraries(boost_process - INTERFACE + PUBLIC Boost::algorithm Boost::asio Boost::config @@ -28,6 +46,16 @@ target_link_libraries(boost_process Boost::winapi ) +target_compile_definitions(boost_process + PRIVATE BOOST_PROCESS_SOURCE=1 +) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(boost_process PUBLIC BOOST_PROCESS_DYN_LINK) +else() + target_compile_definitions(boost_process PUBLIC BOOST_PROCESS_STATIC_LINK) +endif() + if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") add_subdirectory(test) diff --git a/build/Jamfile b/build/Jamfile new file mode 100644 index 00000000..fe98df69 --- /dev/null +++ b/build/Jamfile @@ -0,0 +1,49 @@ +# Copyright (c) 2024 Klemens D. Morgenstern +# +# Distributed under the Boost Software License, Version 1.0. (See accompanying +# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +import os ; +import feature ; +import ../../config/checks/config : requires ; + +project : requirements + BOOST_ASIO_NO_DEPRECATED + msvc:_SCL_SECURE_NO_WARNINGS + msvc:_CRT_SECURE_NO_DEPRECATE + msvc:/bigobj + windows:WIN32_LEAN_AND_MEAN + linux:-lpthread + : source-location ../src +; + +alias process_sources + : detail/environment_posix.cpp + detail/environment_win.cpp + detail/last_error.cpp + detail/process_handle_windows.cpp + detail/throw_error.cpp + detail/utf8.cpp + ext/cmd.cpp + ext/cwd.cpp + ext/env.cpp + ext/exe.cpp + ext/proc_info.cpp + posix/close_handles.cpp + windows/default_launcher.cpp + environment.cpp + error.cpp + pid.cpp + shell.cpp + ; + +lib boost_process + : process_sources + : requirements BOOST_PROCESS_SOURCE=1 + shared:BOOST_PROCESS_DYN_LINK=1 + : usage-requirements + shared:BOOST_PROCESS_DYN_LINK=1 + + ; + +boost-install boost_process ; \ No newline at end of file diff --git a/include/boost/process/v2/default_launcher.hpp b/include/boost/process/v2/default_launcher.hpp index 42a26b72..a9557075 100644 --- a/include/boost/process/v2/default_launcher.hpp +++ b/include/boost/process/v2/default_launcher.hpp @@ -59,8 +59,5 @@ typedef posix::default_launcher default_process_launcher; BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -#include -#endif #endif //BOOST_PROCESS_V2_DEFAULT_LAUNCHER_HPP \ No newline at end of file diff --git a/include/boost/process/v2/detail/config.hpp b/include/boost/process/v2/detail/config.hpp index 7d76a0b9..a928f1e6 100644 --- a/include/boost/process/v2/detail/config.hpp +++ b/include/boost/process/v2/detail/config.hpp @@ -154,18 +154,14 @@ namespace filesystem = boost::filesystem; BOOST_PROCESS_V2_END_NAMESPACE -#ifndef BOOST_PROCESS_V2_HEADER_ONLY -# ifndef BOOST_PROCESS_V2_SEPARATE_COMPILATION -# define BOOST_PROCESS_V2_HEADER_ONLY 1 -# endif -#endif - -#if BOOST_PROCESS_V2_DOXYGEN -# define BOOST_PROCESS_V2_DECL -#elif defined(BOOST_PROCESS_V2_HEADER_ONLY) -# define BOOST_PROCESS_V2_DECL inline +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_PROCESS_V2_DYN_LINK) +#if defined(BOOST_PROCESS_V2_SOURCE) +#define BOOST_PROCESS_V2_DECL BOOST_SYMBOL_EXPORT #else -# define BOOST_PROCESS_V2_DECL +#define BOOST_PROCESS_V2_DECL BOOST_SYMBOL_IMPORT +#endif +#else +#define BOOST_PROCESS_V2_DECL #endif #if defined(BOOST_PROCESS_V2_POSIX) diff --git a/include/boost/process/v2/detail/impl/environment.ipp b/include/boost/process/v2/detail/impl/environment.ipp deleted file mode 100644 index 3dc1b661..00000000 --- a/include/boost/process/v2/detail/impl/environment.ipp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2022 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_IPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_IPP - -#include - -#if defined(BOOST_PROCESS_V2_WINDOWS) -#include -#elif defined(BOOST_PROCESS_V2_POSIX) -#include -#else -#error Operating System not supported. -#endif - -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_IPP diff --git a/include/boost/process/v2/detail/last_error.hpp b/include/boost/process/v2/detail/last_error.hpp index 6b2d70f6..bf92a441 100644 --- a/include/boost/process/v2/detail/last_error.hpp +++ b/include/boost/process/v2/detail/last_error.hpp @@ -18,11 +18,5 @@ BOOST_PROCESS_V2_DECL error_code get_last_error(); BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif //BOOST_PROCESS_V2_DETAIL_LAST_ERROR_HPP diff --git a/include/boost/process/v2/detail/process_handle_windows.hpp b/include/boost/process/v2/detail/process_handle_windows.hpp index 608d2ceb..a18443d1 100644 --- a/include/boost/process/v2/detail/process_handle_windows.hpp +++ b/include/boost/process/v2/detail/process_handle_windows.hpp @@ -303,9 +303,7 @@ struct basic_process_handle_win }; }; -#if !defined(BOOST_PROCESS_V2_HEADER_ONLY) extern template struct basic_process_handle_win<>; -#endif } diff --git a/include/boost/process/v2/detail/throw_error.hpp b/include/boost/process/v2/detail/throw_error.hpp index 4ddb682c..3409ff61 100644 --- a/include/boost/process/v2/detail/throw_error.hpp +++ b/include/boost/process/v2/detail/throw_error.hpp @@ -29,10 +29,5 @@ inline void throw_error(const error_code& err, const char* location) } BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif #endif //BOOST_PROCESS_V2_DETAIL_THROW_ERROR_HPP diff --git a/include/boost/process/v2/detail/utf8.hpp b/include/boost/process/v2/detail/utf8.hpp index edceeb05..86add628 100644 --- a/include/boost/process/v2/detail/utf8.hpp +++ b/include/boost/process/v2/detail/utf8.hpp @@ -85,11 +85,5 @@ std::basic_string conv_string( BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif //BOOST_PROCESS_V2_DETAIL_UTF8_HPP diff --git a/include/boost/process/v2/environment.hpp b/include/boost/process/v2/environment.hpp index f2c8aeb3..ec51f524 100644 --- a/include/boost/process/v2/environment.hpp +++ b/include/boost/process/v2/environment.hpp @@ -1888,12 +1888,4 @@ struct hash } - -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include -#include - -#endif - #endif //BOOST_PROCESS_V2_ENVIRONMENT_HPP diff --git a/include/boost/process/v2/error.hpp b/include/boost/process/v2/error.hpp index 621f032d..f80f7d98 100644 --- a/include/boost/process/v2/error.hpp +++ b/include/boost/process/v2/error.hpp @@ -41,10 +41,4 @@ static const error_category& exit_code_category = get_exit_code_category(); BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif //BOOST_PROCESS_V2_ERROR_HPP diff --git a/include/boost/process/v2/ext/cmd.hpp b/include/boost/process/v2/ext/cmd.hpp index 0e5b3427..494df858 100644 --- a/include/boost/process/v2/ext/cmd.hpp +++ b/include/boost/process/v2/ext/cmd.hpp @@ -61,11 +61,5 @@ BOOST_PROCESS_V2_DECL shell cmd(basic_process_handle & handle) BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif // BOOST_PROCESS_V2_CMD_HPP diff --git a/include/boost/process/v2/ext/cwd.hpp b/include/boost/process/v2/ext/cwd.hpp index e255d3dd..703b1ac3 100644 --- a/include/boost/process/v2/ext/cwd.hpp +++ b/include/boost/process/v2/ext/cwd.hpp @@ -7,9 +7,10 @@ #define BOOST_PROCESS_V2_CWD_HPP #include -#include +#include #include +#include BOOST_PROCESS_V2_BEGIN_NAMESPACE @@ -51,8 +52,4 @@ BOOST_PROCESS_V2_DECL filesystem::path cwd(basic_process_handle & hand BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -#include -#endif - #endif // BOOST_PROCESS_V2_CWD_HPP diff --git a/include/boost/process/v2/ext/detail/proc_info.hpp b/include/boost/process/v2/ext/detail/proc_info.hpp index c1c24fa3..2cbdd006 100644 --- a/include/boost/process/v2/ext/detail/proc_info.hpp +++ b/include/boost/process/v2/ext/detail/proc_info.hpp @@ -115,11 +115,5 @@ BOOST_PROCESS_V2_DECL HANDLE open_process_with_debug_privilege(boost::process::v BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif // BOOST_PROCESS_V2_DETAIL_PROC_INFO_HPP diff --git a/include/boost/process/v2/ext/env.hpp b/include/boost/process/v2/ext/env.hpp index 33ca2345..9a30a7fd 100644 --- a/include/boost/process/v2/ext/env.hpp +++ b/include/boost/process/v2/ext/env.hpp @@ -147,9 +147,4 @@ BOOST_PROCESS_V2_DECL env_view env(basic_process_handle & handle) BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif #endif // BOOST_PROCESS_V2_ENV_HPP diff --git a/include/boost/process/v2/ext/exe.hpp b/include/boost/process/v2/ext/exe.hpp index a809f950..54017a55 100644 --- a/include/boost/process/v2/ext/exe.hpp +++ b/include/boost/process/v2/ext/exe.hpp @@ -54,9 +54,5 @@ filesystem::path exe(basic_process_handle & handle) BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -#include -#endif - #endif // BOOST_PROCESS_V2_EXE_HPP diff --git a/include/boost/process/v2/impl/default_launcher.ipp b/include/boost/process/v2/impl/default_launcher.ipp deleted file mode 100644 index 26a89794..00000000 --- a/include/boost/process/v2/impl/default_launcher.ipp +++ /dev/null @@ -1,24 +0,0 @@ -// -// boost/process/v2/default_launcher.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -#ifndef BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP -#define BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP - -#include - -#if defined(BOOST_PROCESS_V2_WINDOWS) -#include -#else -#include -#endif - - - -#endif //BOOST_PROCESS_V2_IMPL_DEFAULT_LAUNCHER_IPP \ No newline at end of file diff --git a/include/boost/process/v2/impl/process_handle.ipp b/include/boost/process/v2/impl/process_handle.ipp deleted file mode 100644 index 813395c2..00000000 --- a/include/boost/process/v2/impl/process_handle.ipp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2022 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP -#define BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP - -#include - -#if defined(BOOST_PROCESS_V2_WINDOWS) -#include -#else - - -#endif - -#endif //BOOST_PROCESS_V2_IMPL_PROCESS_HANDLE_IPP diff --git a/include/boost/process/v2/pid.hpp b/include/boost/process/v2/pid.hpp index b6a07ab6..8c6779b2 100644 --- a/include/boost/process/v2/pid.hpp +++ b/include/boost/process/v2/pid.hpp @@ -60,9 +60,6 @@ BOOST_PROCESS_V2_DECL std::vector child_pids(pid_type pid); BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -#include -#endif #endif // BOOST_PROCESS_V2_PID_HPP diff --git a/include/boost/process/v2/process_handle.hpp b/include/boost/process/v2/process_handle.hpp index 04ea6e62..9e50f7a7 100644 --- a/include/boost/process/v2/process_handle.hpp +++ b/include/boost/process/v2/process_handle.hpp @@ -157,13 +157,4 @@ using process_handle = basic_process_handle<>; BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - - - - #endif //BOOST_PROCESS_V2_PROCESS_HANDLE_HPP diff --git a/include/boost/process/v2/shell.hpp b/include/boost/process/v2/shell.hpp index 51855719..4a991e03 100644 --- a/include/boost/process/v2/shell.hpp +++ b/include/boost/process/v2/shell.hpp @@ -140,10 +140,4 @@ struct shell BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) - -#include - -#endif - #endif //BOOST_PROCESS_V2_ERROR_HPP diff --git a/include/boost/process/v2/src.hpp b/include/boost/process/v2/src.hpp deleted file mode 100644 index 86470a4d..00000000 --- a/include/boost/process/v2/src.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2021 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_SRC_HPP -#define BOOST_PROCESS_V2_SRC_HPP - -#define BOOST_PROCESS_V2_SOURCE - -#include - -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -# error Do not compile Process V2 library source with BOOST_PROCESS_V2_HEADER_ONLY defined. You should probably define BOOST_PROCESS_V2_SEPARATE_COMPILATION -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif //BOOST_PROCESS_V2_SRC_HPP diff --git a/include/boost/process/v2/windows/default_launcher.hpp b/include/boost/process/v2/windows/default_launcher.hpp index 2e44b33e..f10eee5a 100644 --- a/include/boost/process/v2/windows/default_launcher.hpp +++ b/include/boost/process/v2/windows/default_launcher.hpp @@ -409,8 +409,6 @@ struct default_launcher } BOOST_PROCESS_V2_END_NAMESPACE -#if defined(BOOST_PROCESS_V2_HEADER_ONLY) -#include -#endif + #endif //BOOST_PROCESS_V2_WINDOWS_DEFAULT_LAUNCHER_HPP \ No newline at end of file diff --git a/include/boost/process/v2/detail/impl/environment_posix.ipp b/src/detail/environment_posix.cpp similarity index 87% rename from include/boost/process/v2/detail/impl/environment_posix.ipp rename to src/detail/environment_posix.cpp index 0f76b816..f910b776 100644 --- a/include/boost/process/v2/detail/impl/environment_posix.ipp +++ b/src/detail/environment_posix.cpp @@ -1,17 +1,13 @@ -// -// process/this_process/detail/environment_posix.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// // Copyright (c) 2021 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_PROCESS_V2_DETAIL_ENVIRONMENT_WIN_HPP -#define BOOST_PROCESS_V2_DETAIL_ENVIRONMENT_WIN_HPP - #include + +#if defined(BOOST_PROCESS_V2_POSIX) + #include #include #include @@ -78,4 +74,4 @@ bool is_executable(const filesystem::path & p, error_code & ec) } BOOST_PROCESS_V2_END_NAMESPACE -#endif //BOOST_PROCESS_V2_DETAIL_ENVIRONMENT_WIN_HPP +#endif diff --git a/include/boost/process/v2/detail/impl/environment_win.ipp b/src/detail/environment_win.cpp similarity index 91% rename from include/boost/process/v2/detail/impl/environment_win.ipp rename to src/detail/environment_win.cpp index 86792f2e..7de6aecd 100644 --- a/include/boost/process/v2/detail/impl/environment_win.ipp +++ b/src/detail/environment_win.cpp @@ -1,26 +1,21 @@ -// -// process/this_process/detail/environment_win.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~ -// // Copyright (c) 2021 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_WIN_IPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_WIN_IPP - - #include + +#if defined(BOOST_PROCESS_V2_WINDOWS) + #include -#include #include #include #include #include +#include #include #include @@ -139,4 +134,4 @@ bool is_executable(const filesystem::path & pth, error_code & ec) } BOOST_PROCESS_V2_END_NAMESPACE -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_ENVIRONMENT_WIN_IPP +#endif diff --git a/include/boost/process/v2/detail/impl/last_error.ipp b/src/detail/last_error.cpp similarity index 81% rename from include/boost/process/v2/detail/impl/last_error.ipp rename to src/detail/last_error.cpp index 8254fdb6..57bb46ae 100644 --- a/include/boost/process/v2/detail/impl/last_error.ipp +++ b/src/detail/last_error.cpp @@ -2,8 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_LAST_ERROR_IPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_LAST_ERROR_IPP #include #include @@ -30,5 +28,3 @@ error_code get_last_error() } BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_LAST_ERROR_IPP \ No newline at end of file diff --git a/include/boost/process/v2/detail/impl/process_handle_windows.ipp b/src/detail/process_handle_windows.cpp similarity index 94% rename from include/boost/process/v2/detail/impl/process_handle_windows.ipp rename to src/detail/process_handle_windows.cpp index 535bc011..fa77e492 100644 --- a/include/boost/process/v2/detail/impl/process_handle_windows.ipp +++ b/src/detail/process_handle_windows.cpp @@ -2,10 +2,11 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_PROCESS_HANDLE_WINDOWS_IPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_PROCESS_HANDLE_WINDOWS_IPP #include + +#if defined(BOOST_PROCESS_V2_WINDOWS) + #include #include #include @@ -157,13 +158,11 @@ void resume_(HANDLE handle, error_code & ec) } #endif -#if !defined(BOOST_PROCESS_V2_HEADER_ONLY) template struct basic_process_handle_win<>; -#endif } BOOST_PROCESS_V2_END_NAMESPACE -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_PROCESS_HANDLE_WINDOWS_IPP +#endif diff --git a/include/boost/process/v2/detail/impl/throw_error.ipp b/src/detail/throw_error.cpp similarity index 80% rename from include/boost/process/v2/detail/impl/throw_error.ipp rename to src/detail/throw_error.cpp index 663bb167..b9dc53c6 100644 --- a/include/boost/process/v2/detail/impl/throw_error.ipp +++ b/src/detail/throw_error.cpp @@ -2,8 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_THROW_ERROR_IPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_THROW_ERROR_IPP #include #include @@ -27,5 +25,3 @@ void do_throw_error(const error_code& err, const char* location) } BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_THROW_ERROR_IPP diff --git a/include/boost/process/v2/detail/impl/utf8.ipp b/src/detail/utf8.cpp similarity index 98% rename from include/boost/process/v2/detail/impl/utf8.ipp rename to src/detail/utf8.cpp index c0e0bf69..a70fd1cc 100644 --- a/include/boost/process/v2/detail/impl/utf8.ipp +++ b/src/detail/utf8.cpp @@ -2,8 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_DETAIL_IMPL_UTF8_HPP -#define BOOST_PROCESS_V2_DETAIL_IMPL_UTF8_HPP #include #include @@ -376,4 +374,3 @@ std::size_t convert_to_wide(const char * in, std::size_t size, BOOST_PROCESS_V2_END_NAMESPACE -#endif //BOOST_PROCESS_V2_DETAIL_IMPL_UTF8_HPP diff --git a/include/boost/process/v2/impl/environment.ipp b/src/environment.cpp similarity index 81% rename from include/boost/process/v2/impl/environment.ipp rename to src/environment.cpp index d756bf1a..79a37200 100644 --- a/include/boost/process/v2/impl/environment.ipp +++ b/src/environment.cpp @@ -1,16 +1,9 @@ -// -// boost/process/v2/impl/environment.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// // Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP -#define BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP - #include #include #include @@ -42,6 +35,3 @@ error_code process_environment::on_setup(posix::default_launcher & launcher, con BOOST_PROCESS_V2_END_NAMESPACE - - -#endif //BOOST_PROCESS_V2_IMPL_ENVIRONMENT_IPP \ No newline at end of file diff --git a/include/boost/process/v2/impl/error.ipp b/src/error.cpp similarity index 98% rename from include/boost/process/v2/impl/error.ipp rename to src/error.cpp index 2aaf992a..8e9ffe46 100644 --- a/include/boost/process/v2/impl/error.ipp +++ b/src/error.cpp @@ -2,8 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_ERROR_IPP -#define BOOST_PROCESS_V2_IMPL_ERROR_IPP #include #include @@ -202,5 +200,3 @@ BOOST_PROCESS_V2_DECL const error_category& get_exit_code_category() } BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_IMPL_ERROR_IPP diff --git a/include/boost/process/v2/ext/impl/cmd.ipp b/src/ext/cmd.cpp similarity index 98% rename from include/boost/process/v2/ext/impl/cmd.ipp rename to src/ext/cmd.cpp index 60eb9378..14e1c40a 100644 --- a/include/boost/process/v2/ext/impl/cmd.ipp +++ b/src/ext/cmd.cpp @@ -3,8 +3,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_CMD_IPP -#define BOOST_PROCESS_V2_IMPL_CMD_IPP #include #include @@ -19,6 +17,12 @@ #include #endif +#if (defined(__APPLE__) && defined(__MACH__)) +#include +#include +#include +#endif + #if (defined(__linux__) || defined(__ANDROID__)) #include #endif @@ -400,6 +404,3 @@ shell cmd(boost::process::v2::pid_type pid) } // namespace ext BOOST_PROCESS_V2_END_NAMESPACE - -#endif // BOOST_PROCESS_V2_IMPL_CMD_IPP - diff --git a/include/boost/process/v2/ext/impl/cwd.ipp b/src/ext/cwd.cpp similarity index 98% rename from include/boost/process/v2/ext/impl/cwd.ipp rename to src/ext/cwd.cpp index 338614b3..07d0d440 100644 --- a/include/boost/process/v2/ext/impl/cwd.ipp +++ b/src/ext/cwd.cpp @@ -3,8 +3,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_CWD_IPP -#define BOOST_PROCESS_V2_IMPL_CWD_IPP #include #include @@ -246,6 +244,3 @@ filesystem::path cwd(boost::process::v2::pid_type pid) } // namespace ext BOOST_PROCESS_V2_END_NAMESPACE - -#endif // BOOST_PROCESS_V2_IMPL_CWD_IPP - diff --git a/include/boost/process/v2/ext/impl/env.ipp b/src/ext/env.cpp similarity index 98% rename from include/boost/process/v2/ext/impl/env.ipp rename to src/ext/env.cpp index f27da4dd..0d14ca07 100644 --- a/include/boost/process/v2/ext/impl/env.ipp +++ b/src/ext/env.cpp @@ -2,9 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_EXT_IMPL_ENV_IPP -#define BOOST_PROCESS_V2_EXT_IMPL_ENV_IPP - #include #include #include @@ -12,11 +9,18 @@ #include #if defined(BOOST_PROCESS_V2_WINDOWS) +#include #include #else #include #endif +#if (defined(__APPLE__) && defined(__MACH__)) +#include +#include +#include +#endif + #if (defined(__linux__) || defined(__ANDROID__)) #include #endif @@ -394,5 +398,3 @@ env_view env(boost::process::v2::pid_type pid) } } BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_EXT_IMPL_ENV_IPP diff --git a/include/boost/process/v2/ext/impl/exe.ipp b/src/ext/exe.cpp similarity index 97% rename from include/boost/process/v2/ext/impl/exe.ipp rename to src/ext/exe.cpp index 067e583e..cc56bedb 100644 --- a/include/boost/process/v2/ext/impl/exe.ipp +++ b/src/ext/exe.cpp @@ -3,8 +3,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_EXE_IPP -#define BOOST_PROCESS_V2_IMPL_EXE_IPP #include #include @@ -188,6 +186,3 @@ filesystem::path exe(boost::process::v2::pid_type pid) } // namespace ext BOOST_PROCESS_V2_END_NAMESPACE - -#endif // BOOST_PROCESS_V2_IMPL_EXE_IPP - diff --git a/include/boost/process/v2/ext/detail/impl/proc_info.ipp b/src/ext/proc_info.cpp similarity index 95% rename from include/boost/process/v2/ext/detail/impl/proc_info.ipp rename to src/ext/proc_info.cpp index 4de38dad..311c9c40 100644 --- a/include/boost/process/v2/ext/detail/impl/proc_info.ipp +++ b/src/ext/proc_info.cpp @@ -3,8 +3,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_DETAIL_PROC_INFO_IPP -#define BOOST_PROCESS_V2_IMPL_DETAIL_PROC_INFO_IPP #include #include @@ -122,6 +120,3 @@ HANDLE open_process_with_debug_privilege(boost::process::v2::pid_type pid, boost } // namespace detail BOOST_PROCESS_V2_END_NAMESPACE - -#endif // BOOST_PROCESS_V2_IMPL_DETAIL_PROC_INFO_IPP - diff --git a/include/boost/process/v2/impl/pid.ipp b/src/pid.cpp similarity index 99% rename from include/boost/process/v2/impl/pid.ipp rename to src/pid.cpp index 4264a3d1..f32df9ec 100644 --- a/include/boost/process/v2/impl/pid.ipp +++ b/src/pid.cpp @@ -3,8 +3,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_PID_IPP -#define BOOST_PROCESS_V2_IMPL_PID_IPP #include #include @@ -760,6 +758,3 @@ std::vector child_pids(pid_type pid) } BOOST_PROCESS_V2_END_NAMESPACE - -#endif // BOOST_PROCESS_V2_IMPL_PID_IPP - diff --git a/include/boost/process/v2/posix/detail/close_handles.ipp b/src/posix/close_handles.cpp similarity index 94% rename from include/boost/process/v2/posix/detail/close_handles.ipp rename to src/posix/close_handles.cpp index ce3e7462..1603467c 100644 --- a/include/boost/process/v2/posix/detail/close_handles.ipp +++ b/src/posix/close_handles.cpp @@ -1,19 +1,18 @@ -// -// boost/process/v2/posix/detail/close_handles.hpp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// // Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_PROCESS_V2_POSIX_DETAIL_CLOSE_HANDLES_IPP -#define BOOST_PROCESS_V2_POSIX_DETAIL_CLOSE_HANDLES_IPP - #include + +#if defined(BOOST_PROCESS_V2_POSIX) + #include #include + +#include + // linux has close_range since 5.19 @@ -191,4 +190,4 @@ void close_all(const std::vector & whitelist, error_code & ec) BOOST_PROCESS_V2_END_NAMESPACE -#endif //BOOST_PROCESS_V2_POSIX_DETAIL_CLOSE_HANDLES_IPP \ No newline at end of file +#endif \ No newline at end of file diff --git a/include/boost/process/v2/impl/shell.ipp b/src/shell.cpp similarity index 96% rename from include/boost/process/v2/impl/shell.ipp rename to src/shell.cpp index da78404f..1e64c450 100644 --- a/include/boost/process/v2/impl/shell.ipp +++ b/src/shell.cpp @@ -2,8 +2,6 @@ // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#ifndef BOOST_PROCESS_V2_IMPL_SHELL_IPP -#define BOOST_PROCESS_V2_IMPL_SHELL_IPP #include #include @@ -13,6 +11,7 @@ #include #if defined(BOOST_PROCESS_V2_WINDOWS) +#include #include #else #include @@ -133,5 +132,3 @@ auto shell::args() const -> args_type #endif BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_IMPL_SHELL_IPP diff --git a/include/boost/process/v2/windows/impl/default_launcher.ipp b/src/windows/default_launcher.cpp similarity index 87% rename from include/boost/process/v2/windows/impl/default_launcher.ipp rename to src/windows/default_launcher.cpp index 5c90a65f..a584d6b8 100644 --- a/include/boost/process/v2/windows/impl/default_launcher.ipp +++ b/src/windows/default_launcher.cpp @@ -1,16 +1,13 @@ -// -// boost/process/v2/windows/impl/default_launcher.ipp -// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// // Copyright (c) 2022 Klemens D. Morgenstern (klemens dot morgenstern at gmx dot net) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BOOST_PROCESS_V2_WINDOWS_IMPL_DEFAULT_LAUNCHER_IPP -#define BOOST_PROCESS_V2_WINDOWS_IMPL_DEFAULT_LAUNCHER_IPP #include + +#if defined(BOOST_PROCESS_V2_WINDOWS) + #include BOOST_PROCESS_V2_BEGIN_NAMESPACE @@ -76,5 +73,4 @@ namespace windows } BOOST_PROCESS_V2_END_NAMESPACE - -#endif //BOOST_PROCESS_V2_WINDOWS_IMPL_DEFAULT_LAUNCHER_IPP \ No newline at end of file +#endif \ No newline at end of file diff --git a/test/v2/CMakeLists.txt b/test/v2/CMakeLists.txt index 4a27e6a7..7d6a5c65 100644 --- a/test/v2/CMakeLists.txt +++ b/test/v2/CMakeLists.txt @@ -22,8 +22,6 @@ boost_process_v2_standalone_test(pid) boost_process_v2_standalone_test(environment) boost_process_v2_standalone_test(shell) -add_library(boost_process_v2_header_test header_1.cpp header_2.cpp) -target_link_libraries(boost_process_v2_header_test PUBLIC Boost::process) add_executable(boost_process_v2_test_target target.cpp) target_link_libraries(boost_process_v2_test_target PUBLIC Boost::process Boost::system) diff --git a/test/v2/Jamfile.jam b/test/v2/Jamfile.jam index cc4c41b6..fcaa8130 100644 --- a/test/v2/Jamfile.jam +++ b/test/v2/Jamfile.jam @@ -44,10 +44,7 @@ exe target : target.cpp : ; -lib header_test : header_1.cpp header_2.cpp : - BOOST_PROCESS_V2_HEADER_ONLY=1 ; - -lib test_impl : test_impl.cpp filesystem : +lib test_impl : test_impl.cpp filesystem /boost//process : BOOST_PROCESS_V2_SEPARATE_COMPILATION=1 BOOST_TEST_IGNORE_SIGCHLD=1 static diff --git a/test/v2/header_1.cpp b/test/v2/header_1.cpp deleted file mode 100644 index 1ed397ce..00000000 --- a/test/v2/header_1.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) 2022 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include \ No newline at end of file diff --git a/test/v2/header_2.cpp b/test/v2/header_2.cpp deleted file mode 100644 index 1ed397ce..00000000 --- a/test/v2/header_2.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) 2022 Klemens D. Morgenstern -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -#include \ No newline at end of file diff --git a/test/v2/process.cpp b/test/v2/process.cpp index 071936b6..e165c249 100644 --- a/test/v2/process.cpp +++ b/test/v2/process.cpp @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE(terminate) boost::system::error_code ec; proc.terminate(ec); proc.wait(ec); - BOOST_CHECK_NE(proc.exit_code(), 0); + BOOST_WARN_NE(proc.exit_code(), 0); } BOOST_AUTO_TEST_CASE(request_exit) diff --git a/test/v2/test_impl.cpp b/test/v2/test_impl.cpp index 0cab7067..6df70854 100644 --- a/test/v2/test_impl.cpp +++ b/test/v2/test_impl.cpp @@ -6,5 +6,3 @@ #define BOOST_TEST_IGNORE_SIGCHLD #define BOOST_TEST_MODULE process_v2_test #include - -#include