diff --git a/building/main.cpp b/building/main.cpp index 968bc25..ffac90b 100644 --- a/building/main.cpp +++ b/building/main.cpp @@ -6,7 +6,6 @@ struct TestWebsiteBuildScript { /* Installation runlevel */ BuildUnitsArray runlevel_2; - /* "debug" or "release" */ std::string build_type; bool make_tests = false; @@ -34,11 +33,12 @@ struct TestWebsiteBuildScript { return my_flag_collection; } - TestWebsiteBuildScript(const std::string& _build_type, bool make_tests, - const NormalCBuildSystemCommandMeaning& cmd) - : build_type(_build_type), make_tests(make_tests) - { - ASSERT(build_type == "release" || build_type == "debug", "Unknown build type " + _build_type); + explicit TestWebsiteBuildScript(const NormalCBuildSystemCommandMeaning& cmd){ + const char* BSCRIPT_TYPE = getenv("BSCRIPT_TYPE"); + const char* BSCRIPT_TESTS = getenv("BSCRIPT_TESTS"); + build_type = BSCRIPT_TYPE ? BSCRIPT_TYPE : "release"; + make_tests = (bool)BSCRIPT_TESTS; + ASSERT(build_type == "release" || build_type == "debug", "Unknown build type"); std::vector ext_targets; @@ -70,10 +70,9 @@ struct TestWebsiteBuildScript { for (std::string& u: T.exported_headers) u = "jsonincpp/" + u; T.installation_dir = ""; - T.pc_output_path = "libjsonincpp.pc"; my_targets.push_back(T); } - if (make_tests) { CTarget T{"test0", "executable"}; + if (make_tests) { CTarget T{"libjsonincpp_test0", "executable"}; T.additional_compilation_flags = getSomeRadFlags(); T.proj_deps = {CTargetDependenceOnProjectsLibrary{"libjsonincpp"}}; T.units = {"tests/test0.cpp"}; @@ -94,12 +93,7 @@ int main(int argc, char** argv) { } NormalCBuildSystemCommandMeaning cmd; regular_bs_cli_cmd_interpret(args, cmd); - const char* BS_SCRIPT_TYPE = getenv("BS_SCRIPT_TYPE"); - const char* BS_SCRIPT_TESTS = getenv("BS_SCRIPT_TESTS"); - TestWebsiteBuildScript bs( - BS_SCRIPT_TYPE ? BS_SCRIPT_TYPE : "release", - BS_SCRIPT_TESTS ? true : false, - cmd); + TestWebsiteBuildScript bs(cmd); if (cmd.need_to_build) complete_tasks_of_build_units(bs.runlevel_1); umask(~0755);