示例#1
0
def generate_gyp(directory):
    with gyputil.gyp_file(test_gypfile, as_new=True, top_comment="!!!!!! Do not edit this file manually, it is automatically generated by gen_test_gyp.py") as g:
        tests = gyputil.find_files(directory, re.compile('^.*Test\.c(pp|c)$'))

        g._gyp['includes'] = [ 'test_common.gypi' ]

        for test in tests:
            print "Adding target for %s\n" % test
            target = {
                    'target_name': os.path.splitext(os.path.basename(test))[0],
                    'sources': [ os.path.join(*(test.split(os.path.sep)[1:])) ],
                    'type': 'executable',
                    "dependencies": [
                        "libgrapl",
                        "external/glfw-3.1.2/glfw.gyp:glfw"
                        ],
                    "include_dirs": [
                        "../test",
                        "../lib",
                        "../external/glfw-3.1.2/include"
                        ],
                    "includes": [
                        "../common.gypi"
                        ]
                    }
            g.add_target(target)
示例#2
0
this_script_dir = os.path.dirname(__file__)
lib_root = os.path.normpath(this_script_dir)

sys.path.insert(0, os.path.join(grapl_root, 'build', 'gyp', 'pylib'))
sys.path.insert(0, os.path.join(grapl_root, 'build', 'pylib'))

try:
    import gyputil
except ImportError:
    print('Could not use gyputil :(')
    sys.exit(1)

include_headers = os.path.join(lib_root, 'grapl.h')

print lib_root
files = gyputil.find_files(lib_root, re.compile('.*\.h$'))
print files

with open(include_headers, 'w') as f:
    f.seek(0)
    f.write("""
/* THIS FILE WAS GENERATED BY lib/gen_include.py DO NOT EDIT MANUALLY
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#pragma once
""")
    for x in files:
        filename = x[4:]
示例#3
0
lib_root = os.path.normpath(this_script_dir)


sys.path.insert(0, os.path.join(grapl_root, 'build', 'gyp', 'pylib'))
sys.path.insert(0, os.path.join(grapl_root, 'build', 'pylib'))

try:
    import gyputil
except ImportError:
    print('Could not use gyputil :(')
    sys.exit(1)

include_headers = os.path.join(lib_root, 'grapl.h')

print lib_root
files = gyputil.find_files(lib_root, re.compile('.*\.h$'))
print files

with open(include_headers, 'w') as f:
    f.seek(0);
    f.write("""
/* THIS FILE WAS GENERATED BY lib/gen_include.py DO NOT EDIT MANUALLY
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#pragma once
""")
    for x in files:
        filename = x[4:]