From ce6a9e2e4cc05f9cfdb7ec43bf4e7db164cd4540 Mon Sep 17 00:00:00 2001 From: Andreev Gregory Date: Fri, 19 Jul 2024 16:02:16 +0300 Subject: [PATCH] Added field CTarget::unit_dir --- regexis024_build_system.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/regexis024_build_system.h b/regexis024_build_system.h index 91e3c35..061ae05 100644 --- a/regexis024_build_system.h +++ b/regexis024_build_system.h @@ -3,7 +3,6 @@ /* This file is standalone from libregexis024 project (but it is related to it as it's dependency) */ - #include #include #include @@ -925,7 +924,9 @@ struct CTarget { std::vector additional_compilation_flags; std::vector additional_linkage_flags; - /* .c and .cpp source files relative to the special src directory*/ + /* Prefix for all cpp files in `units` array */ + std::string units_dir; + /* .c and .cpp source files relative to the special src/${units_dir} directory*/ std::vector units; std::string include_pr; @@ -981,8 +982,8 @@ void check_pkg_conf_rel_install_path(const path_t& P) { ASSERT_pl(does_str_end_in(P.parts.back(), ".pc")); } -/* Argument `name` is relative to project_src_dir, return value is relative_to $IR/$TARGET_NAME/obj */ -path_t c_unit_name_to_obj_filename(const std::string& PtoC) { +/* Argument `name` is just a name in `units` array, return value is relative to $IR/$TARGET_NAME/obj */ +path_t c_unit_name_to_obj_filename(const std::string& units_dir, const std::string& PtoC) { path_t P(PtoC); assert(!P.parts.empty()); std::string& filename = P.parts.back(); @@ -998,6 +999,10 @@ path_t c_unit_name_to_obj_filename(const std::string& PtoC) { return P; } +path_t c_unit_name_to_source_filename(const std::string& units_dir, const std::string& PtoC){ + return path_t(units_dir) / PtoC; +} + void load_ctargets_on_building_and_installing( const std::vector& ext_lib_targs, const std::vector& proj_targs, @@ -1053,10 +1058,10 @@ void load_ctargets_on_building_and_installing( size_t mk_personal_targ_dir_bu_id = add_bbu(new MkdirBuildUnit(path_t(proj_compiled_dir_path) / tg.name)); std::vector all_comp_units_bu_ids; auto BU_to_SOURCE_FILEPATH = [&](const std::string& bu) -> path_t { - return path_t(proj_src_dir_path) / bu; + return path_t(proj_src_dir_path) / c_unit_name_to_source_filename(tg.units_dir, bu); }; auto BU_to_OBJ_FILEPATH = [&](const std::string& bu) -> path_t { - return path_t(proj_compiled_dir_path) / tg.name / "obj" / c_unit_name_to_obj_filename(bu); + return path_t(proj_compiled_dir_path) / tg.name / "obj" / c_unit_name_to_obj_filename(tg.units_dir, bu); }; auto generate_cu_BUs = [&](const std::vector& ctg_type_intrinsic_comp_args) { const std::string comp_cmd = "g++"; // todo: think of some other way around