def copy_dependence(items, targetPath, buildType): """""" for itemName in items: binaryPath = os.path.join(targetPath, itemName) # if windows, copy dll files if platform.system() == "Windows" or platform.system() == "Microsoft": dllPath = os.path.join(build_common.rootPath, "build", build_common.branchName, "bin") build_common.copyPath(dllPath, binaryPath, ["debug", "release"]) build_common.copyPath(os.path.join(dllPath, buildType), binaryPath) dllPath = os.path.join(build_common.rootPath, "build", build_common.branchName, "CoreSDK", "lib", "qt", buildType, "nbpal.dll") shutil.copy(dllPath, binaryPath) # if linux, copy start up script if platform.system() == "Linux": if os.environ.get("BOARD") == "jetson": scriptPath = os.path.join(build_common.rootPath, "sampleapp", build_common.branchName, itemName, "startscript", "startup_jetson.sh") else: scriptPath = os.path.join(build_common.rootPath, "sampleapp", build_common.branchName, itemName, "startscript", "startup.sh") if os.path.isfile(scriptPath): shutil.copy(scriptPath, binaryPath)
def copy_ccc_libaries(targetPath, buildType): """""" libPath = os.path.join(build_common.curPath, "CoreSDK", "lib", "qt", buildType) if not os.path.isdir(os.path.join(targetPath, "lib")): os.mkdir(os.path.join(targetPath, "lib")) build_common.copyPath(libPath, os.path.join(targetPath, "lib"))
def copy_libraries(items, targetPath, buildType): """""" if os.path.isdir(os.path.join(targetPath, "lib")): build_common.deletePath(os.path.join(targetPath, "lib")) os.mkdir(os.path.join(targetPath, "lib")) build_common.copyPath( os.path.join(build_common.outputRoot, buildType, "lib"), os.path.join(targetPath, "lib")) return True
def package(targetPath): """""" if os.path.isdir( os.path.join(targetPath,"assets") ): build_common.deletePath(os.path.join(targetPath,"assets")) os.mkdir(os.path.join(targetPath,"assets")) resourcePath = os.path.join(build_common.rootPath, "mapkit3d", build_common.branchName, "resource") build_common.copyPath(resourcePath, os.path.join(targetPath, "assets") ) resourcePath = os.path.join(build_common.rootPath, "navigationkit", build_common.branchName, "resource") build_common.copyPath(resourcePath, os.path.join(targetPath, "assets")) return True
def build_copy_wayland_sample(targetPath): """""" itemName = "waylandCompositorSample" waylandSamplePath = os.path.join(build_common.rootPath,"sampleapp", build_common.branchName, itemName) os.chdir(os.path.join(waylandSamplePath, "demo")) os.system("qmake") os.system("make clean") os.system("make") binaryPath = os.path.join(targetPath, "bin", itemName) os.mkdir(binaryPath) build_common.copyPath(waylandSamplePath,binaryPath) samplePath = os.path.join(targetPath, "samples", itemName) os.mkdir(samplePath) build_common.copyPath(waylandSamplePath,samplePath)
def copy_headers(items, targetPath): """""" if os.path.isdir(os.path.join(targetPath, "include")): build_common.deletePath(os.path.join(targetPath, "include")) os.mkdir(os.path.join(targetPath, "include")) for item in items: os.mkdir(os.path.join(targetPath, "include", item)) itemInclude = os.path.join(build_common.rootPath, item, build_common.branchName, "include") build_common.copyPath(itemInclude, os.path.join(targetPath, "include", item), ["private", "protected"]) return True
def copy_resources(items, targetPath): """""" testCodeRoot = os.path.join(build_common.rootPath, "testapp", build_common.branchName) for sampleName in items: resourcePath = os.path.join(testCodeRoot, sampleName, "resource") if not os.path.isdir(os.path.join(targetPath, sampleName)): os.mkdir(os.path.join(targetPath, sampleName)) if not os.path.isdir(os.path.join(targetPath, sampleName, "resource")): os.mkdir(os.path.join(targetPath, sampleName, "resource")) build_common.copyPath(resourcePath, os.path.join(targetPath, sampleName, "resource")) if sampleName == "mapkit3d_sample": resourcePath = os.path.join(build_common.rootPath, "mapkit3d", build_common.branchName, "resource") build_common.copyPath( resourcePath, os.path.join(targetPath, sampleName, "resource")) if sampleName == "navkit_sample": resourcePath = os.path.join(build_common.rootPath, "navigationkit", build_common.branchName, "resource") build_common.copyPath(resourcePath, os.path.join(targetPath, sampleName, "")) if sampleName == "navigationuikit_sample": resourcePath = os.path.join(build_common.rootPath, "navigationuikit", build_common.branchName, "resource") build_common.copyPath( resourcePath, os.path.join(targetPath, sampleName, "resource")) resourcePath = os.path.join(build_common.rootPath, "navigationkit", build_common.branchName, "resource") build_common.copyPath( resourcePath, os.path.join(targetPath, sampleName, "resource"))
def prepare(items, rootPath): # copy source code to root path if os.path.isdir(os.path.join(rootPath, "samples")): build_common.deletePath(os.path.join(rootPath, "samples")) os.mkdir(os.path.join(rootPath, "samples")) sampleCodeRoot = os.path.join(build_common.rootPath, "sampleapp", build_common.branchName) build_common.copyPath(os.path.join(sampleCodeRoot, "util"), os.path.join(rootPath, "samples", "util")) for item in items: os.mkdir(os.path.join(rootPath, "samples", item)) build_common.copyPath(os.path.join(sampleCodeRoot, item), os.path.join(rootPath, "samples", item), ["startscript"]) # copy library folder to ../../sampleapp tempLibraryFolder = os.path.join(build_common.curPath, "../../sampleapp/library") if os.path.isdir(tempLibraryFolder): build_common.deletePath(tempLibraryFolder) os.mkdir(tempLibraryFolder) if not os.path.isdir(os.path.join(rootPath, "library")): return False build_common.copyPath(os.path.join(rootPath, "library"), tempLibraryFolder) # get current server token from server_config.txt serverConfsFile = open( os.path.join(build_common.curPath, "server_configurations.txt"), "r") configs = serverConfsFile.readlines() serverConfsFile.close() token = "" if len(configs) > 0: token = configs[0].split(",")[1] token = token.strip().strip("\"") # generate servertoken.h tokenHeaderPath = os.path.join(sampleCodeRoot, "util", "include", "servertoken.h") if os.path.isfile(tokenHeaderPath): os.chmod( tokenHeaderPath, stat.S_IWRITE | stat.S_IWGRP | stat.S_IWOTH | stat.S_IREAD | stat.S_IRGRP | stat.S_IROTH) fileObj = open(tokenHeaderPath, 'r') content = fileObj.read() fileObj.close() content = content.replace("$YOUR_TOKEN", token) fileObj = open(tokenHeaderPath, 'w') fileObj.write(content) fileObj.close() return True
print "build ltk libraries failed" print "BUILD FAILED" exit() build_LTK.copyHeaders(ltkItems, targetPath) build_LTK.copyTemplatePro(targetPath) build_copy_ccc.copyCCCLibs(targetPath) # copy the library to the specified locatoin print "package--copying LTK SDK to sampleapp/library" tempLibraryFolder = os.path.join(build_common.curPath, "../../sampleapp/library") if os.path.isdir(tempLibraryFolder): build_common.deletePath(tempLibraryFolder) os.mkdir(tempLibraryFolder) build_common.copyPath(targetPath, tempLibraryFolder) sampleItems = ["mapkit3d_sample"] # copy source code to versionPath build_sample_source_code.copySourceCode(sampleItems, versionPath) # build sample app print "package--compiling sample app" targetPath = os.path.join(versionPath, "bin") if os.path.isdir(targetPath): build_common.deletePath(targetPath) os.mkdir(targetPath) for item in sampleItems: if not build_samples.buildSample(item, os.path.join(targetPath, item)): print "build sample apps failed"
def copy_items(items, targetPath, buildType): """""" sourceRootPath = os.path.join(build_common.rootPath, "thirdparty", build_common.branchName, "bin") Items = ["am", "automotivedemo", "Qt5.8.0", "neptuneui", "qtapplicationmanager"] for Item in Items: destPath = os.path.join(targetPath, "bin", "thirdparty", Item) if not os.path.isdir(destPath): os.makedirs(destPath) if Item == "qtapplicationmanager": appmanPath = os.path.join(build_common.rootPath, "thirdparty", build_common.branchName, Item) os.chdir(appmanPath) os.system("qmake") os.system("make") appmanBinPath = os.path.join(appmanPath,"bin") ItemDestBinPath = os.path.join(destPath, "bin") if not os.path.isdir(ItemDestBinPath): os.makedirs(ItemDestBinPath) build_common.copyPath(appmanBinPath,ItemDestBinPath) else: build_common.copyPath(os.path.join(sourceRootPath, Item), destPath) locationStudioPath = os.path.join(targetPath, "bin", "thirdparty", "locationstudio") if not os.path.isdir(locationStudioPath): os.makedirs(locationStudioPath) ncdbPath = os.path.join(locationStudioPath, "libs", "ncdb") if not os.path.isdir(ncdbPath): os.makedirs(ncdbPath) pngPath = os.path.join(locationStudioPath, "libs", "png") if not os.path.isdir(pngPath): os.makedirs(pngPath) # copy ncdb # if linux on hybrid, copy libncdb.so if len(sys.argv) > 2 and sys.argv[2].lower() == "hybrid" and platform.system() == "Linux": ncdbLibPath = os.path.join(build_common.rootPath, "build", build_common.branchName, "CoreSDK", "lib", "qt", buildType, "libncdb.so") if os.path.isfile(ncdbLibPath): print "ncdb source path "+ ncdbLibPath print "ncdb des path "+ ncdbPath shutil.copyfile(ncdbLibPath, os.path.join(ncdbPath, "libncdb.so")) # copy png pngSrcPath = os.path.join("/lib", "x86_64-linux-gnu", "libpng12.so.0.54.0") if os.path.isfile(pngSrcPath): shutil.copyfile(pngSrcPath, os.path.join(pngPath, "libpng12.so.0.54.0")) os.symlink("libpng12.so.0.54.0", os.path.join(pngPath, "libpng12.so.0")) resConsolePath = os.path.join(locationStudioPath, "res", "console", "resource") if not os.path.isdir(resConsolePath): os.makedirs(resConsolePath) resClusterPath = os.path.join(locationStudioPath, "res", "cluster", "resource") if not os.path.isdir(resClusterPath): os.makedirs(resClusterPath) resMapviewPluginPath = os.path.join(locationStudioPath, "res", "mapviewplugin", "resource") if not os.path.isdir(resMapviewPluginPath): os.makedirs(resMapviewPluginPath) # copy console and cluster resources build_common.copyPath(os.path.join(targetPath, "bin", "qtnavigator_console_plugin", "resource"), resConsolePath) build_common.copyPath(os.path.join(targetPath, "bin", "qtnavigator_cluster_plugin", "resource"), resClusterPath) build_common.copyPath(os.path.join(targetPath, "bin", "mapviewplugin", "resource"), resMapviewPluginPath) #copy install script shutil.copyfile(os.path.join(build_common.rootPath, "thirdparty", build_common.branchName, "automotivedemo", "install_automotive.sh"), os.path.join(targetPath, "install_automotive.sh")) return True