Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from distutils.ccompiler import new_compiler
- from sysconfig import get_paths
- import os
- project_name = "slimey_project"
- source = ['source1.c']
- include_dirs = ['include']
- build_dir = os.path.join(os.path.dirname(__file__), 'build')
- class StaticLib(Command):
- description = 'build static lib'
- user_options = [] # do not remove, needs to be stubbed out!
- python_info = get_paths()
- def initialize_options(self):
- pass
- def finalize_options(self):
- pass
- def run(self):
- # Create compiler with default options
- c = new_compiler()
- # Optionally add include directories etc.
- for d in include_dirs:
- c.add_include_dir(d)
- c.add_include_dir(self.python_info['include'])
- # Compile into .o files
- objects = c.compile(sources)
- # Create static or shared library
- c.create_static_lib(objects, project_name, output_dir=build_dir)
Add Comment
Please, Sign In to add comment