52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
import os
|
|
import sipconfig
|
|
|
|
script_dir = os.path.dirname(os.path.realpath(Dir("#/Sconstruct").abspath))
|
|
build_dir = os.path.join(script_dir, "build")
|
|
src_dir = os.path.join(script_dir, "src")
|
|
sip_dir = os.path.join(script_dir, "sip")
|
|
#generate install dir
|
|
install_dir = os.path.join(script_dir, "..", "rdpy", "fast")
|
|
|
|
def build_sip(target, source, env):
|
|
# Get the SIP configuration information.
|
|
config = sipconfig.Configuration()
|
|
|
|
# Run SIP to generate the code.
|
|
os.system(" ".join([config.sip_bin, "-c", "src", str(source[0])]))
|
|
|
|
# Create the Makefile.
|
|
#makefile = sipconfig.SIPModuleMakefile(config, str(target[0]))
|
|
|
|
# Add the library we are wrapping. The name doesn't include any platform
|
|
# specific prefixes or extensions (e.g. the "lib" prefix on UNIX, or the
|
|
# ".dll" extension on Windows).
|
|
#makefile.extra_libs = ["rle"]
|
|
|
|
#add build directory as extra lib
|
|
#makefile.extra_lib_dirs = [os.path.dirname(str(target[0]))]
|
|
|
|
# Generate the Makefile itself.
|
|
#makefile.generate()
|
|
|
|
|
|
#building library
|
|
env = Environment()
|
|
env.Append(BUILDERS = {'Sip' : Builder(action = build_sip)})
|
|
env.VariantDir('build', 'src', duplicate=0)
|
|
|
|
cppdefines = {}
|
|
targetName = os.path.join(build_dir, "libfastrdpy.so")
|
|
|
|
sources = [Glob(os.path.join(src_dir, '*.c'))]
|
|
|
|
env.Append(CPPDEFINES = cppdefines);
|
|
|
|
libSip = env.Sip([os.path.join(build_dir, "rle.sbf")], [os.path.join(sip_dir, "rle.sip")])
|
|
|
|
libC = env.SharedLibrary(target = targetName,
|
|
source = sources
|
|
)
|
|
|
|
env.Depends(libSip, libC)
|