int _main()

in include/poac/subcmd/build.hpp [244:276]


        int _main(VS&& argv) {
            namespace fs = boost::filesystem;
            namespace exception = core::exception;
            namespace naming = core::naming;
            namespace yaml = io::file::yaml;

            const auto node = yaml::load_config();
            const bool verbose = util::argparse::use(argv, "-v", "--verbose");
            const auto project_name = yaml::get_with_throw<std::string>(node, "name");

            build_deps(node, verbose);
            stroite::builder bs;
            std::cout << io::cli::to_status(project_name) << std::endl;
            if (yaml::get(node, "build", "lib")) {
                if (!build_link_libs(bs, verbose)) {
                    // compile or gen error
                }
            }
            if (yaml::get(node, "build", "bin")) { // TODO: もし上でlibをビルドしたのなら,それを利用してバイナリをビルドする
                // TODO: ディレクトリで指定できるように
                if (!build_bin(bs, verbose)) {
                    // compile or link error

                    // 一度コンパイルに成功した後にpoac runを実行し,コンパイルに失敗しても実行されるエラーの回避
                    const auto binary_name = io::file::path::current_build_bin_dir / project_name;
                    const fs::path executable_path = fs::relative(binary_name);
                    boost::system::error_code error;
                    fs::remove(executable_path, error);
                }
            }

            return EXIT_SUCCESS;
        }