Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmOSXBundleGenerator.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2012 Nicolas Despres <nicolas.despres@gmail.com>
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmOSXBundleGenerator_h
13 #define cmOSXBundleGenerator_h
14
15 #include "cmStandardIncludes.h"
16 #include "cmSourceFile.h"
17
18 #include <string>
19 #include <set>
20
21 class cmTarget;
22 class cmMakefile;
23 class cmLocalGenerator;
24
25 class cmOSXBundleGenerator
26 {
27 public:
28   static void PrepareTargetProperties(cmTarget* target);
29
30   cmOSXBundleGenerator(cmTarget* target,
31                        std::string targetNameOut,
32                        const char* configName);
33
34   void CreateAppBundle(std::string& targetName, std::string& outpath);
35   void CreateFramework(std::string const& targetName);
36   void CreateCFBundle(std::string& targetName, std::string& outpath);
37
38   struct MacOSXContentGeneratorType
39   {
40     virtual ~MacOSXContentGeneratorType() {}
41     virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
42   };
43
44   void GenerateMacOSXContentStatements(
45     std::vector<cmSourceFile*> const& sources,
46     MacOSXContentGeneratorType* generator);
47   std::string InitMacOSXContentDirectory(const char* pkgloc);
48
49   std::string GetMacContentDirectory() const
50   { return this->MacContentDirectory; }
51   std::string GetFrameworkVersion() const
52   { return this->FrameworkVersion; }
53   void SetMacContentFolders(std::set<cmStdString>* macContentFolders)
54   { this->MacContentFolders = macContentFolders; }
55
56 private:
57   bool MustSkip();
58
59 private:
60   cmTarget* Target;
61   cmMakefile* Makefile;
62   cmLocalGenerator* LocalGenerator;
63   std::string TargetNameOut;
64   const char* ConfigName;
65   std::string MacContentDirectory;
66   std::string FrameworkVersion;
67   std::set<cmStdString>* MacContentFolders;
68 };
69
70
71 #endif