summaryrefslogtreecommitdiffstats
blob: f7a8be2ac008c644d51c0b458bcaed482fc2719e (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
Import("env")

if env["TEST"] :
    includeFlagPrefix = ""
    if env["PLATFORM"] == "win32" :
        includeFlagPrefix = "/I"
    elif env["PLATFORM"] == "sunos" :
        includeFlagPrefix = "-I"
    else :
        includeFlagPrefix = "-isystem"
    cppflags = [(includeFlagPrefix + Dir("src/googletest/include").abspath), (includeFlagPrefix + Dir("src/googlemock/include").abspath)]

################################################################################
# Module flags
################################################################################

    if env["SCONS_STAGE"] == "flags" :
        env["GOOGLETEST_FLAGS"] = {
                "CPPPATH": [env.Dir(".")],
                "CPPFLAGS": cppflags,
                "LIBPATH": [env.Dir(".")],
                "LIBS": ["Swiften_GoogleTest"]
            }

################################################################################
# Build
################################################################################

    if env["SCONS_STAGE"] == "build" :
        myenv = env.Clone()
        myenv.Replace(CXXFLAGS = [flag for flag in env["CXXFLAGS"] if not flag.startswith("-W")])
        myenv.Append(CPPPATH = ["src/googletest/include", "src/googletest"])
        sources = [
            "src/googletest/src/gtest-all.cc"
            ]
        myenv.StaticLibrary("Swiften_GoogleTest", sources)