コード例 #1
0
    def build_shared_library(self, out_file, inc_files, link_files=[]):
        # Make sure the extension is valid
        if not out_file.endswith('.dll'):
            Print.exit(
                "Out file extension should be '.dll' not '.{0}'.".format(
                    out_file.split('.')[-1]))

        # Setup the messages
        task = 'Building'
        result = out_file
        plural = 'C# shared libraries'
        singular = 'C# shared library'
        command = '"{0}" {1} -target:library {2}{3} {4} {5}'.format(
            self._path, self.csflags, self._opt_out_file, out_file,
            str.join(' ', inc_files), str.join(' ', link_files))
        command = to_native(command)

        def setup():
            # Skip if the files have not changed since last build
            to_update = [to_native(out_file)]
            triggers = [to_native(t) for t in inc_files + link_files]
            if not FS.is_outdated(to_update, triggers):
                return False

            # Create the output directory if it does not exist
            FS.create_path_dirs(out_file)

            return True

        # Create the event
        event = Process.Event(task, result, plural, singular, command, setup)
        Process.add_event(event)
コード例 #2
0
    def build_object(self, o_file, cxx_files, i_files=[]):
        # Make sure the extension is valid
        Helpers.require_file_extension(o_file, '.o')

        # Setup the messages
        task = 'Building'
        result = o_file
        plural = 'C++ objects'
        singular = 'C++ object'
        command = '"{0}" {1} {2} {3}{4} {5} {6}'.format(
            self._path, self.cxxflags, self._opt_no_link, self._opt_out_file,
            o_file, str.join(' ', cxx_files), str.join(' ', i_files))
        command = to_native(command)

        def setup():
            # Skip if the files have not changed since last build
            to_update = [to_native(o_file)]
            triggers = [to_native(t) for t in cxx_files + i_files]
            if not FS.is_outdated(to_update, triggers):
                return False

            # Create the output directory if it does not exist
            FS.create_path_dirs(o_file)

            return True

        # Create the event
        event = Process.Event(task, result, plural, singular, command, setup)
        Process.add_event(event)
コード例 #3
0
ファイル: lib_raise_linker.py プロジェクト: workhorsy/raise
	def link_program(self, out_file, obj_files, i_files=[]):
		# Setup the messages
		task = 'Linking'
		result = out_file
		plural = 'programs'
		singular = 'program'
		command = "{0} {1}{2} {3} {4}".format(
					self.link,
					linker._opt_out_file,
					out_file,
					str.join(' ', obj_files),
					str.join(' ', i_files)
		)
		command = to_native(command)

		def setup():
			# Skip if the files have not changed since last build
			to_update = [to_native(out_file)]
			triggers = [to_native(t) for t in obj_files + i_files]
			if not FS.is_outdated(to_update, triggers):
				return False

			# Create the output directory if it does not exist
			FS.create_path_dirs(out_file)

			return True

		# Create the event
		event = Process.Event(task, result, plural, singular, command, setup)
		Process.add_event(event)
コード例 #4
0
    def build_interface(self, d_file, i_files=[]):
        # Setup the messages
        task = 'Building'
        result = d_file + 'i'
        plural = 'D interfaces'
        singular = 'D interface'

        f = FS.self_deleting_named_temporary_file()
        command = '"{0}" {1} {2} {3} {4} {5}{6}i {7}{8}'.format(
            self._path, self.dflags, self._opt_no_link, d_file,
            str.join(' ', i_files), self._opt_interface_file, d_file,
            self._opt_out_file, f.name)
        command = to_native(command)

        def setup():
            # Skip if the files have not changed since last build
            to_update = [d_file + 'i']
            triggers = [to_native(t) for t in i_files]
            if not FS.is_outdated(to_update, triggers):
                return False

            return True

        # Create the event
        event = Process.Event(task, result, plural, singular, command, setup)
        Process.add_event(event)
コード例 #5
0
def build_static_library(ar_file, o_files):
    # Make sure the extension is valid
    if not ar_file.endswith('.a'):
        Print.exit("Out file extension should be '.a' not '.{0}'.".format(
            ar_file.split('.')[-1]))

    # Setup the messages
    task = 'Building'
    result = ar_file
    plural = 'static libraries'
    singular = 'static library'
    command = "ar rcs " + \
      ar_file + " " + \
      str.join(' ', o_files)
    command = to_native(command)

    def setup():
        # Skip if the files have not changed since last build
        to_update = [to_native(ar_file)]
        triggers = [to_native(t) for t in o_files]
        if not FS.is_outdated(to_update, triggers):
            return False

        # Create the output directory if it does not exist
        FS.create_path_dirs(ar_file)

        return True

    # Create the event
    event = Process.Event(task, result, plural, singular, command, setup)
    Process.add_event(event)
コード例 #6
0
ファイル: lib_raise_c.py プロジェクト: workhorsy/raise
	def build_shared_library(self, so_file, o_files):
		# Make sure the extension is valid
		Helpers.require_file_extension(so_file, '.so')

		# Setup the messages
		task = 'Building'
		result = so_file
		plural = 'C shared libraries'
		singular = 'C shared library'
		command = "{0} {1} {2} {3} {4}{5}".format(
					self._name,
					self._opt_setup,
					self._opt_link,
					str.join(' ', o_files),
					self._opt_out_file,
					so_file)
		command = to_native(command)

		def setup():
			# Skip if the files have not changed since last build
			to_update = [to_native(so_file)]
			triggers = [to_native(t) for t in o_files]
			if not FS.is_outdated(to_update, triggers):
				return False

			# Create the output directory if it does not exist
			FS.create_path_dirs(so_file)

			return True

		# Create the event
		event = Process.Event(task, result, plural, singular, command, setup)
		Process.add_event(event)
コード例 #7
0
    def build_static_library(self,
                             o_file,
                             d_files,
                             i_files=[],
                             l_files=[],
                             generate_headers=False):
        # Make sure the extension is valid
        Helpers.require_file_extension(o_file, '.a')

        # Setup the messages
        task = 'Building'
        result = o_file
        plural = 'D static libraries'
        singular = 'D static library'

        command = '"{0}" {1} {2} {3}{4} {5} {6} {7}'.format(
            self._path, self.dflags, self._opt_lib, self._opt_out_file, o_file,
            str.join(' ', d_files), str.join(' ', i_files),
            str.join(' ', l_files))
        if generate_headers:
            command += "  {0}import {1}".format(
                self._opt_interface_dir,
                self._opt_interface,
            )
        command = to_native(command)

        def setup():
            # Skip if the files have not changed since last build
            to_update = [to_native(o_file)]
            triggers = [to_native(t) for t in d_files + i_files + l_files]
            if not FS.is_outdated(to_update, triggers):
                return False

            # Create the output directory if it does not exist
            FS.create_path_dirs(o_file)

            return True

        # Create the event
        event = Process.Event(task, result, plural, singular, command, setup)
        Process.add_event(event)