Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. 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 #include "tools/gn/gyp_target_writer.h" | 5 #include "tools/gn/gyp_target_writer.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 Err* err) { | 30 Err* err) { |
| 31 if (targets.empty()) | 31 if (targets.empty()) |
| 32 return; | 32 return; |
| 33 const BuildSettings* debug_build_settings = | 33 const BuildSettings* debug_build_settings = |
| 34 targets[0].debug->settings()->build_settings(); | 34 targets[0].debug->settings()->build_settings(); |
| 35 | 35 |
| 36 std::stringstream file; | 36 std::stringstream file; |
| 37 file << "# Generated by GN. Do not edit.\n\n"; | 37 file << "# Generated by GN. Do not edit.\n\n"; |
| 38 file << "{\n"; | 38 file << "{\n"; |
| 39 file << " 'skip_includes': 1,\n"; | 39 file << " 'skip_includes': 1,\n"; |
| 40 | |
| 41 if (targets[0].debug->settings()->IsMac()) { | |
| 42 // Global settings for make. This must match common.gypi :( | |
|
Nico
2013/10/28 23:05:14
Oh, here it is. Maybe add a comment to that other
| |
| 43 file << " 'make_global_settings': [\n"; | |
| 44 file << " ['CC', 'third_party/llvm-build/Release+Asserts/bin/clang'],\n"; | |
| 45 file << | |
| 46 " ['CXX', 'third_party/llvm-build/Release+Asserts/bin/clang++'],\n"; | |
| 47 file << " ['CC.host', '$(CC)'],\n"; | |
| 48 file << " ['CXX.host', '$(CXX)'],\n"; | |
| 49 file << " ],\n"; | |
| 50 } | |
| 51 // TODO(brettw) android. | |
| 52 | |
| 40 file << " 'targets': [\n"; | 53 file << " 'targets': [\n"; |
| 41 | 54 |
| 42 for (size_t i = 0; i < targets.size(); i++) { | 55 for (size_t i = 0; i < targets.size(); i++) { |
| 43 switch (targets[i].debug->output_type()) { | 56 switch (targets[i].debug->output_type()) { |
| 44 case Target::COPY_FILES: | 57 case Target::COPY_FILES: |
| 45 case Target::CUSTOM: | 58 case Target::CUSTOM: |
| 46 case Target::GROUP: | 59 case Target::GROUP: |
| 47 break; // TODO(brettw) | 60 break; // TODO(brettw) |
| 48 case Target::EXECUTABLE: | 61 case Target::EXECUTABLE: |
| 49 case Target::STATIC_LIBRARY: | 62 case Target::STATIC_LIBRARY: |
| 50 case Target::SHARED_LIBRARY: | 63 case Target::SHARED_LIBRARY: |
| 51 case Target::SOURCE_SET: { | 64 case Target::SOURCE_SET: { |
| 52 GypBinaryTargetWriter writer(targets[i], file); | 65 GypBinaryTargetWriter writer(targets[i], file); |
| 53 writer.Run(); | 66 writer.Run(); |
| 54 break; | 67 break; |
| 55 } | 68 } |
| 56 default: | 69 default: |
| 57 CHECK(0); | 70 CHECK(0); |
| 58 } | 71 } |
| 59 } | 72 } |
| 60 | 73 |
| 61 file << " ],\n}\n"; | 74 file << " ],\n}\n"; |
| 62 | 75 |
| 63 base::FilePath gyp_file_path = debug_build_settings->GetFullPath(gyp_file); | 76 base::FilePath gyp_file_path = debug_build_settings->GetFullPath(gyp_file); |
| 64 std::string contents = file.str(); | 77 std::string contents = file.str(); |
| 65 file_util::WriteFile(gyp_file_path, contents.c_str(), | 78 file_util::WriteFile(gyp_file_path, contents.c_str(), |
| 66 static_cast<int>(contents.size())); | 79 static_cast<int>(contents.size())); |
| 67 } | 80 } |
| 68 | 81 |
| OLD | NEW |