コード例 #1
0
ファイル: depends.c プロジェクト: dooglus/ccan
/* Be careful about trying to compile over running programs (parallel make).
 * temp_file helps here. */
char *compile_info(const void *ctx, const char *dir)
{
	char *info_c_file, *info, *compiled, *output;
	int fd;

	/* Copy it to a file with proper .c suffix. */
	info = grab_file(ctx, tal_fmt(ctx, "%s/_info", dir));
	if (!info)
		return NULL;

	info_c_file = temp_file(ctx, ".c", "_info");
	fd = open(info_c_file, O_WRONLY|O_CREAT|O_EXCL, 0600);
	if (fd < 0)
		return NULL;
	if (!write_all(fd, info, tal_count(info)-1))
		return NULL;

	if (close(fd) != 0)
		return NULL;

	compiled = temp_file(ctx, "", "info");
	if (compile_and_link(ctx, info_c_file, find_ccan_dir(dir), "",
			     compiler, cflags, "", compiled, &output))
		return compiled;
	return NULL;
}
コード例 #2
0
LightsourceSimplePass::LightsourceSimplePass(GraphicContext &gc, const std::string &shader_path, ResourceContainer &inout)
{
	viewport = inout.get<Rect>("Viewport");
	field_of_view = inout.get<float>("FieldOfView");
	world_to_eye = inout.get<Mat4f>("WorldToEye");
	diffuse_color_gbuffer = inout.get<Texture2D>("DiffuseColorGBuffer");
	specular_color_gbuffer = inout.get<Texture2D>("SpecularColorGBuffer");
	specular_level_gbuffer = inout.get<Texture2D>("SpecularLevelGBuffer");
	self_illumination_gbuffer = inout.get<Texture2D>("SelfIlluminationGBuffer");
	normal_z_gbuffer = inout.get<Texture2D>("NormalZGBuffer");
	shadow_maps = inout.get<Texture2DArray>("ShadowMaps");
	zbuffer = inout.get<Texture2D>("ZBuffer");

	final_color = inout.get<Texture2D>("FinalColor");

	icosahedron_light_program = compile_and_link(gc, shader_path, "icosahedron");
	rect_light_program = compile_and_link(gc, shader_path, "rect");

	light_instance_texture = Texture1D(gc, max_lights * vectors_per_light, tf_rgba32f);
	light_instance_transfer = PixelBuffer(max_lights * vectors_per_light, 1, tf_rgba32f);

	icosahedron.reset(new Icosahedron(gc, true));
}
コード例 #3
0
ファイル: main.c プロジェクト: ChunhuaLi/iverilog
int main(int argc, char *argv[])
{
	init();

	if (!parse(argc,argv)) usage();

	setup_mingw_environment();
	setup_ivl_environment();

	  /* are there any source or object files specified */
	if (*gstr.pOUT) compile_and_link();

	myExit(0);
	return 0; // eliminate warnings.
}
コード例 #4
0
ファイル: examples_compile.c プロジェクト: atbrox/ccan
static bool compile(const void *ctx,
		    struct manifest *m,
		    struct ccan_file *file,
		    char **output)
{
	file->compiled[COMPILE_NORMAL] = temp_file(ctx, "", file->fullname);
	if (!compile_and_link(ctx, file->fullname, ccan_dir,
			      example_obj_list(m, file),
			      compiler, cflags,
			      lib_list(m), file->compiled[COMPILE_NORMAL],
			      output)) {
		/* Don't keep failures, even with --keep */
		unlink(file->compiled[COMPILE_NORMAL]);
		file->compiled[COMPILE_NORMAL] = NULL;
		return false;
	}
	return true;
}