| 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 #ifndef TOOLS_GN_GYP_TARGET_WRITER_H_ | 5 #ifndef TOOLS_GN_GYP_TARGET_WRITER_H_ |
| 6 #define TOOLS_GN_GYP_TARGET_WRITER_H_ | 6 #define TOOLS_GN_GYP_TARGET_WRITER_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "tools/gn/gyp_helper.h" | 12 #include "tools/gn/gyp_helper.h" |
| 13 #include "tools/gn/path_output.h" | 13 #include "tools/gn/path_output.h" |
| 14 | 14 |
| 15 class BuilderRecord; | 15 class BuilderRecord; |
| 16 class Err; | 16 class Err; |
| 17 class Settings; | 17 class Settings; |
| 18 class SourceFile; | 18 class SourceFile; |
| 19 class Target; | 19 class Target; |
| 20 class Toolchain; | 20 class Toolchain; |
| 21 | 21 |
| 22 class GypTargetWriter { | 22 class GypTargetWriter { |
| 23 public: | 23 public: |
| 24 struct TargetGroup { | 24 struct TargetGroup { |
| 25 TargetGroup() | 25 TargetGroup(); |
| 26 : debug(NULL), | 26 |
| 27 release(NULL), | 27 // Returns "a" record associated with this group. This is used when getting |
| 28 host_debug(NULL), | 28 // general things like the sources list that should be the same across all |
| 29 host_release(NULL), | 29 // records in a group. |
| 30 debug64(NULL), | 30 const BuilderRecord* get() const { |
| 31 release64(NULL) { | 31 // We assume we always have either a host or a target debug build. |
| 32 return debug ? debug : host_debug; |
| 32 } | 33 } |
| 34 |
| 33 const BuilderRecord* debug; | 35 const BuilderRecord* debug; |
| 34 const BuilderRecord* release; | 36 const BuilderRecord* release; |
| 35 | 37 |
| 36 // When the main compile is targeting a different architecture, these will | 38 // When the main compile is targeting a different architecture, these will |
| 37 // contain the builds with the host system's toolchain. Only supported on | 39 // contain the builds with the host system's toolchain. Only supported on |
| 38 // Linux. | 40 // Linux. |
| 39 const BuilderRecord* host_debug; | 41 const BuilderRecord* host_debug; |
| 40 const BuilderRecord* host_release; | 42 const BuilderRecord* host_release; |
| 41 | 43 |
| 42 // On Windows, we do both 32-bit and 64-bit builds. Null on non-Windows. | 44 // On Windows, we do both 32-bit and 64-bit builds. Null on non-Windows. |
| 43 const BuilderRecord* debug64; | 45 const BuilderRecord* debug64; |
| 44 const BuilderRecord* release64; | 46 const BuilderRecord* release64; |
| 47 |
| 48 // On Mac/iOS, there are some nontrivial differences between the GYP Ninja |
| 49 // build and the GYP XCode build. In GYP, these are parameterized as |
| 50 // conditions using the generator flag. To emulate this, we have different |
| 51 // builds for the XCode and Ninja versions of the GYP file, and the |
| 52 // generator wraps everything in a big condition so that GYP does the right |
| 53 // thing. |
| 54 // |
| 55 // These refer to the GYP-XCode build. The "regular" debug and release |
| 56 // targets above refer to the GYP-Ninja build. |
| 57 const BuilderRecord* xcode_debug; |
| 58 const BuilderRecord* xcode_release; |
| 59 |
| 60 // Optional host versions of the xcode config when cross-compiling to iOS. |
| 61 const BuilderRecord* xcode_host_debug; |
| 62 const BuilderRecord* xcode_host_release; |
| 45 }; | 63 }; |
| 46 | 64 |
| 47 GypTargetWriter(const Target* target, | 65 GypTargetWriter(const Target* target, |
| 48 const Toolchain* toolchain, | 66 const Toolchain* toolchain, |
| 49 const SourceDir& gyp_dir, | 67 const SourceDir& gyp_dir, |
| 50 std::ostream& out); | 68 std::ostream& out); |
| 51 virtual ~GypTargetWriter(); | 69 virtual ~GypTargetWriter(); |
| 52 | 70 |
| 53 static void WriteFile(const SourceFile& gyp_file, | 71 static void WriteFile(const SourceFile& gyp_file, |
| 54 const std::vector<TargetGroup>& targets, | 72 const std::vector<TargetGroup>& targets, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 std::ostream& out_; | 89 std::ostream& out_; |
| 72 | 90 |
| 73 GypHelper helper_; | 91 GypHelper helper_; |
| 74 PathOutput path_output_; | 92 PathOutput path_output_; |
| 75 | 93 |
| 76 private: | 94 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(GypTargetWriter); | 95 DISALLOW_COPY_AND_ASSIGN(GypTargetWriter); |
| 78 }; | 96 }; |
| 79 | 97 |
| 80 #endif // TOOLS_GN_GYP_TARGET_WRITER_H_ | 98 #endif // TOOLS_GN_GYP_TARGET_WRITER_H_ |
| OLD | NEW |