opencvwxs.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # @brief WiX wxs file generator for omniORB
00004 # @date $Date$
00005 # @author Norkai Ando <n-ando@aist.go.jp>
00006 #
00007 # Copyright (C) 2010
00008 #     Noriaki Ando
00009 #     Intelligent Systems Research Institute,
00010 #     National Institute of
00011 #         Advanced Industrial Science and Technology (AIST), Japan
00012 #     All rights reserved.
00013 #
00014 # $Id$
00015 #
00016 
00017 OpenCV_files = "README OpenCVConfig.cmake"
00018 
00019 data = [
00020     ("",                OpenCV_files),
00021     ("bin",             "*.dll"),
00022     ("include/opencv",  "*.h *.hpp"),
00023     ("lib",             "*.lib"),
00024     ("doc",             "license.txt opencv.pdf")
00025 ]
00026 
00027 import os
00028 base_dir = os.getenv("OPENCV_ROOT")
00029 base_dir = base_dir.replace("\"", "")
00030 
00031 if base_dir == None:
00032     base_dir="C:\\OpenCV2.1"
00033 else:
00034     base_dir += "\\"
00035 
00036 def path_to_dir_id(path, prefix):
00037     # path = "bin/x86_win32" prefix = "omni"
00038     # output = "omni_bin_x86_win32"
00039     # "." -> "_"
00040     output = prefix + "_" + "_".join(path.split("/"))
00041     return output.replace(".", "_")
00042 
00043 
00044 def path_to_comp_id(path, prefix):
00045     # path = "bin/x86_win32" prefix = "omni"
00046     # output = "OmniBinX86_win32"
00047     # "." -> "_"
00048     output = prefix
00049     for c in path.split("/"):
00050         output += c.capitalize()
00051     return output.replace(".", "_")
00052 
00053 import makewxs
00054 
00055 for (path, files) in data:
00056     # wxs component name
00057     comp_name = path_to_comp_id(path, "OpenCV")
00058     # wxs directory name
00059     dir_name = path_to_dir_id(path, "OpenCV")
00060 
00061     path = path.replace("/", "\\")
00062 
00063     # full path to target directory
00064     full_path = base_dir + "\\\\" + path
00065 
00066     import glob
00067     flist = []
00068     for f in files.split(" "):
00069         flist += glob.glob(full_path + "\\" + f)
00070 
00071     cmd = ["flist",
00072            "-c", comp_name,
00073            "-o", dir_name + ".yaml",
00074            "-p",  base_dir + path]
00075     cmd += flist
00076 
00077     makewxs.main(cmd)
00078 
00079 import re
00080 if None != re.search('2\.2',base_dir):
00081     cmd = ["wxs",
00082            "-o", "OpenCV_inc.wxs",
00083            "-i", "OpenCV22_inc.wxs.in"]
00084 else:
00085     cmd = ["wxs",
00086            "-o", "OpenCV_inc.wxs",
00087            "-i", "OpenCV_inc.wxs.in"]
00088 
00089 cmd += glob.glob("*.yaml")
00090 makewxs.main(cmd)


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:16