diff --git a/build.jam b/build.jam new file mode 100644 index 000000000..969e2a1e7 --- /dev/null +++ b/build.jam @@ -0,0 +1,46 @@ +# Copyright René Ferdinand Rivera Morell 2024 +# 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) + +require-b2 5.2 ; + +import feature : feature ; + +feature boost.process.fs : boost std : optional propagated ; + +constant boost_dependencies : + /boost/algorithm//boost_algorithm + /boost/asio//boost_asio + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/fusion//boost_fusion + /boost/io//boost_io + /boost/iterator//boost_iterator + /boost/move//boost_move + /boost/optional//boost_optional + /boost/system//boost_system + /boost/throw_exception//boost_throw_exception + /boost/tokenizer//boost_tokenizer + /boost/type_index//boost_type_index + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility + /boost/winapi//boost_winapi ; + +project /boost/process + : common-requirements + include + : default-build + boost + ; + +explicit + [ alias boost_process : build//boost_process ] + [ alias all : boost_process example example/v2 test ] + ; + +call-if : boost-library process + : install boost_process + ; + diff --git a/build/Jamfile b/build/Jamfile index d5346eb8e..40192534c 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -5,7 +5,8 @@ import os ; import feature ; -import ../../config/checks/config : requires ; +import-search /boost/config/checks ; +import config : requires ; project : requirements BOOST_ASIO_NO_DEPRECATED @@ -15,11 +16,11 @@ project : requirements windows:WIN32_LEAN_AND_MEAN linux:-lpthread : source-location ../src + : common-requirements + $(boost_dependencies) + std:BOOST_PROCESS_USE_STD_FS=1 ; -feature.feature boost.process.fs : boost std : propagated composite ; -feature.compose std : BOOST_PROCESS_USE_STD_FS=1 ; - alias process_sources : detail/environment_posix.cpp detail/environment_win.cpp @@ -40,26 +41,21 @@ alias process_sources shell.cpp ; -if [ os.name ] = NT -{ - lib shell32 ; - lib advapi32 ; - lib ntdll ; - lib user32 ; - explicit shell32 advapi32 ntdll user32 ; -} +lib shell32 ; +lib advapi32 ; +lib ntdll ; +lib user32 ; lib boost_process : process_sources : requirements BOOST_PROCESS_SOURCE=1 shared:BOOST_PROCESS_DYN_LINK=1 - boost:/boost//filesystem + boost:/boost/filesystem//boost_filesystem windows:shell32 windows:user32 windows:ntdll windows:advapi32 : usage-requirements shared:BOOST_PROCESS_DYN_LINK=1 + boost:/boost/filesystem//boost_filesystem ; - -boost-install boost_process ; diff --git a/doc/Jamfile.jam b/doc/Jamfile.jam index ad9e3949c..5ed200775 100644 --- a/doc/Jamfile.jam +++ b/doc/Jamfile.jam @@ -19,12 +19,12 @@ install images_glob : $(images) : $(BOOST_ROOT)/doc/html/boost_process import type ; type.register XMLPROCESSWORKAROUND : : XML ; import generators ; -generators.register-standard common.copy : XML : XMLPROCESSWORKAROUND ; +generators.register-standard common.copy : XML : XMLPROCESSWORKAROUND ; xmlprocessworkaround posix_pseudocode : v1/posix_pseudocode.xml ; xmlprocessworkaround windows_pseudocode : v1/windows_pseudocode.xml ; -path-constant INCLUDES : ../../.. ; +path-constant INCLUDES : ../include ; doxygen reference_v1 : @@ -66,7 +66,7 @@ doxygen reference_v2 BOOST_PROCESS_V2_INITFN_AUTO_RESULT_TYPE(x,y)=deduced \\ BOOST_PROCESS_V2_COMPLETION_TOKEN_FOR(X)=Token \\ BOOST_PROCESS_V2_DEFAULT_COMPLETION_TOKEN_TYPE(E)=DEFAULT_TYPE \\ - BOOST_ASIO_DEFAULT_COMPLETION_TOKEN=DEFAULT \\ + BOOST_ASIO_DEFAULT_COMPLETION_TOKEN=DEFAULT \\ BOOST_CONSTEXPR=constexpr \\ BOOST_CXX14_CONSTEXPR=constexpr \\ BOOST_PROCESS_V2_INLINE= \\ @@ -98,7 +98,7 @@ boostbook standalone ############################################################################### alias boostdoc : standalone/docbook - : + : : images_glob : ; explicit boostdoc ; diff --git a/example/Jamfile.jam b/example/Jamfile.jam index 4a9aa06f8..5ec31f042 100644 --- a/example/Jamfile.jam +++ b/example/Jamfile.jam @@ -8,7 +8,7 @@ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) project : requirements - ../../.. + /boost/process//boost_process msvc:_SCL_SECURE_NO_WARNINGS windows:WIN32_LEAN_AND_MEAN ; diff --git a/example/v2/Jamfile.jam b/example/v2/Jamfile.jam index 26da639a2..450fdc21d 100644 --- a/example/v2/Jamfile.jam +++ b/example/v2/Jamfile.jam @@ -4,14 +4,12 @@ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) project : requirements - ../../.. msvc:_SCL_SECURE_NO_WARNINGS windows:WIN32_LEAN_AND_MEAN + static ; import testing ; -alias filesystem : /boost//filesystem : static ; - -exe intro : intro.cpp filesystem ; -exe intro_popen : intro_popen.cpp filesystem ; +exe intro : intro.cpp ; +exe intro_popen : intro_popen.cpp : boost ; diff --git a/test/v1/Jamfile.jam b/test/v1/Jamfile.jam index dd8755147..c75860db2 100644 --- a/test/v1/Jamfile.jam +++ b/test/v1/Jamfile.jam @@ -9,17 +9,13 @@ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -import os ; - -if [ os.name ] = NT -{ - lib ws2_32 ; - lib shell32 ; - lib Advapi32 ; - lib Ntdll ; -} +lib ws2_32 ; +lib shell32 ; +lib Advapi32 ; +lib Ntdll ; project : requirements + /boost/process//boost_process BOOST_ASIO_NO_DEPRECATED msvc:_SCL_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_DEPRECATE @@ -28,6 +24,7 @@ project : requirements linux:-lpthread NT,cw:ws2_32 NT,gcc:ws2_32 + /boost/test//included ; @@ -35,16 +32,19 @@ project : requirements import testing ; -alias program_options : /boost//program_options : static ; -alias filesystem : /boost//filesystem ; -alias iostreams : /boost//iostreams ; -alias system : /boost//system ; -alias thread : /boost//thread ; -alias coroutine : /boost//coroutine : static ; +alias program_options : usage-requirements /boost/program_options//boost_program_options ; +alias filesystem : usage-requirements /boost/filesystem//boost_filesystem ; +alias iostreams : usage-requirements /boost/iostreams//boost_iostreams ; +alias system : usage-requirements /boost/system//boost_system ; +alias thread : usage-requirements /boost/thread//boost_thread ; +alias coroutine : usage-requirements /boost/coroutine//boost_coroutine ; +alias scope_exit : usage-requirements /boost/scope_exit//boost_scope_exit ; +alias lambda : usage-requirements /boost/lambda//boost_lambda ; +alias chrono : usage-requirements /boost/chrono//boost_chrono ; lib multi_ref : multi_ref1.cpp multi_ref2.cpp system : windows:shell32 ; -exe sparring_partner : sparring_partner.cpp program_options system filesystem iostreams : +exe sparring_partner : sparring_partner.cpp program_options system filesystem iostreams lambda : off windows:shell32 windows:Ntdll ; @@ -100,15 +100,15 @@ test-suite with-valgrind : [ run env.cpp program_options system filesystem : [ test-options env ] : sparring_partner ] [ run group.cpp system thread filesystem : [ test-options group ] : sub_launch ] [ run group.cpp system thread filesystem : [ test-options group ] : sub_launch : no windows:yes BOOST_USE_WINDOWS_H=1 : group-windows-h ] - [ run group_wait.cpp system thread filesystem : [ test-options group_wait ] : sparring_partner : darwin:no freebsd:no ] + [ run group_wait.cpp system thread filesystem scope_exit : [ test-options group_wait ] : sparring_partner : darwin:no freebsd:no ] [ run limit_fd.cpp program_options system filesystem : [ test-options limit_fd ] : sparring_partner : freebsd:no ] [ run run_exe.cpp filesystem : : sparring_partner ] [ run run_exe_path.cpp filesystem : [ test-options run_exe_path ] : sparring_partner ] [ run search_path.cpp filesystem system : [ test-options search_path ] : : windows:shell32 ] [ run shell.cpp filesystem system : [ test-options shell ] : sparring_partner : darwin:no ] [ run shell_path.cpp filesystem system : [ test-options shell_path ] ] - [ run system_test1.cpp filesystem system : [ test-options system_test1 ] : sparring_partner ] - [ run system_test2.cpp filesystem system : [ test-options system_test2 ] : sparring_partner ] + [ run system_test1.cpp filesystem system chrono : [ test-options system_test1 ] : sparring_partner ] + [ run system_test2.cpp filesystem system chrono : [ test-options system_test2 ] : sparring_partner ] [ run spawn.cpp filesystem system : [ test-options spawn ] : sparring_partner ] [ run start_dir.cpp filesystem system : [ test-options start_dir ] : sparring_partner ] [ run terminate.cpp system filesystem : [ test-options terminate ] : sparring_partner : freebsd:no ] diff --git a/test/v2/Jamfile.jam b/test/v2/Jamfile.jam index 58baacf0f..3b7769601 100644 --- a/test/v2/Jamfile.jam +++ b/test/v2/Jamfile.jam @@ -4,19 +4,15 @@ # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -import os ; - -if [ os.name ] = NT -{ - lib ws2_32 ; - lib shell32 ; - lib Advapi32 ; - lib Ntdll ; - lib user32 ; - lib Bcrypt ; -} +lib ws2_32 ; +lib shell32 ; +lib Advapi32 ; +lib Ntdll ; +lib user32 ; +lib Bcrypt ; project : requirements + /boost/process//boost_process BOOST_ASIO_NO_DEPRECATED msvc:_SCL_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_DEPRECATE @@ -32,21 +28,19 @@ project : requirements NT,gcc:ws2_32 NT,gcc:Bcrypt BOOST_PROCESS_V2_SEPARATE_COMPILATION=1 + /boost/test//included ; import testing ; -alias filesystem : /boost//filesystem : static ; - exe target : target.cpp : off windows:shell32 windows:Ntdll ; -lib test_impl : test_impl.cpp filesystem /boost//process : +lib test_impl : test_impl.cpp /boost/process//boost_process : BOOST_PROCESS_V2_SEPARATE_COMPILATION=1 BOOST_TEST_IGNORE_SIGCHLD=1 - static ; test-suite standalone : diff --git a/test/v2/process.cpp b/test/v2/process.cpp index 0a4009a18..895370dd9 100644 --- a/test/v2/process.cpp +++ b/test/v2/process.cpp @@ -9,9 +9,6 @@ #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) -#if defined(BOOST_FILESYSTEM_DYN_LINK) -#undef BOOST_FILESYSTEM_DYN_LINK -#endif #define BOOST_TEST_IGNORE_SIGCHLD 1 #if true //defined(BOOST_POSIX_API) @@ -55,9 +52,9 @@ BOOST_AUTO_TEST_CASE(exit_code_sync) { using boost::unit_test::framework::master_test_suite; const auto pth = master_test_suite().argv[1]; - + boost::asio::io_context ctx; - + BOOST_CHECK_EQUAL(bpv::process(ctx, pth, {"exit-code", "0"}).wait(), 0); BOOST_CHECK_EQUAL(bpv::execute(bpv::process(ctx, pth, {"exit-code", "1"})), 1); std::vector args = {"exit-code", "2"}; @@ -85,7 +82,7 @@ BOOST_AUTO_TEST_CASE(exit_code_async) int called = 0; printf("Setting up processes\n"); - + bpv::process proc1(ctx, pth, {"exit-code", "0"}); bpv::process proc3(ctx, pth, {"exit-code", "2"}); bpv::process proc4(ctx, pth, {"exit-code", "42"}); @@ -200,7 +197,7 @@ BOOST_AUTO_TEST_CASE(print_args_out) { using boost::unit_test::framework::master_test_suite; const auto pth = master_test_suite().argv[1]; - + asio::io_context ctx; asio::readable_pipe rp{ctx}; @@ -296,7 +293,7 @@ BOOST_AUTO_TEST_CASE(echo_file) { using boost::unit_test::framework::master_test_suite; const auto pth = master_test_suite().argv[1]; - + asio::io_context ctx; asio::readable_pipe rp{ctx}; @@ -476,7 +473,7 @@ BOOST_AUTO_TEST_CASE(environment) sub_env.push_back("FOOBAR=FOO-BAR"); BOOST_CHECK_EQUAL("FOO-BAR", read_env("FOOBAR", bpv::process_environment{sub_env})); - + sub_env.push_back("XYZ=ZYX"); auto itr = std::find_if(sub_env.begin(), sub_env.end(), [](const bpv::environment::key_value_pair & kv) {return kv.key() == bpv::environment::key("PATH");}); path += static_cast(bpv::environment::delimiter); @@ -511,7 +508,7 @@ BOOST_AUTO_TEST_CASE(exit_code_as_error) bpv::process proc3(ctx, pth, {"sleep", "2000"}); int called = 0; - + proc3.terminate(); diff --git a/test/v2/windows.cpp b/test/v2/windows.cpp index b58cb5983..254f1ad7d 100644 --- a/test/v2/windows.cpp +++ b/test/v2/windows.cpp @@ -9,10 +9,6 @@ #define BOOST_ALL_NO_LIB 1 #endif // !defined(BOOST_ALL_NO_LIB) -#if defined(BOOST_FILESYSTEM_DYN_LINK) -#undef BOOST_FILESYSTEM_DYN_LINK -#endif - // Test that header file is self-contained. #include