summaryrefslogtreecommitdiffstats
blob: 9f56c91dae85d3823e43dd4532fcf62b2a628b04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import os

Import('env')
Import('sluift_env')
Import('sluift_variant')
Import('sluift_sources')

if sluift_variant == 'exe' :
    common_objects = sluift_env.StaticObject(sluift_sources)

    sluift_exe_env = sluift_env.Clone()
    tokenize = sluift_exe_env.StaticObject("#/Sluift/tokenize.cpp")
    exe_sources = tokenize + [
        "#/Sluift/Console.cpp",
        "#/Sluift/Terminal.cpp",
        "#/Sluift/StandardTerminal.cpp",
        "#/Sluift/Completer.cpp",
        "#/Sluift/main.cpp",
    ]

    if sluift_exe_env.get("HAVE_EDITLINE", False) :
        sluift_exe_env.Append(CPPDEFINES = ["HAVE_EDITLINE"])
        sluift_exe_env.MergeFlags(sluift_exe_env["EDITLINE_FLAGS"])
        exe_sources += ["#/Sluift/EditlineTerminal.cpp"]

    env["SLUIFT"] = sluift_exe_env.Program("sluift", common_objects + exe_sources)
    if sluift_exe_env.get("SLUIFT_INSTALLDIR", "") :
        sluift_exe_env.Install(os.path.join(sluift_exe_env["SLUIFT_INSTALLDIR"], "bin"), env["SLUIFT"])

    # Unit tests
    env.Append(UNITTEST_OBJECTS = tokenize + ["#/Sluift/UnitTest/TokenizeTest.cpp"])
else :
    sluift_env["SLUIFT_DLL_SUFFIX"] = "${SHLIBSUFFIX}"
    if sluift_env["PLATFORM"] == "darwin" :
        sluift_env["SLUIFT_DLL_SUFFIX"] = ".so"
    sluift_dll = sluift_env.SharedLibrary(sluift_env.File("sluift${SLUIFT_DLL_SUFFIX}"), 
            sluift_sources + ["#/Sluift/dll.c"])
    if sluift_env.get("SLUIFT_INSTALLDIR", False) and sluift_env.get("LUA_VERSION", False) :
        sluift_env.Install(
                os.path.join(sluift_env["SLUIFT_INSTALLDIR"], "lib", "lua", sluift_env["LUA_VERSION"]), 
                sluift_dll)