Source

dark-hammer / src / engine / wscript

The branch '0.4.7' does not exist.
#! /usr/bin/env python

import os

def build(bld):
    env = bld.env.derive()
    
    files = [
        "anim.c",
        "camera.c",
        "cmp-mgr.c",
        "cmp-register-main.c",
        "console.c",
        "debug-hud.c",
        "engine.c",
        "gfx.c",
        "gfx-billboard.c",
        "gfx-canvas.c",
        "gfx-font.c",
        "gfx-model.c",
        "gfx-occ.c",
        "gfx-postfx.c",
        "gfx-shader.c",
        "gfx-texture.c",
        "gui.c",
        "hwinfo.c",
        "input.c",
        "lod-scheme.c",
        "phx.c",
        "phx-prefab.c",
        "prf-mgr.c",
        "res-mgr.c",
        "scene-mgr.c",
        "script.c",
        "app.c"
    ]
    
    # components
    files.extend([
        "components/cmp-attachdock.c",
        "components/cmp-attachment.c",
        "components/cmp-bounds.c",
        "components/cmp-camera.c",
        "components/cmp-light.c",
        "components/cmp-lodmodel.c",
        "components/cmp-model.c",
        "components/cmp-rbody.c",
        "components/cmp-trigger.c",
        "components/cmp-xform.c",
        'components/cmp-anim.c'])
        
    # lua
    files.extend([
        "luabind/luacore_wrap.cxx",
        "luabind/luaengine_wrap.cxx",
        "luabind/script-lua-core.cpp",
        "luabind/script-lua-engine.cpp"])
        
    ## physx
    files.extend([
        "physx/phx-device-px.cpp"])

    env.prepend_value("INCLUDES", env.PHYSX_INCLUDEDIR)
    env.append_unique("LIBPATH", env.PHYSX_LIBDIR)
        
    if env.PLATFORM == "LINUX" or env.PLATFORM == "OSX":
        env.append_unique("LIB", [  "PhysX3Extensions",
                                    "PhysX3",
                                    "SimulationController",
                                    "PxTask",
                                    "PhysXProfileSDK",
                                    "LowLevel",
                                    "LowLevelCloth",
                                    "SceneQuery",
                                    "PhysX3Common",
                                    "PhysX3CharacterKinematic",
                                    "PhysX3Vehicle",
                                    "PhysX3Cooking",
                                    "RepX3"])
    elif env.PLATFORM == "WIN":
        rel_suffix = ""
        if env.DEBUG:
            rel_suffix = "DEBUG"
        if env.DEST_CPU == "amd64" or env.DEST_CPU == "x86_64":
            arch_suffix = "_x64"
        else:
            arch_suffix = "_x86"
            
        env.append_unique("LIB", [  "PhysX3" + rel_suffix + arch_suffix,
                                    "PhysX3Common" + rel_suffix + arch_suffix,
                                    "PhysX3Extensions" + rel_suffix,
                                    "PhysXProfileSDK" + rel_suffix])
    # renderpaths
    files.extend([
        "renderpaths/gfx-csm.c",
        "renderpaths/gfx-deferred.c"])
        
    ## graphics
    if env.GFX_DEVICE == "D3D":
        files.extend([
            "d3d/gfx-cmdqueue-d3d.cpp",
            "d3d/gfx-device-d3d.cpp",
            "d3d/gfx-shader-d3d.cpp",
            "d3d/app-d3d.cpp"])
        env.prepend_value("LIBPATH", env.DX_LIBDIR)
        env.prepend_value("INCLUDES", env.DX_INCLUDEDIR)
        env.append_unique("LIB", ["d3dcompiler", "dxguid", "d3d11", "dxgi"])
    elif env.GFX_DEVICE == "GL":
        files.extend([
            "gl/gfx-cmdqueue-gl.c",
            "gl/gfx-device-gl.c",
            "gl/gfx-shader-gl.c",
            "gl/app-gl.c"])
        
        if env.PLATFORM == "LINUX":
            env.append_unique("LIB", "GL")
        elif env.PLATFORM == "WIN":
            env.append_unique("LIB", "OpenGL32")
            
    # platform dependent sources
    if env.PLATFORM == "WIN":
        files.extend(['platform/win/hwinfo-win.c'])
    elif env.PLATFORM == "LINUX":
        files.extend(['platform/unix/hwinfo-lnx.c'])
    elif env.PLATFORM == "OSX":
        files.extend(['platform/osx/hwinfo-osx.c'])
        
    # pymodule
    if bld.variant == 'pymodule':
        files.extend(['pybind/pyengine_wrap.c', 'pybind/pyalloc.c'])
        env.prepend_value('LIBPATH', env.PY_LIBDIR)
        env.prepend_value('INCLUDES', env.PY_INCLUDEDIR)

    ## Defines
    env.append_unique("DEFINES", "_ENGINE_EXPORT_")

    ## includes
    env.prepend_value("INCLUDES", os.path.abspath(env.ROOTDIR + "/include/engine"))   
    env.prepend_value("INCLUDES", os.path.abspath(env.ROOTDIR + "/3rdparty/include/lua"))
    
    ## general libs
    if env.PLATFORM == "LINUX":
        env.append_unique("LIB", "m")
        env.append_unique("LIB", ["X11", "Xi", "Xrandr", "Xxf86vm"])
        # env.append_unique("LIB", "stdc++")
    elif env.PLATFORM == "OSX":
        env.append_unique("FRAMEWORK", ["Cocoa", "CoreFoundation", "IOKit", "OpenGL"])
    elif env.PLATFORM == "WIN":
        dwarnings = "/wd597 /wd791"
        env.append_unique("CFLAGS", dwarnings.split())
        env.append_unique("CXXFLAGS", dwarnings.split())
        
        env.append_unique("LIB", ["Advapi32", "User32", "Gdi32"])
        env.append_unique("LINKFLAGS", [
            '/NODEFAULTLIB:"LIBCMTD.LIB"', 
            '/NODEFAULTLIB:"LIBCMT.LIB"'])        

    # additional pymodule installation
    targetname = 'dh_engine'
    installdir = '${BINDIR}'
    if bld.variant == 'pymodule':
        bld.install_files('${PYDIR}', 'pybind/dheng.py')
        targetname = 'dheng'
        installdir = '${PYDIR}'
        if env.PLATFORM == 'LINUX':
            env.cxxshlib_PATTERN = '_%s.so'
            env.cshlib_PATTERN = '_%s.so'
        elif env.PLATFORM == 'WIN':
            env.cxxshlib_PATTERN = '_%s.pyd'
            env.cshlib_PATTERN = '_%s.pyd'

    # build
    bld.shlib(
        source = files,
        name = "dh_engine",
        target = targetname + env.SUFFIX,
        install_path = installdir,
        env = env,
        use = [
            "dh_core",
            "3rdparty_lua",
            "3rdparty_mongoose",
            "3rdparty_gl3w",
            "3rdparty_glfw"])
        
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.