Beispiel #1
0
def gen_cmake(all_files,
              includedirs,
              prj_name,
              buildfox_name,
              cmd_env,
              filename="CMakeLists.txt"):
    text = r"""# generated by BuildFox
cmake_minimum_required(VERSION 2.8.3)
project(%s)
include_directories("%s")
add_custom_target(
  build
  ALL %s
  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
  VERBATIM
  %s
)
"""

    if cmd_env:
        for chr in ["\\", "\"", "(", ")", "#", "^"]:
            cmd_env = cmd_env.replace(chr, "\\" + chr)
        cmd_env = cmd_env.replace("$", "\\$")

    all_files = ["\"%s\"" % file for file in cxx_findfiles(all_files)]
    includedirs = ["."] + includedirs

    with open(filename, "w") as f:
        f.write(text % (prj_name, ";".join(includedirs),
                        cmd_env + " COMMAND ninja" if cmd_env else "ninja",
                        "SOURCES " + " ".join(all_files) if all_files else ""))
Beispiel #2
0
def gen_cmake(all_files, includedirs, prj_name, buildfox_name, cmd_env, filename = "CMakeLists.txt"):
	text = r"""# generated by BuildFox
cmake_minimum_required(VERSION 2.8.3)
project(%s)
include_directories("%s")
add_custom_target(
  build
  ALL %s
  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
  VERBATIM
  %s
)
"""

	if cmd_env:
		for chr in ["\\", "\"", "(", ")", "#", "^"]:
			cmd_env = cmd_env.replace(chr, "\\" + chr)
		cmd_env = cmd_env.replace("$", "\\$")

	all_files = ["\"%s\"" % file for file in cxx_findfiles(all_files)]
	includedirs = ["."] + includedirs

	with open(filename, "w") as f:
		f.write(text % (
			prj_name,
			";".join(includedirs),
			cmd_env + " COMMAND ninja" if cmd_env else "ninja",
			"SOURCES " + " ".join(all_files) if all_files else ""
		))
Beispiel #3
0
def gen_qtcreator(all_files, defines, includedirs, prj_name, buildfox_name, cmd_env, ninja_gen_mode):
	gen_make(buildfox_name, cmd_env, ninja_gen_mode)

	all_files = ["Makefile", buildfox_name] + cxx_findfiles(all_files)
	includedirs = ["."] + includedirs

	with open("%s.creator" % prj_name, "w") as f:
		f.write("[General]\n")
	with open("%s.config" % prj_name, "w") as f:
		f.write("%s\n" % "\n".join(["#define %s" % define for define in defines]))
	with open("%s.includes" % prj_name, "w") as f:
		f.write("%s\n" % "\n".join(includedirs))
	with open("%s.files" % prj_name, "w") as f:
		f.write("%s\n" % "\n".join(all_files))
Beispiel #4
0
def gen_xcode(all_files, includedirs, prj_name, buildfox_name, cmd_env, ninja_gen_mode):
	gen_make(buildfox_name, cmd_env, ninja_gen_mode)

	all_files = cxx_findfiles(all_files)
	includedirs = [".", "build/bin_debug"] + includedirs

	prj_location = prj_name + ".xcodeproj"
	if not os.path.exists(prj_location):
		os.makedirs(prj_location)

	ref = json.loads(xcode_reference_prj)
	import mod_pbxproj # TODO would be nice to remove external dependency before release, because mod_pbxproj doesn't work with python3
	prj = mod_pbxproj.XcodeProject(ref, prj_location + "/project.pbxproj")

	target = prj.get_build_phases('PBXLegacyTarget')
	target[0]["buildWorkingDirectory"] = os.path.abspath(prj_location + "/..")

	for file in all_files:
		prj.add_file_if_doesnt_exist(os.path.relpath(file, prj_location + "/.."))

	prj.save()
def gen_xcode(all_files, includedirs, prj_name, buildfox_name, cmd_env,
              ninja_gen_mode):
    gen_make(buildfox_name, cmd_env, ninja_gen_mode)

    all_files = cxx_findfiles(all_files)
    includedirs = [".", "build/bin_debug"] + includedirs

    prj_location = prj_name + ".xcodeproj"
    if not os.path.exists(prj_location):
        os.makedirs(prj_location)

    ref = json.loads(xcode_reference_prj)
    import mod_pbxproj  # TODO would be nice to remove external dependency before release, because mod_pbxproj doesn't work with python3
    prj = mod_pbxproj.XcodeProject(ref, prj_location + "/project.pbxproj")

    target = prj.get_build_phases('PBXLegacyTarget')
    target[0]["buildWorkingDirectory"] = os.path.abspath(prj_location + "/..")

    for file in all_files:
        prj.add_file_if_doesnt_exist(
            os.path.relpath(file, prj_location + "/.."))

    prj.save()