#include "helper.h"
#include "c.h"
#include "ld.h"
#include "tier1/utlstring.h"


CUtlString rapier_lib;
int rapier_build()
{
	rapier_lib = CUtlString("rapier/target/%s/release/librapier_rtt.a",szTarget.GetString());
	V_printf("%s\n",rapier_lib.GetString());
	CUtlVector<CUtlString> cargo_args = {
		"build",
		"--release",
		"--target",
		szTarget
	};
	IRunner::Run("cargo", "rapier", cargo_args);
	
	CUtlVector<CUtlString> cbindgen_args = {
		"--config",
		"cbindgen.toml",
		"--crate",
		"rapier_rtt",
		"--output",
		"../public/physics_gen.h",
	};
	IRunner::Run("cbindgen", "rapier", cbindgen_args);

	return 0;
};
DECLARE_BUILD_STAGE(rapier, rapier_build);
