1/// ************************************************************* 2/// 3/// Licensed to the Apache Software Foundation (ASF) under one 4/// or more contributor license agreements. See the NOTICE file 5/// distributed with this work for additional information 6/// regarding copyright ownership. The ASF licenses this file 7/// to you under the Apache License, Version 2.0 (the 8/// "License"); you may not use this file except in compliance 9/// with the License. You may obtain a copy of the License at 10/// 11/// http://www.apache.org/licenses/LICENSE-2.0 12/// 13/// Unless required by applicable law or agreed to in writing, 14/// software distributed under the License is distributed on an 15/// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16/// KIND, either express or implied. See the License for the 17/// specific language governing permissions and limitations 18/// under the License. 19/// 20/// ************************************************************* 21namespace gb { 22 class CObject; 23 class CxxObject; 24 class Library; 25 class StaticLibrary; 26 class Package; 27 class SdiTarget; 28}; 29 30namespace gb { namespace types 31{ 32 /// A type of target, with its set of rules etc., as used in the build system. 33 class TargetType {}; 34 /// A plain old string. 35 class String {}; 36 /// A partial, relative or absolute filesystem path. 37 class Path {}; 38 /// A target to be build. 39 class Target 40 { 41 public: 42 /// The absolute filesystem path representing the target. 43 44 /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. 45 Path get_target(); 46 }; 47 /// A partial or complete shell-command. 48 class Command {}; 49 /// A integer number. 50 class Integer {}; 51 /// A boolean value. 52 53 /// There are const boolean values true and false for 54 /// comparisons (written as $(true) and $(false) in makefiles. 55 class Bool {}; 56 /// A language (for localization) 57 58 /// A language represented by its ISO 639-1:2002 code. 59 class Language {}; 60 /// A List of objects. 61 62 /// A List of objects represented by a whitespace separated list 63 /// in makefiles. 64 template <typename T> 65 class List<T> {}; 66 67 /// A Mapping from with a key of type K and a value of type V 68 69 /// A Mapping is represented by a whitespace separated list 70 /// of key-value pairs. Key and value are separated by a colon (:). 71 template <typename K, typename V> 72 class Map<K,V> {}; 73 /// A target that can be cleaned. 74 class IsCleanable 75 { 76 public: 77 /// The (phony) absolute filesystem path to clean the target. 78 79 /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. 80 Path get_clean_target(); 81 }; 82 /// A target that has generated dependencies. 83 class HasDependencies 84 { 85 public: 86 /// The absolute filesystem path to the file containing the dependencies. 87 88 /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. 89 Path get_dep_target(); 90 }; 91 /// A target that has a source file from which it is generated. 92 class HasSource 93 { 94 public: 95 /// The absolute filesystem path to the source file. 96 Path get_source(); 97 }; 98 /// A target that links objects and libraries. 99 class IsLinking 100 { 101 public: 102 /// Add a CObject to be compiled and linked. 103 void add_cobject(CObject cobject); 104 /// Add multiple CObject s to be compiled and linked. 105 void add_cobjects(List<CObject> cobjects); 106 /// Add a CxxObject to be compiled and linked. 107 void add_cxxobject(CxxObject cobject); 108 /// Add multiple CxxObject s to be compiled and linked. 109 void add_cxxobjects(List<CxxObject> cobjects); 110 /// Add multiple CxxObject s to be compiled and linked (with exceptions enabled). 111 void add_exception_objects(List<CxxObject> cobject); 112 /// Add libraries to link against dynamically. 113 void add_linked_libs(List<Library> linked_libs); 114 /// Add libraries to link against statically. 115 void add_linked_static_libs(List<StaticLibrary> linked_static_libs); 116 /// Add multiple CxxObject s to be compiled and linked (without exceptions enabled). 117 /// @deprecated We should not care about disabling exception. 118 void add_noexception_objects(List<CxxObject> cobject); 119 /// Set auxiliary files that are produced by linking (for cleanup and copying). 120 void set_auxtargets(List<Path> auxtargets); 121 /// Set the location for the produced DLL (used on Windows only). 122 void set_dll_target(Path dlltarget); 123 /// Set additional flags for the link command. 124 void set_ldflags(List<Path> ldflags); 125 }; 126 /// A target that delivers headers of some kind. 127 class DeliversHeaders 128 { 129 public: 130 /// The absolute filesystem path which is touched when all headers for this target are prepared. 131 132 /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. 133 Path get_headers_target(); 134 /// The absolute filesystem path which is touched when all external headers for this target are prepared. 135 136 /// This function needs to be defined in solenv/gbuild/target_names.mk so that it is available to everywhere. 137 Path get_external_headers_target(); 138 /// Add multiple Packages that need to be delivered/generated 139 /// before compilation or dependency generation can start. 140 void add_package_headers(List<Package> packages); 141 /// Add multiple SdiTargets that need to be delivered/generated 142 /// before compilation or dependency generation can start. 143 void add_sdi_headers(List<SdiTarget> sdis); 144 }; 145 /// A target where settings for the compilation can be set. 146 class HasCompileSettings 147 { 148 public: 149 /// Sets flags for plain C compilation. 150 /// \$\$(CFLAGS) contains the current flags and can be used if 151 /// just a few need to be modified. 152 void set_cflags(List<String> cflags); 153 /// Sets flags for C++ compilation. 154 /// \$\$(CXXFLAGS) contains the current flags and can be used if 155 /// just a few need to be modified. 156 void set_cxxflags(List<String> cxxflags); 157 /// Sets defines for C/C++ compilation. 158 /// \$\$(DEFS) contains the current flags and can be used if 159 /// just a few need to be modified. 160 void set_defs(List<String> defs); 161 /// Sets the include paths for C/C++ compilation. 162 /// \$\$(INCLUDE) contains the current paths and can be used if 163 /// just a few need to be modified. 164 void set_include(List<Path> include); 165 /// Sets the stl include paths for C++ compilation. 166 /// \$\$(INCLUDE_STL) contains the current paths and can be used if 167 /// just a few need to be modified. 168 void set_include_stl(List<Path> include_stl); 169 }; 170 /// A target using the resource compiler 171 class UsesRsc 172 { 173 public: 174 /// The command to execute rsc. 175 static const Command RSCCOMMAND; 176 /// The target on with to depend to make sure the rsc executable is available. 177 static const Path RSCTARGET; 178 }; 179 /// A target processing a set of srs files 180 class HasSrs 181 { 182 public: 183 /// Add a SrsTarget to be processed. 184 void add_one_srs(SrsTarget srs); 185 /// Add multiple SrsTarget s to be processed. 186 void add_srs(List<SrsTarget> srs); 187 }; 188}}; 189/* vim: set filetype=cpp : */ 190