Flutter Engine
The Flutter Engine
Functions | Variables
impeller_cmake_build_test Namespace Reference

Functions

def parse_args (argv)
 
def validate_args (args)
 
def create_xcode_symlink ()
 
def main (argv)
 

Variables

 SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 

Function Documentation

◆ create_xcode_symlink()

def impeller_cmake_build_test.create_xcode_symlink ( )

Definition at line 72 of file impeller_cmake_build_test.py.

73 find_sdk_command = [
74 'python3',
75 os.path.join(SRC_ROOT, 'build', 'mac', 'find_sdk.py'),
76 '--print_sdk_path',
77 '10.15',
78 '--symlink',
79 os.path.join(SRC_ROOT, 'out', 'impeller-cmake-example-xcode-sysroot'),
80 ]
81 find_sdk_output = subprocess.check_output(find_sdk_command).decode('utf-8')
82 return find_sdk_output.split('\n')[0]
83
84
static DecodeResult decode(std::string path)
Definition: png_codec.cpp:124

◆ main()

def impeller_cmake_build_test.main (   argv)

Definition at line 85 of file impeller_cmake_build_test.py.

85def main(argv):
86 args = parse_args(argv[1:])
87 if not validate_args(args):
88 return 1
89
90 impeller_cmake_dir = os.path.join(SRC_ROOT, args.path)
91
92 if args.setup:
93 git_command = [
94 'git',
95 '-C',
96 impeller_cmake_dir,
97 'submodule',
98 'update',
99 '--init',
100 '--recursive',
101 '--depth',
102 '1',
103 '--jobs',
104 str(os.cpu_count()),
105 ]
106 subprocess.check_call(git_command)
107
108 # Run the deps.sh shell script in the repo.
109 subprocess.check_call(['bash', 'deps.sh'], cwd=impeller_cmake_dir)
110 return 0
111
112 if args.cmake:
113 cmake_path = os.path.join(SRC_ROOT, 'buildtools', 'mac-x64', 'cmake', 'bin', 'cmake')
114 cmake_command = [
115 cmake_path,
116 '--preset',
117 'flutter-ci-mac-debug-x64',
118 '-B',
119 os.path.join(SRC_ROOT, 'out', 'impeller-cmake-example'),
120 ]
121 cmake_env = os.environ.copy()
122 ninja_path = os.path.join(SRC_ROOT, 'flutter', 'third_party', 'ninja')
123 cmake_env.update({
124 'PATH': os.environ['PATH'] + ':' + ninja_path,
125 'FLUTTER_ENGINE_SRC_DIR': SRC_ROOT,
126 })
127 if args.xcode_symlinks:
128 xcode_symlink_path = create_xcode_symlink()
129 cmake_env.update({
130 'FLUTTER_OSX_SYSROOT': xcode_symlink_path,
131 })
132 subprocess.check_call(cmake_command, env=cmake_env, cwd=impeller_cmake_dir)
133
134 return 0
135
136
static void parse_args(int argc, char *argv[], Args *args)
Definition: skqp_main.cpp:97

◆ parse_args()

def impeller_cmake_build_test.parse_args (   argv)

Definition at line 21 of file impeller_cmake_build_test.py.

21def parse_args(argv):
22 parser = argparse.ArgumentParser(
23 description='A script that tests the impeller-cmake-example build.',
24 )
25 parser.add_argument(
26 '--cmake',
27 '-c',
28 default=False,
29 action='store_true',
30 help='Run cmake for impeller-cmake-example.',
31 )
32 parser.add_argument(
33 '--path',
34 '-p',
35 type=str,
36 help='The path to the impeller-cmake-example source.',
37 )
38 parser.add_argument(
39 '--setup',
40 '-s',
41 default=False,
42 action='store_true',
43 help='Clone the git submodules.',
44 )
45 parser.add_argument(
46 '--verbose',
47 '-v',
48 default=False,
49 action='store_true',
50 help='Emit verbose output.',
51 )
52 parser.add_argument(
53 '--xcode-symlinks',
54 default=False,
55 action='store_true',
56 help='Symlink the Xcode sysroot to help Goma be successful.',
57 )
58 return parser.parse_args(argv)
59
60

◆ validate_args()

def impeller_cmake_build_test.validate_args (   args)

Definition at line 61 of file impeller_cmake_build_test.py.

61def validate_args(args):
62 if not os.path.isdir(os.path.join(SRC_ROOT, args.path)):
63 print(
64 'The --path argument must be a valid directory relative to the '
65 'engine src/ directory.'
66 )
67 return False
68
69 return True
70
71
def print(*args, **kwargs)
Definition: run_tests.py:49

Variable Documentation

◆ SRC_ROOT

impeller_cmake_build_test.SRC_ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

Definition at line 18 of file impeller_cmake_build_test.py.