コード例 #1
0
    def bootstrap(self, options):
        # Save command line options
        self._options = options

        # First build all required external libraries
        self.build_externals(options)

        # Now generate and build engine projects
        for platform in self.target_platforms:
            install_path = os.path.join(self.env.prebuilt, platform)
            binary_dir = os.path.join(self.env.projects, platform)
            prefix_path = os.path.join(self.env.dependencies, platform)

            # Create a CMake instance to build for this platform
            cm = cmake.CMake(
                self.env.cmake,
                toolchain=self.platform_toolchain(platform),
                install_prefix=install_path,
                prefix_path=prefix_path,
            )

            # Generate project
            cm.configure(self.platform_generator(platform), self.env.source,
                         binary_dir, self.platform_options(platform))

            # Build project
            if self.options.no_build is False:
                try:
                    cm.build_tree(binary_dir)
                except Exception:
                    pass
コード例 #2
0
    def build_externals(self, options):
        # Make sure to pull all submodules before building them
        git.checkout_submodules()

        if self.env.emscripten is None:
            print "Warning: '%s' environment variable is not set, Emscripten is disabled." % env.DREEMCHEST_EMSCRIPTEN
            options.no_emscripten = True

        if self.env.android is None:
            print "Warning: '%s' environment variable is not set, Android is disabled." % env.DREEMCHEST_ANDROID
            options.no_android = True

        # Now build each platform
        for platform in self.target_platforms:
            install_path = os.path.join(self.env.dependencies, platform)
            binary_dir = self.env.bootstrap_temp_dir
            source_dir = self.env.externals

            # Create a CMake instance to build for this platform
            cm = cmake.CMake(
                self.env.cmake,
                toolchain=self.platform_toolchain(platform),
                install_prefix=install_path,
                prefix_path=install_path,
            )

            # Build all external libraries
            for external in self.externals:
                name = external['name']
                cmake_options = external[
                    'options'] if 'options' in external.keys() else dict()
                source = external['source'] if 'source' in external.keys(
                ) else name
                platform_name = platform.lower()
                platform_options = external[
                    platform_name] if platform_name in external.keys(
                    ) else dict()

                if 'disabled' in platform_options.keys(
                ) and platform_options['disabled']:
                    continue

                if 'options' in platform_options.keys():
                    cmake_options.update(platform_options['options'])

                cmake_options.update(self.platform_options(platform))

                cm.build(self.platform_generator(platform),
                         os.path.join(source_dir, source),
                         os.path.join(binary_dir, name),
                         options=cmake_options)

            shutil.rmtree(binary_dir)
コード例 #3
0
    def configure(self, options):
        """Performs iOS build system configuration"""

        # Perform basic build configuration
        cmake_parameters = self._prepare(options)

        # Invoke a CMake command to generate a build system
        install_path = os.path.join(self.env.prebuilt, 'iOS')
        prefix_path = os.path.join(self.env.dependencies, 'iOS')
        cm = cmake.CMake(self.env.cmake,
                         prefix_path=prefix_path,
                         install_prefix=install_path)
        cm.configure('Xcode', options.source, options.output, cmake_parameters)
コード例 #4
0
    def configure(self, options):
        """Performs iOS build system configuration"""

        # Perform basic build configuration
        cmake_parameters = self._prepare(options)
        cmake_parameters['EMSCRIPTEN_ROOT_PATH'] = self.env.emscripten

        # Invoke a CMake command to generate a build system
        install_path = os.path.join(self.env.prebuilt, 'Emscripten')
        prefix_path = os.path.join(self.env.dependencies, 'Emscripten')
        cm = cmake.CMake(self.env.cmake,
                         prefix_path=prefix_path,
                         install_prefix=install_path)
        cm.configure('Unix Makefiles', options.source, options.output,
                     cmake_parameters)
コード例 #5
0
    def configure(self, options):
        """Performs iOS build system configuration"""

        # Perform basic build configuration
        cmake_parameters = self._prepare(options)
        cmake_parameters['ANDROID_NATIVE_API_LEVEL'] = 'android-24'
        cmake_parameters['ANDROID_NDK'] = self.env.android_ndk

        # Invoke a CMake command to generate a build system
        install_path = os.path.join(self.env.prebuilt, 'Android')
        prefix_path = os.path.join(self.env.dependencies, 'Android')
        cm = cmake.CMake(self.env.cmake,
                         prefix_path=prefix_path,
                         install_prefix=install_path)
        cm.configure('Unix Makefiles', options.source, options.output,
                     cmake_parameters)
コード例 #6
0
def temp_build_dir(lib_name, build_path=None):
    if build_path is None:
        Log.warn("Building in tmp directory")
        folder = tempfile.mkdtemp(prefix='cpy-')
    else:
        Log.info("Building at {}".format(build_path))
        assert os.path.exists(build_path), "Build path must exist!"
        folder = build_path

    targ = cmake.Target(lib_name, ['test.cc'], {
        'Boost': '1.45.0',
        'PythonLibs': '2.7',
        'Eigen3': None
    },
                        executable=False)

    cmake_file = cmake.CMake('.', python=True)
    cmake_file.add_target(targ)
    formatting.put_file(folder, 'CMakeLists.txt', cmake_file.text)

    build_folder = os.path.join(folder, 'build')
    os.mkdir(build_folder)
    return folder
コード例 #7
0
ファイル: converter.py プロジェクト: phodina/ProjectConverter
    parser.add_argument("format", choices=("ewp", "uvprojx"))
    parser.add_argument("path", type=str, help="Root directory of project")
    #"--ewp", help="Search for *.EWP file in project structure", action='store_true')
    #parser.add_argument("--uvprojx", help="Search for *.UPROJX file in project structure", action='store_true')
    args = parser.parse_args()

    if os.path.isdir(args.path):
        if args.format == 'ewp':
            print('Looking for *.ewp file in ' + args.path)
            filename = find_file(args.path, '.ewp')
            if len(filename):
                print('Found project file: ' + filename)
                project = ewpproject.EWPProject(args.path, filename)
                project.parseProject()
                project.displaySummary()
                cmakefile = cmake.CMake(project.getProject(), args.path)
                cmakefile.populateCMake()
            else:
                print('No project *.ewp file found')
        elif args.format == 'uvprojx':
            print('Looking for *.uvprojx file in ' + args.path)
            filename = find_file(args.path, '.uvprojx')
            if len(filename):
                print('Found project file: ' + filename)
                project = uvprojxproject.UVPROJXProject(args.path, filename)
                project.parseProject()
                project.displaySummary()

                cmakefile = cmake.CMake(project.getProject(), args.path)
                cmakefile.populateCMake()
            else:
コード例 #8
0
def parse_argument():
    """
    Main script : define arguments and send to convertdata.
    """

    data = {
        'vcxproj': None,
        'cmake': None,
        'additional_code': None,
        'includes': None,
        'dependencies': None,
        'cmake_output': None,
        'data': None
    }

    # Init parser
    parser = argparse.ArgumentParser(
        description='Convert file.vcxproj to CMakelists.txt')
    parser.add_argument('-p',
                        help='absolute or relative path of a file.vcxproj')
    parser.add_argument('-o', help='define output.')
    parser.add_argument(
        '-a',
        help='import cmake code from file.cmake to your final CMakeLists.txt')
    parser.add_argument(
        '-D',
        help='replace dependencies found in .vcxproj, separated by colons.')
    parser.add_argument('-O',
                        help='define output of artefact produces by CMake.')
    parser.add_argument(
        '-i',
        help='add include directories in CMakeLists.txt. Default : False')

    # Get args
    args = parser.parse_args()

    # Vcxproj Path
    if args.p is not None:
        temp_path = os.path.splitext(args.p)
        if temp_path[1] == '.vcxproj':
            msg.send('Project to convert = ' + args.p, '')
            project = vcxproj.Vcxproj()
            project.create_data(args.p)
            data['vcxproj'] = project.get_data()

    # CMakeLists.txt output
    if args.o is not None:
        cmakelists = cmake.CMake()
        if os.path.exists(args.o):
            cmakelists.create_cmake(args.o)
            data['cmake'] = cmakelists.get_cmake()
        else:
            msg.send(
                'This path does not exist. CMakeList.txt will be generated in current directory.',
                'error')
            cmakelists.create_cmake()
        data['cmake'] = cmakelists.get_cmake()
    else:
        cmakelists = cmake.CMake()
        cmakelists.create_cmake()
        data['cmake'] = cmakelists.get_cmake()

    # CMake additional Code
    if args.a is not None:
        data['additional_code'] = args.a

    # If replace Dependencies
    if args.D is not None:
        data['dependencies'] = args.D.split(':')

    # Define Output of CMake artefact
    if args.O is not None:
        data['cmake_output'] = args.O

    # Add include directories found in vcxproj
    if args.i is not None:
        if args.i == 'True':
            data['includes'] = True

    # Give all to class: conversata
    all_data = cv.ConvertData(data)
    all_data.create_data()