Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: pylib/gyp/generator/cmake.py

Issue 1161533003: Update cmake generator to handle Skia Android build. (Closed) Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Correctly write variables. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 Google Inc. All rights reserved. 1 # Copyright (c) 2013 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """cmake output module 5 """cmake output module
6 6
7 This module is under development and should be considered experimental. 7 This module is under development and should be considered experimental.
8 8
9 This module produces cmake (2.8.8+) input as its output. One CMakeLists.txt is 9 This module produces cmake (2.8.8+) input as its output. One CMakeLists.txt is
10 created for each configuration. 10 created for each configuration.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 output.write(source_name) 143 output.write(source_name)
144 output.write(' PROPERTIES ') 144 output.write(' PROPERTIES ')
145 output.write(property_name) 145 output.write(property_name)
146 output.write(' "') 146 output.write(' "')
147 for value in values: 147 for value in values:
148 output.write(CMakeStringEscape(value)) 148 output.write(CMakeStringEscape(value))
149 output.write(sep) 149 output.write(sep)
150 output.write('")\n') 150 output.write('")\n')
151 151
152 152
153 def SetFilesProperty(output, source_names, property_name, values, sep): 153 def SetFilesProperty(output, variable, property_name, values, sep):
154 """Given a set of source files, sets the given property on them.""" 154 """Given a set of source files, sets the given property on them."""
155 output.write('set_source_files_properties(\n') 155 output.write('set_source_files_properties(')
156 for source_name in source_names: 156 WriteVariable(output, variable)
157 output.write(' ') 157 output.write(' PROPERTIES ')
158 output.write(source_name)
159 output.write('\n')
160 output.write(' PROPERTIES\n ')
161 output.write(property_name) 158 output.write(property_name)
162 output.write(' "') 159 output.write(' "')
163 for value in values: 160 for value in values:
164 output.write(CMakeStringEscape(value)) 161 output.write(CMakeStringEscape(value))
165 output.write(sep) 162 output.write(sep)
166 output.write('"\n)\n') 163 output.write('")\n')
167 164
168 165
169 def SetTargetProperty(output, target_name, property_name, values, sep=''): 166 def SetTargetProperty(output, target_name, property_name, values, sep=''):
170 """Given a target, sets the given property.""" 167 """Given a target, sets the given property."""
171 output.write('set_target_properties(') 168 output.write('set_target_properties(')
172 output.write(target_name) 169 output.write(target_name)
173 output.write(' PROPERTIES ') 170 output.write(' PROPERTIES ')
174 output.write(property_name) 171 output.write(property_name)
175 output.write(' "') 172 output.write(' "')
176 for value in values: 173 for value in values:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 'shared_library': CMakeTargetType('add_library', 'SHARED', 'LIBRARY'), 226 'shared_library': CMakeTargetType('add_library', 'SHARED', 'LIBRARY'),
230 'loadable_module': CMakeTargetType('add_library', 'MODULE', 'LIBRARY'), 227 'loadable_module': CMakeTargetType('add_library', 'MODULE', 'LIBRARY'),
231 'none': CMakeTargetType('add_custom_target', 'SOURCES', None), 228 'none': CMakeTargetType('add_custom_target', 'SOURCES', None),
232 } 229 }
233 230
234 231
235 def StringToCMakeTargetName(a): 232 def StringToCMakeTargetName(a):
236 """Converts the given string 'a' to a valid CMake target name. 233 """Converts the given string 'a' to a valid CMake target name.
237 234
238 All invalid characters are replaced by '_'. 235 All invalid characters are replaced by '_'.
239 Invalid for cmake: ' ', '/', '(', ')' 236 Invalid for cmake: ' ', '/', '(', ')', '"'
240 Invalid for make: ':' 237 Invalid for make: ':'
241 Invalid for unknown reasons but cause failures: '.' 238 Invalid for unknown reasons but cause failures: '.'
242 """ 239 """
243 return a.translate(string.maketrans(' /():.', '______')) 240 return a.translate(string.maketrans(' /():."', '_______'))
244 241
245 242
246 def WriteActions(target_name, actions, extra_sources, extra_deps, 243 def WriteActions(target_name, actions, extra_sources, extra_deps,
247 path_to_gyp, output): 244 path_to_gyp, output):
248 """Write CMake for the 'actions' in the target. 245 """Write CMake for the 'actions' in the target.
249 246
250 Args: 247 Args:
251 target_name: the name of the CMake target being generated. 248 target_name: the name of the CMake target being generated.
252 actions: the Gyp 'actions' dict for this target. 249 actions: the Gyp 'actions' dict for this target.
253 extra_sources: [(<cmake_src>, <src>)] to append with generated source files. 250 extra_sources: [(<cmake_src>, <src>)] to append with generated source files.
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 630
634 path_from_cmakelists_to_gyp = build_to_gyp 631 path_from_cmakelists_to_gyp = build_to_gyp
635 632
636 spec = target_dicts.get(qualified_target, {}) 633 spec = target_dicts.get(qualified_target, {})
637 config = spec.get('configurations', {}).get(config_to_use, {}) 634 config = spec.get('configurations', {}).get(config_to_use, {})
638 635
639 target_name = spec.get('target_name', '<missing target name>') 636 target_name = spec.get('target_name', '<missing target name>')
640 target_type = spec.get('type', '<missing target type>') 637 target_type = spec.get('type', '<missing target type>')
641 target_toolset = spec.get('toolset') 638 target_toolset = spec.get('toolset')
642 639
640 cmake_target_type = cmake_target_type_from_gyp_target_type.get(target_type)
641 if cmake_target_type is None:
642 print ('Target %s has unknown target type %s, skipping.' %
643 ( target_name, target_type ) )
644 return
645
643 SetVariable(output, 'TARGET', target_name) 646 SetVariable(output, 'TARGET', target_name)
644 SetVariable(output, 'TOOLSET', target_toolset) 647 SetVariable(output, 'TOOLSET', target_toolset)
645 648
646 cmake_target_name = namer.CreateCMakeTargetName(qualified_target) 649 cmake_target_name = namer.CreateCMakeTargetName(qualified_target)
647 650
648 extra_sources = [] 651 extra_sources = []
649 extra_deps = [] 652 extra_deps = []
650 653
651 # Actions must come first, since they can generate more OBJs for use below. 654 # Actions must come first, since they can generate more OBJs for use below.
652 if 'actions' in spec: 655 if 'actions' in spec:
653 WriteActions(cmake_target_name, spec['actions'], extra_sources, extra_deps, 656 WriteActions(cmake_target_name, spec['actions'], extra_sources, extra_deps,
654 path_from_cmakelists_to_gyp, output) 657 path_from_cmakelists_to_gyp, output)
655 658
656 # Rules must be early like actions. 659 # Rules must be early like actions.
657 if 'rules' in spec: 660 if 'rules' in spec:
658 WriteRules(cmake_target_name, spec['rules'], extra_sources, extra_deps, 661 WriteRules(cmake_target_name, spec['rules'], extra_sources, extra_deps,
659 path_from_cmakelists_to_gyp, output) 662 path_from_cmakelists_to_gyp, output)
660 663
661 # Copies 664 # Copies
662 if 'copies' in spec: 665 if 'copies' in spec:
663 WriteCopies(cmake_target_name, spec['copies'], extra_deps, 666 WriteCopies(cmake_target_name, spec['copies'], extra_deps,
664 path_from_cmakelists_to_gyp, output) 667 path_from_cmakelists_to_gyp, output)
665 668
666 # Target and sources 669 # Target and sources
667 srcs = spec.get('sources', []) 670 srcs = spec.get('sources', [])
668 671
669 # Gyp separates the sheep from the goats based on file extensions. 672 # Gyp separates the sheep from the goats based on file extensions.
670 def partition(l, p): 673 # A full separation is done here because of flag handing (see below).
671 return reduce(lambda x, e: x[not p(e)].append(e) or x, l, ([], [])) 674 s_sources = []
672 compilable_srcs, other_srcs = partition(srcs, Compilable) 675 c_sources = []
676 cxx_sources = []
677 other_sources = []
678 for src in srcs:
679 _, ext = os.path.splitext(src)
680 src_type = COMPILABLE_EXTENSIONS.get(ext, None)
681 src_norm_path = NormjoinPath(path_from_cmakelists_to_gyp, src);
682
683 if src_type == 's':
684 s_sources.append(src_norm_path)
685 elif src_type == 'cc':
686 c_sources.append(src_norm_path)
687 elif src_type == 'cxx':
688 cxx_sources.append(src_norm_path)
689 else:
690 other_sources.append(src_norm_path)
691
692 for extra_source in extra_sources:
693 src, real_source = extra_source
694 _, ext = os.path.splitext(real_source)
695 src_type = COMPILABLE_EXTENSIONS.get(ext, None)
696
697 if src_type == 's':
698 s_sources.append(src)
699 elif src_type == 'cc':
700 c_sources.append(src)
701 elif src_type == 'cxx':
702 cxx_sources.append(src)
703 else:
704 other_sources.append(src)
705
706 s_sources_name = None
707 if s_sources:
708 s_sources_name = cmake_target_name + '__asm_srcs'
709 SetVariableList(output, s_sources_name, s_sources)
710
711 c_sources_name = None
712 if c_sources:
713 c_sources_name = cmake_target_name + '__c_srcs'
714 SetVariableList(output, c_sources_name, c_sources)
715
716 cxx_sources_name = None
717 if cxx_sources:
718 cxx_sources_name = cmake_target_name + '__cxx_srcs'
719 SetVariableList(output, cxx_sources_name, cxx_sources)
720
721 other_sources_name = None
722 if other_sources:
723 other_sources_name = cmake_target_name + '__other_srcs'
724 SetVariableList(output, other_sources_name, other_sources)
673 725
674 # CMake gets upset when executable targets provide no sources. 726 # CMake gets upset when executable targets provide no sources.
675 if target_type == 'executable' and not compilable_srcs and not extra_sources: 727 # http://www.cmake.org/pipermail/cmake/2010-July/038461.html
676 print ('Executable %s has no complilable sources, treating as "none".' % 728 dummy_sources_name = None
677 target_name ) 729 has_sources = (s_sources_name or
678 target_type = 'none' 730 c_sources_name or
731 cxx_sources_name or
732 other_sources_name)
733 if target_type == 'executable' and not has_sources:
Nico 2015/05/27 20:11:49 Does this ever happen? I'd expect other generators
734 dummy_sources_name = cmake_target_name + '__dummy_srcs'
735 SetVariable(output, dummy_sources_name,
736 "${obj}.${TOOLSET}/${TARGET}/genc/dummy.c")
737 output.write('if(NOT EXISTS "')
738 WriteVariable(output, dummy_sources_name)
739 output.write('")\n')
740 output.write(' file(WRITE "')
741 WriteVariable(output, dummy_sources_name)
742 output.write('" "")\n')
743 output.write("endif()\n")
679 744
680 cmake_target_type = cmake_target_type_from_gyp_target_type.get(target_type)
681 if cmake_target_type is None:
682 print ('Target %s has unknown target type %s, skipping.' %
683 ( target_name, target_type ) )
684 return
685
686 other_srcs_name = None
687 if other_srcs:
688 other_srcs_name = cmake_target_name + '__other_srcs'
689 SetVariableList(output, other_srcs_name,
690 [NormjoinPath(path_from_cmakelists_to_gyp, src) for src in other_srcs])
691 745
692 # CMake is opposed to setting linker directories and considers the practice 746 # CMake is opposed to setting linker directories and considers the practice
693 # of setting linker directories dangerous. Instead, it favors the use of 747 # of setting linker directories dangerous. Instead, it favors the use of
694 # find_library and passing absolute paths to target_link_libraries. 748 # find_library and passing absolute paths to target_link_libraries.
695 # However, CMake does provide the command link_directories, which adds 749 # However, CMake does provide the command link_directories, which adds
696 # link directories to targets defined after it is called. 750 # link directories to targets defined after it is called.
697 # As a result, link_directories must come before the target definition. 751 # As a result, link_directories must come before the target definition.
698 # CMake unfortunately has no means of removing entries from LINK_DIRECTORIES. 752 # CMake unfortunately has no means of removing entries from LINK_DIRECTORIES.
699 library_dirs = config.get('library_dirs') 753 library_dirs = config.get('library_dirs')
700 if library_dirs is not None: 754 if library_dirs is not None:
701 output.write('link_directories(') 755 output.write('link_directories(')
702 for library_dir in library_dirs: 756 for library_dir in library_dirs:
703 output.write(' ') 757 output.write(' ')
704 output.write(NormjoinPath(path_from_cmakelists_to_gyp, library_dir)) 758 output.write(NormjoinPath(path_from_cmakelists_to_gyp, library_dir))
705 output.write('\n') 759 output.write('\n')
706 output.write(')\n') 760 output.write(')\n')
707 761
708 output.write(cmake_target_type.command) 762 output.write(cmake_target_type.command)
709 output.write('(') 763 output.write('(')
710 output.write(cmake_target_name) 764 output.write(cmake_target_name)
711 765
712 if cmake_target_type.modifier is not None: 766 if cmake_target_type.modifier is not None:
713 output.write(' ') 767 output.write(' ')
714 output.write(cmake_target_type.modifier) 768 output.write(cmake_target_type.modifier)
715 769
716 if other_srcs_name: 770 if s_sources_name:
717 WriteVariable(output, other_srcs_name, ' ') 771 WriteVariable(output, s_sources_name, ' ')
718 772 if c_sources_name:
719 output.write('\n') 773 WriteVariable(output, c_sources_name, ' ')
720 774 if cxx_sources_name:
721 for src in compilable_srcs: 775 WriteVariable(output, cxx_sources_name, ' ')
722 output.write(' ') 776 if other_sources_name:
723 output.write(NormjoinPath(path_from_cmakelists_to_gyp, src)) 777 WriteVariable(output, other_sources_name, ' ')
724 output.write('\n') 778 if dummy_sources_name:
725 for extra_source in extra_sources: 779 WriteVariable(output, dummy_sources_name, ' ')
726 output.write(' ')
727 src, _ = extra_source
728 output.write(NormjoinPath(path_from_cmakelists_to_gyp, src))
729 output.write('\n')
730 780
731 output.write(')\n') 781 output.write(')\n')
732 782
733 # Output name and location. 783 # Output name and location.
734 if target_type != 'none': 784 if target_type != 'none':
735 # Mark uncompiled sources as uncompiled. 785 # Mark uncompiled sources as uncompiled.
736 if other_srcs_name: 786 if other_sources_name:
737 output.write('set_source_files_properties(') 787 output.write('set_source_files_properties(')
738 WriteVariable(output, other_srcs_name, '') 788 WriteVariable(output, other_sources_name, '')
739 output.write(' PROPERTIES HEADER_FILE_ONLY "TRUE")\n') 789 output.write(' PROPERTIES HEADER_FILE_ONLY "TRUE")\n')
740 790
741 # Output directory 791 # Output directory
742 target_output_directory = spec.get('product_dir') 792 target_output_directory = spec.get('product_dir')
743 if target_output_directory is None: 793 if target_output_directory is None:
744 if target_type in ('executable', 'loadable_module'): 794 if target_type in ('executable', 'loadable_module'):
745 target_output_directory = generator_default_variables['PRODUCT_DIR'] 795 target_output_directory = generator_default_variables['PRODUCT_DIR']
746 elif target_type == 'shared_library': 796 elif target_type == 'shared_library':
747 target_output_directory = '${builddir}/lib.${TOOLSET}' 797 target_output_directory = '${builddir}/lib.${TOOLSET}'
748 elif spec.get('standalone_static_library', False): 798 elif spec.get('standalone_static_library', False):
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 # if cflags_c is not None: 894 # if cflags_c is not None:
845 # SetTargetProperty(output, cmake_target_name, 895 # SetTargetProperty(output, cmake_target_name,
846 # 'C_COMPILE_FLAGS', cflags_c, ' ') 896 # 'C_COMPILE_FLAGS', cflags_c, ' ')
847 897
848 # cflags_cc = config.get('cflags_cc') 898 # cflags_cc = config.get('cflags_cc')
849 # if cflags_cc is not None: 899 # if cflags_cc is not None:
850 # SetTargetProperty(output, cmake_target_name, 900 # SetTargetProperty(output, cmake_target_name,
851 # 'CXX_COMPILE_FLAGS', cflags_cc, ' ') 901 # 'CXX_COMPILE_FLAGS', cflags_cc, ' ')
852 902
853 # Instead we must... 903 # Instead we must...
854 s_sources = []
855 c_sources = []
856 cxx_sources = []
857 for src in srcs:
858 _, ext = os.path.splitext(src)
859 src_type = COMPILABLE_EXTENSIONS.get(ext, None)
860
861 if src_type == 's':
862 s_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
863
864 if src_type == 'cc':
865 c_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
866
867 if src_type == 'cxx':
868 cxx_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
869
870 for extra_source in extra_sources:
871 src, real_source = extra_source
872 _, ext = os.path.splitext(real_source)
873 src_type = COMPILABLE_EXTENSIONS.get(ext, None)
874
875 if src_type == 's':
876 s_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
877
878 if src_type == 'cc':
879 c_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
880
881 if src_type == 'cxx':
882 cxx_sources.append(NormjoinPath(path_from_cmakelists_to_gyp, src))
883
884 cflags = config.get('cflags', []) 904 cflags = config.get('cflags', [])
885 cflags_c = config.get('cflags_c', []) 905 cflags_c = config.get('cflags_c', [])
886 cflags_cxx = config.get('cflags_cc', []) 906 cflags_cxx = config.get('cflags_cc', [])
887 if c_sources and not (s_sources or cxx_sources): 907 if (not cflags_c or not c_sources) and (not cflags_cxx or not cxx_sources):
908 SetTargetProperty(output, cmake_target_name, 'COMPILE_FLAGS', cflags, ' ')
909
910 elif c_sources and not (s_sources or cxx_sources):
888 flags = [] 911 flags = []
889 flags.extend(cflags) 912 flags.extend(cflags)
890 flags.extend(cflags_c) 913 flags.extend(cflags_c)
891 SetTargetProperty(output, cmake_target_name, 'COMPILE_FLAGS', flags, ' ') 914 SetTargetProperty(output, cmake_target_name, 'COMPILE_FLAGS', flags, ' ')
892 915
893 elif cxx_sources and not (s_sources or c_sources): 916 elif cxx_sources and not (s_sources or c_sources):
894 flags = [] 917 flags = []
895 flags.extend(cflags) 918 flags.extend(cflags)
896 flags.extend(cflags_cxx) 919 flags.extend(cflags_cxx)
897 SetTargetProperty(output, cmake_target_name, 'COMPILE_FLAGS', flags, ' ') 920 SetTargetProperty(output, cmake_target_name, 'COMPILE_FLAGS', flags, ' ')
898 921
899 else: 922 else:
900 if s_sources and cflags: 923 if s_sources and cflags:
901 SetFilesProperty(output, s_sources, 'COMPILE_FLAGS', cflags, ' ') 924 SetFilesProperty(output, s_sources_name, 'COMPILE_FLAGS', cflags, ' ')
902 925
903 if c_sources and (cflags or cflags_c): 926 if c_sources and (cflags or cflags_c):
904 flags = [] 927 flags = []
905 flags.extend(cflags) 928 flags.extend(cflags)
906 flags.extend(cflags_c) 929 flags.extend(cflags_c)
907 SetFilesProperty(output, c_sources, 'COMPILE_FLAGS', flags, ' ') 930 SetFilesProperty(output, c_sources_name, 'COMPILE_FLAGS', flags, ' ')
908 931
909 if cxx_sources and (cflags or cflags_cxx): 932 if cxx_sources and (cflags or cflags_cxx):
910 flags = [] 933 flags = []
911 flags.extend(cflags) 934 flags.extend(cflags)
912 flags.extend(cflags_cxx) 935 flags.extend(cflags_cxx)
913 SetFilesProperty(output, cxx_sources, 'COMPILE_FLAGS', flags, ' ') 936 SetFilesProperty(output, cxx_sources_name, 'COMPILE_FLAGS', flags, ' ')
914 937
915 # Have assembly link as c if there are no other files 938 # Link as 'C' if there are no other files
916 if not c_sources and not cxx_sources and s_sources: 939 if not c_sources and not cxx_sources:
917 SetTargetProperty(output, cmake_target_name, 'LINKER_LANGUAGE', ['C']) 940 SetTargetProperty(output, cmake_target_name, 'LINKER_LANGUAGE', ['C'])
918 941
919 # Linker flags 942 # Linker flags
920 ldflags = config.get('ldflags') 943 ldflags = config.get('ldflags')
921 if ldflags is not None: 944 if ldflags is not None:
922 SetTargetProperty(output, cmake_target_name, 'LINK_FLAGS', ldflags, ' ') 945 SetTargetProperty(output, cmake_target_name, 'LINK_FLAGS', ldflags, ' ')
923 946
924 # Note on Dependencies and Libraries: 947 # Note on Dependencies and Libraries:
925 # CMake wants to handle link order, resolving the link line up front. 948 # CMake wants to handle link order, resolving the link line up front.
926 # Gyp does not retain or enforce specifying enough information to do so. 949 # Gyp does not retain or enforce specifying enough information to do so.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 output.write('cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n') 1063 output.write('cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)\n')
1041 output.write('cmake_policy(VERSION 2.8.8)\n') 1064 output.write('cmake_policy(VERSION 2.8.8)\n')
1042 1065
1043 _, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1]) 1066 _, project_target, _ = gyp.common.ParseQualifiedTarget(target_list[-1])
1044 output.write('project(') 1067 output.write('project(')
1045 output.write(project_target) 1068 output.write(project_target)
1046 output.write(')\n') 1069 output.write(')\n')
1047 1070
1048 SetVariable(output, 'configuration', config_to_use) 1071 SetVariable(output, 'configuration', config_to_use)
1049 1072
1073 cc = None
1074 cxx = None
1075 ar = None
1076
1077 #TODO: support make_global_settings
1078
1079 cc = gyp.common.GetEnvironFallback(['CC_target', 'CC'], cc)
1080 cxx = gyp.common.GetEnvironFallback(['CXX_target', 'CXX'], cxx)
1081 ar = gyp.common.GetEnvironFallback(['AR_target', 'AR'], ar)
1082
1083 if cc:
1084 SetVariable(output, 'CMAKE_C_COMPILER', cc)
1085 if cxx:
1086 SetVariable(output, 'CMAKE_CXX_COMPILER', cxx)
1087 if ar:
1088 SetVariable(output, 'CMAKE_AR', ar)
1089
1050 # The following appears to be as-yet undocumented. 1090 # The following appears to be as-yet undocumented.
1051 # http://public.kitware.com/Bug/view.php?id=8392 1091 # http://public.kitware.com/Bug/view.php?id=8392
1052 output.write('enable_language(ASM)\n') 1092 output.write('enable_language(ASM)\n')
1053 # ASM-ATT does not support .S files. 1093 # ASM-ATT does not support .S files.
1054 # output.write('enable_language(ASM-ATT)\n') 1094 # output.write('enable_language(ASM-ATT)\n')
1055 1095
1096 if cc:
1097 SetVariable(output, 'CMAKE_ASM_COMPILER', cc)
1098
1056 SetVariable(output, 'builddir', '${CMAKE_BINARY_DIR}') 1099 SetVariable(output, 'builddir', '${CMAKE_BINARY_DIR}')
1057 SetVariable(output, 'obj', '${builddir}/obj') 1100 SetVariable(output, 'obj', '${builddir}/obj')
1058 output.write('\n') 1101 output.write('\n')
1059 1102
1060 # TODO: Undocumented/unsupported (the CMake Java generator depends on it). 1103 # TODO: Undocumented/unsupported (the CMake Java generator depends on it).
1061 # CMake by default names the object resulting from foo.c to be foo.c.o. 1104 # CMake by default names the object resulting from foo.c to be foo.c.o.
1062 # Gyp traditionally names the object resulting from foo.c foo.o. 1105 # Gyp traditionally names the object resulting from foo.c foo.o.
1063 # This should be irrelevant, but some targets extract .o files from .a 1106 # This should be irrelevant, but some targets extract .o files from .a
1064 # and depend on the name of the extracted .o files. 1107 # and depend on the name of the extracted .o files.
1065 output.write('set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)\n') 1108 output.write('set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)\n')
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 arglists.append((target_list, target_dicts, data, 1177 arglists.append((target_list, target_dicts, data,
1135 params, config_name)) 1178 params, config_name))
1136 pool.map(CallGenerateOutputForConfig, arglists) 1179 pool.map(CallGenerateOutputForConfig, arglists)
1137 except KeyboardInterrupt, e: 1180 except KeyboardInterrupt, e:
1138 pool.terminate() 1181 pool.terminate()
1139 raise e 1182 raise e
1140 else: 1183 else:
1141 for config_name in config_names: 1184 for config_name in config_names:
1142 GenerateOutputForConfig(target_list, target_dicts, data, 1185 GenerateOutputForConfig(target_list, target_dicts, data,
1143 params, config_name) 1186 params, config_name)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698