def setup_application(application, source, datapath, scons): print "Configuring application", application, "...", data= tools.get_application_description(source, application, datapath) for d in data["required_dependencies"]: if not tools.get_dependency_info(d, datapath)["ok"]: write_no_ok(application, scons) #exits dependencies = data["required_dependencies"] unfound_dependencies = [] for d in data["optional_dependencies"]: if tools.get_dependency_info(d, datapath)["ok"]: dependencies.append(d) else: unfound_dependencies.append(d) for d in data["required_modules"]: if not tools.get_module_info(d, datapath)["ok"]: write_no_ok(application, scons) # exits modules= data["required_modules"] unfound_modules = [] for d in data["optional_modules"]: if tools.get_module_info(d, datapath)["ok"]: modules.append(d) else: unfound_modules.append(d) all_modules=tools.get_dependent_modules(modules, datapath) link_py(os.path.join(source, "applications", application)) write_ok(application, all_modules, unfound_modules, tools.get_dependent_dependencies(all_modules, dependencies, datapath), unfound_dependencies)
def setup_application(application, source, datapath, apps): print "Configuring application", application, "...", data = tools.get_application_description(source, application, datapath) for d in data["required_dependencies"]: if not tools.get_dependency_info(d, datapath)["ok"]: write_no_ok(application) # exits dependencies = data["required_dependencies"] unfound_dependencies = [] for d in data["optional_dependencies"]: if tools.get_dependency_info(d, datapath)["ok"]: dependencies.append(d) else: unfound_dependencies.append(d) for d in data["required_modules"]: if not tools.get_module_info(d, datapath)["ok"]: write_no_ok(application) # exits modules = data["required_modules"] unfound_modules = [] for d in data["optional_modules"]: if tools.get_module_info(d, datapath)["ok"]: modules.append(d) else: unfound_modules.append(d) all_modules = tools.get_dependent_modules(modules, datapath) link_py_apps(os.path.join(source, "applications", application)) make_doxygen(application, source, all_modules) make_overview(application, source, apps) write_ok( application, all_modules, unfound_modules, tools.get_dependent_dependencies(all_modules, dependencies, datapath), unfound_dependencies)
def setup_application(options, name, ordered): contents = [] path = os.path.join("applications", name) local = os.path.join(path, "Setup.cmake") if os.path.exists(local): contents.append("include(%s)" % tools.to_cmake_path(local)) values = {"name": name} values["NAME"] = name.upper() data = tools.get_application_description(".", name, "") all_modules = data["required_modules"] + tools.get_all_modules( ".", data["required_modules"], "", ordered) all_dependencies = tools.get_all_dependencies( ".", all_modules, "", ordered) + data["required_dependencies"] modules = ["${IMP_%s_LIBRARY}" % s for s in all_modules] dependencies = ["${%s_LIBRARIES}" % s.upper() for s in all_dependencies] values["modules"] = "\n".join(modules) values["tags"] = "\n".join(["${IMP_%s_DOC}" % m for m in all_modules]) values["dependencies"] = "\n".join(dependencies) values["module_deps"] = "\n".join("${IMP_%s}" % m for m in all_modules) exes = tools.get_application_executables(path) exedirs = sorted(set(sum([x[1] for x in exes], []))) localincludes = "\n ".join( ["${CMAKE_SOURCE_DIR}/" + tools.to_cmake_path(x) for x in exedirs]) bintmpl = """ add_executable("IMP.%(name)s-%(cname)s" %(cpps)s) target_link_libraries(IMP.%(name)s-%(cname)s %(modules)s %(dependencies)s) set_target_properties(IMP.%(name)s-%(cname)s PROPERTIES OUTPUT_NAME %(cname)s RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set_property(TARGET "IMP.%(name)s-%(cname)s" PROPERTY FOLDER "IMP.%(name)s") install(TARGETS IMP.%(name)s-%(cname)s DESTINATION ${CMAKE_INSTALL_BINDIR}) set(bins ${bins} IMP.%(name)s-%(cname)s) """ bins = [] for e in exes: cpps = e[0] cname = os.path.splitext(os.path.split(cpps[0])[1])[0] values["cname"] = cname values["cpps"] = "\n".join( ["${CMAKE_SOURCE_DIR}/%s" % tools.to_cmake_path(c) for c in cpps]) bins.append(bintmpl % values) values["bins"] = "\n".join(bins) values["includepath"] = get_dep_merged(all_modules, "include_path", ordered) + " " + localincludes values["libpath"] = get_dep_merged(all_modules, "link_path", ordered) values["swigpath"] = get_dep_merged(all_modules, "swig_path", ordered) pybins = get_app_sources(path, ["*"], tools.filter_pyapps) values["pybins"] = "\n".join(pybins) cppbins = [os.path.splitext(e[0][0])[0] for e in exes] values["bin_names"] = "\n".join([os.path.basename(x) \ for x in pybins + cppbins]) values["pytests"] = "\n".join( get_app_sources(os.path.join(path, "test"), ["test_*.py", "expensive_test_*.py"])) contents.append(application_template % values) out = os.path.join(path, "CMakeLists.txt") tools.rewrite(out, "\n".join(contents)) return out
def setup_application(options, name, ordered): contents = [] path = os.path.join("applications", name) local = os.path.join(path, "Setup.cmake") if os.path.exists(local): contents.append("include(%s)" % tools.to_cmake_path(local)) values = {"name": name} values["NAME"] = name.upper() data = tools.get_application_description(".", name, "") all_modules = data["required_modules"] + tools.get_all_modules(".", data["required_modules"], "", ordered) all_dependencies = tools.get_all_dependencies(".", all_modules, "", ordered) modules = ["${IMP_%s_LIBRARY}" % s for s in all_modules] dependencies = ["${%s_LIBRARIES}" % s.upper() for s in all_dependencies] values["modules"] = "\n".join(modules) values["tags"] = "\n".join(["${IMP_%s_DOC}" % m for m in all_modules]) values["dependencies"] = "\n".join(dependencies) values["module_deps"] = "\n".join("${IMP_%s}" % m for m in all_modules) exes = tools.get_application_executables(path) exedirs = list(set(sum([x[1] for x in exes], []))) exedirs.sort() localincludes = "\n ".join(["${CMAKE_SOURCE_DIR}/" + tools.to_cmake_path(x) for x in exedirs]) bintmpl = """ add_executable("IMP.%(name)s-%(cname)s" %(cpps)s) target_link_libraries(IMP.%(name)s-%(cname)s %(modules)s %(dependencies)s) set_target_properties(IMP.%(name)s-%(cname)s PROPERTIES OUTPUT_NAME %(cname)s RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") set_property(TARGET "IMP.%(name)s-%(cname)s" PROPERTY FOLDER "IMP.%(name)s") install(TARGETS IMP.%(name)s-%(cname)s DESTINATION ${CMAKE_INSTALL_BINDIR}) set(bins ${bins} IMP.%(name)s-%(cname)s) """ bins = [] for e in exes: cpps = e[0] cname = os.path.splitext(os.path.split(cpps[0])[1])[0] values["cname"] = cname values["cpps"] = "\n".join(["${CMAKE_SOURCE_DIR}/%s" % tools.to_cmake_path(c) for c in cpps]) bins.append(bintmpl % values) values["bins"] = "\n".join(bins) values["includepath"] = get_dep_merged(all_modules, "include_path", ordered) + " " + localincludes values["libpath"] = get_dep_merged(all_modules, "link_path", ordered) values["swigpath"] = get_dep_merged(all_modules, "swig_path", ordered) values["pybins"] = get_app_sources(path, ["*.py"]) values["pytests"] = get_app_sources(os.path.join(path, "test"), ["test_*.py", "expensive_test_*.py"]) contents.append(application_template % values) out = os.path.join(path, "CMakeLists.txt") tools.rewrite(out, "\n".join(contents)) return out