Imported Upstream version 2.8.12.2
[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   cmOSXBundleGenerator(cmTarget* target,
29                        const char* configName);
30
31   // create an app bundle at a given root, and return
32   // the directory within the bundle that contains the executable
33   void CreateAppBundle(const std::string& targetName, std::string& root);
34
35   // create a framework at a given root
36   void CreateFramework(const std::string& targetName,
37                        const std::string& root);
38
39   // create a cf bundle at a given root
40   void CreateCFBundle(const std::string& targetName,
41                       const std::string& root);
42
43   struct MacOSXContentGeneratorType
44   {
45     virtual ~MacOSXContentGeneratorType() {}
46     virtual void operator()(cmSourceFile& source, const char* pkgloc) = 0;
47   };
48
49   void GenerateMacOSXContentStatements(
50     std::vector<cmSourceFile*> const& sources,
51     MacOSXContentGeneratorType* generator);
52   std::string InitMacOSXContentDirectory(const char* pkgloc);
53
54   void SetMacContentFolders(std::set<cmStdString>* macContentFolders)
55   { this->MacContentFolders = macContentFolders; }
56
57 private:
58   bool MustSkip();
59
60 private:
61   cmTarget* Target;
62   cmMakefile* Makefile;
63   cmLocalGenerator* LocalGenerator;
64   const char* ConfigName;
65   std::set<cmStdString>* MacContentFolders;
66 };
67
68
69 #endif