Welcome to mirror list, hosted at ThFree Co, Russian Federation.

FindSharedPtr.py « Modules « scons « build_files - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ba53f55d5637b5c15571ef8206069dd47553a88e (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
def FindSharedPtr(conf):
    """
    Detect shared_ptr availability
    """

    found = False
    namespace = None
    header = None

    if conf.CheckCXXHeader("memory"):
        # Finding the memory header doesn't mean that shared_ptr is in std
        # namespace.
        #
        # In particular, MSVC 2008 has shared_ptr declared in std::tr1.  In
        # order to support this, we do an extra check to see which namespace
        # should be used.

        if conf.CheckType('std::shared_ptr<int>', language = 'C++', includes="#include <memory>"):
            print("-- Found shared_ptr in std namespace using <memory> header.")
            namespace = 'std'
            header = 'memory'
        elif conf.CheckType('std::tr1::shared_ptr<int>', language = 'C++', includes="#include <memory>"):
            print("-- Found shared_ptr in std::tr1 namespace using <memory> header..")
            namespace = 'std::tr1'
            header = 'memory'

    if not namespace and conf.CheckCXXHeader("tr1/memory"):
        # Further, gcc defines shared_ptr in std::tr1 namespace and
        # <tr1/memory> is to be included for this. And what makes things
        # even more tricky is that gcc does have <memory> header, so
        # all the checks above wouldn't find shared_ptr.
        if conf.CheckType('std::tr1::shared_ptr<int>', language = 'C++', includes="#include <tr1/memory>"):
            print("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header..")
            namespace = 'std::tr1'
            header = 'tr1/memory'

    if not namespace:
        print("-- Unable to find shared_ptrred_map>.")

    conf.env['WITH_SHARED_PTR_SUPPORT'] = namespace and header
    conf.env['SHARED_PTR_NAMESPACE'] = namespace
    conf.env['SHARED_PTR_HEADER'] = header