Lines Matching +full:write +full:- +full:output
5 # Use of this source code is governed by a BSD-style license that can be
12 gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py
16 gn gen out/config --ide=json
19 The first is recommended, as it will auto-update.
49 CMP0037 in CMake 3.0 restricts target names to "^[A-Za-z0-9_.:+-]+$"
53 if c in string.ascii_letters or c in string.digits or c in '_.+-':
62 out.write('set("')
63 out.write(CMakeStringEscape(variable_name))
64 out.write('" "')
65 out.write(CMakeStringEscape(value))
66 out.write('")\n')
75 out.write('list(APPEND "')
76 out.write(CMakeStringEscape(variable_name))
77 out.write('"\n "')
78 out.write('"\n "'.join([CMakeStringEscape(value) for value in values]))
79 out.write('")\n')
82 def SetFilesProperty(output, variable, property_name, values, sep): argument
84 output.write('set_source_files_properties(')
85 WriteVariable(output, variable)
86 output.write(' PROPERTIES ')
87 output.write(property_name)
88 output.write(' "')
90 output.write(CMakeStringEscape(value))
91 output.write(sep)
92 output.write('")\n')
97 out.write('set_target_properties("${target}" PROPERTIES ')
98 out.write(property_name)
99 out.write(' "')
101 out.write(CMakeStringEscape(value))
102 out.write(sep)
103 out.write('")\n')
106 def WriteVariable(output, variable_name, prepend=None): argument
108 output.write(prepend)
109 output.write('${')
110 output.write(variable_name)
111 output.write('}')
203 if toolchain_separator == -1:
209 toolchain = gn_target_name[toolchain_separator + 1:-1]
220 cmake_target_name += '--' + toolchain
236 for output in target.properties.get('outputs', []):
237 output_abs_path = project.GetAbsolutePath(output)
245 out.write('add_custom_command(OUTPUT ')
247 out.write('\n')
250 out.write(' COMMAND ${CMAKE_COMMAND} -E make_directory "')
251 out.write('" "'.join(map(CMakeStringEscape, output_directories)))
252 out.write('"\n')
256 out.write(' COMMAND python "')
257 out.write(CMakeStringEscape(project.GetAbsolutePath(script)))
258 out.write('"')
260 out.write('\n "')
261 out.write('"\n "'.join(map(CMakeStringEscape, arguments)))
262 out.write('"')
263 out.write('\n')
265 out.write(' DEPENDS ')
268 out.write('\n')
272 out.write(' WORKING_DIRECTORY "')
273 out.write(CMakeStringEscape(project.build_path))
274 out.write('"\n')
276 out.write(' COMMENT "Action: ${target}"\n')
278 out.write(' VERBATIM)\n')
304 for output in all_outputs[outputs_per_input * count:
306 output_abs_path = project.GetAbsolutePath(output)
314 out.write('add_custom_command(OUTPUT ')
316 out.write('\n')
319 out.write(' COMMAND ${CMAKE_COMMAND} -E make_directory "')
320 out.write('" "'.join(map(CMakeStringEscape, output_directories)))
321 out.write('"\n')
326 out.write(' COMMAND python "')
327 out.write(CMakeStringEscape(project.GetAbsolutePath(script)))
328 out.write('"')
330 out.write('\n "')
332 out.write('"\n "'.join(map(CMakeStringEscape, map(expand,arguments))))
333 out.write('"')
334 out.write('\n')
336 out.write(' DEPENDS')
339 out.write(' "')
340 out.write(CMakeStringEscape(source_abs_path))
341 out.write('"\n')
345 out.write(' WORKING_DIRECTORY "')
346 out.write(CMakeStringEscape(project.build_path))
347 out.write('"\n')
349 out.write(' COMMENT "Action ${target} on ')
350 out.write(CMakeStringEscape(source_abs_path))
351 out.write('"\n')
353 out.write(' VERBATIM)\n')
364 for output in raw_outputs:
365 output_abs_path = project.GetAbsolutePath(output)
370 out.write('add_custom_command(OUTPUT ')
372 out.write('\n')
380 out.write(' COMMAND ${CMAKE_COMMAND} -E copy "')
382 out.write(' COMMAND ${CMAKE_COMMAND} -E copy_directory "')
383 out.write(abs_src_path)
384 out.write('" "')
385 out.write(CMakeStringEscape(dst))
386 out.write('"\n')
388 out.write(' DEPENDS ')
391 out.write('\n')
393 out.write(' WORKING_DIRECTORY "')
394 out.write(CMakeStringEscape(project.build_path))
395 out.write('"\n')
397 out.write(' COMMENT "Copy ${target}"\n')
399 out.write(' VERBATIM)\n')
420 # This includes using 'source_outputs' to direct compiler output.
425 out.write('set_property(TARGET "${target}" ')
426 out.write('APPEND PROPERTY INCLUDE_DIRECTORIES')
428 out.write('\n "')
429 out.write(project.GetAbsolutePath(include_dir))
430 out.write('"')
431 out.write(')\n')
503 # Only executables and non-OBJECT libraries may reference an OBJECT library.
522 out.write('\n#')
523 out.write(target.gn_name)
524 out.write('\n')
543 out.write(target.cmake_type.command)
544 out.write('("${target}"')
546 out.write(' ')
547 out.write(target.cmake_type.modifier)
551 out.write(' DEPENDS')
554 out.write(')\n')
584 # Non-library dependencies.
586 out.write('add_dependencies("${target}"')
588 out.write('\n "')
589 out.write(nonlibrary)
590 out.write('"')
591 out.write(')\n')
593 # Non-OBJECT library dependencies.
606 external_library = external_library[:-len('.framework')]
610 out.write('find_library("')
611 out.write(CMakeStringEscape(system_library))
612 out.write('" "')
613 out.write(CMakeStringEscape(external_library))
614 out.write('"')
616 out.write(' PATHS "')
618 out.write('"')
619 out.write(')\n')
621 out.write('target_link_libraries("${target}"')
623 out.write('\n "')
624 out.write(CMakeStringEscape(library))
625 out.write('"')
628 out.write('"')
629 out.write(')\n')
635 out.write('# Generated by gn_to_cmake.py.\n')
636 out.write('cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n')
637 out.write('cmake_policy(VERSION 2.8.8)\n\n')
639 out.write('file(WRITE "')
640 out.write(CMakeStringEscape(posixpath.join(project.build_path, "empty.cpp")))
641 out.write('")\n')
645 # gn gen out/config --ide=json --json-ide-script=../../gn/gn_to_cmake.py
647 out.write('execute_process(COMMAND\n')
648 out.write(' ninja -C "')
649 out.write(CMakeStringEscape(project.build_path))
650 out.write('" build.ninja\n')
651 out.write(' RESULT_VARIABLE ninja_result)\n')
652 out.write('if (ninja_result)\n')
653 out.write(' message(WARNING ')
654 out.write('"Regeneration failed running ninja: ${ninja_result}")\n')
655 out.write('endif()\n')
657 out.write('include("')
658 out.write(CMakeStringEscape(extName))
659 out.write('")\n')
663 out.write('# Generated by gn_to_cmake.py.\n')
664 out.write('cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n')
665 out.write('cmake_policy(VERSION 2.8.8)\n')
667 # The following appears to be as-yet undocumented.
669 out.write('enable_language(ASM)\n\n')
670 # ASM-ATT does not support .S files.
671 # output.write('enable_language(ASM-ATT)\n')
673 # Current issues with automatic re-generation:
679 out.write('file(READ "')
681 out.write(CMakeStringEscape(gn_deps_file))
682 out.write('" "gn_deps_string" OFFSET ')
683 out.write(str(len('build.ninja: ')))
684 out.write(')\n')
687 out.write('string(REPLACE " " ";" "gn_deps" ${gn_deps_string})\n')
688 out.write('foreach("gn_dep" ${gn_deps})\n')
689 out.write(' configure_file("')
690 out.write(CMakeStringEscape(project.build_path))
691 out.write('${gn_dep}" "CMakeLists.devnull" COPYONLY)\n')
692 out.write('endforeach("gn_dep")\n')
694 out.write('list(APPEND other_deps "')
695 out.write(CMakeStringEscape(os.path.abspath(__file__)))
696 out.write('")\n')
697 out.write('foreach("other_dep" ${other_deps})\n')
698 out.write(' configure_file("${other_dep}" "CMakeLists.devnull" COPYONLY)\n')
699 out.write('endforeach("other_dep")\n')
702 out.write('\n')