| @@ -285,7 +285,7 @@ void MainWindow::updateTitle (const String& documentName) | |||
| void MainWindow::showNewProjectWizard() | |||
| { | |||
| jassert (currentProject == nullptr); | |||
| setContentOwned (NewProjectWizard::createComponent(), true); | |||
| setContentOwned (createNewProjectWizardComponent(), true); | |||
| makeVisible(); | |||
| } | |||
| @@ -39,11 +39,7 @@ public: | |||
| if (getTargetLocationString().isEmpty()) | |||
| getTargetLocationValue() = getDefaultBuildsRootFolder() + folderName; | |||
| if ((int) getLibraryType().getValue() <= 0) | |||
| getLibraryType() = 1; | |||
| projectGUID = createGUID (project.getProjectUID()); | |||
| updateOldSettings(); | |||
| } | |||
| @@ -61,16 +57,8 @@ public: | |||
| #endif | |||
| } | |||
| void createExporterProperties (PropertyListBuilder& props) | |||
| void createExporterProperties (PropertyListBuilder&) | |||
| { | |||
| if (projectType.isLibrary()) | |||
| { | |||
| const char* const libTypes[] = { "Static Library (.lib)", "Dynamic Library (.dll)", nullptr }; | |||
| const int libTypeValues[] = { 1, 2 }; | |||
| props.add (new ChoicePropertyComponent (getLibraryType(), "Library Type", | |||
| StringArray (libTypes), | |||
| Array<var> (libTypeValues, numElementsInArray (libTypeValues)))); | |||
| } | |||
| } | |||
| protected: | |||
| @@ -78,11 +66,9 @@ protected: | |||
| mutable File rcFile, iconFile; | |||
| File getProjectFile (const String& extension) const { return getTargetFolder().getChildFile (project.getProjectFilenameRoot()).withFileExtension (extension); } | |||
| File getSLNFile() const { return getProjectFile (".sln"); } | |||
| File getSLNFile() const { return getProjectFile (".sln"); } | |||
| Value getLibraryType() { return getSetting (Ids::libraryType); } | |||
| String getLibraryString() const { return getSettingString (Ids::libraryType); } | |||
| bool isLibraryDLL() const { return msvcIsDLL || (projectType.isLibrary() && (int) settings [Ids::libraryType] == 2); } | |||
| bool isLibraryDLL() const { return msvcIsDLL || projectType.isDynamicLibrary(); } | |||
| static String prependIfNotAbsolute (const String& file, const char* prefix) | |||
| { | |||
| @@ -435,7 +421,7 @@ protected: | |||
| bool hasResourceFile() const | |||
| { | |||
| return ! projectType.isLibrary(); | |||
| return ! projectType.isStaticLibrary(); | |||
| } | |||
| void createResourcesAndIcon() const | |||
| @@ -684,7 +670,8 @@ protected: | |||
| const RelativePath path (projectItem.getFile(), getTargetFolder(), RelativePath::buildTargetFolder); | |||
| addFile (path, parent, | |||
| projectItem.shouldBeAddedToBinaryResources() || (shouldFileBeCompiledByDefault (path) && ! projectItem.shouldBeCompiled()), | |||
| projectItem.shouldBeAddedToBinaryResources() | |||
| || (shouldFileBeCompiledByDefault (path) && ! projectItem.shouldBeCompiled()), | |||
| shouldFileBeCompiledByDefault (path) && (bool) projectItem.shouldUseStdCall()); | |||
| } | |||
| } | |||
| @@ -718,7 +705,7 @@ protected: | |||
| if (config.getIntermediatesPath().isNotEmpty()) | |||
| xml.setAttribute ("IntermediateDirectory", FileHelpers::windowsStylePath (config.getIntermediatesPath())); | |||
| xml.setAttribute ("ConfigurationType", isLibraryDLL() ? "2" : (projectType.isLibrary() ? "4" : "1")); | |||
| xml.setAttribute ("ConfigurationType", isLibraryDLL() ? "2" : (projectType.isStaticLibrary() ? "4" : "1")); | |||
| xml.setAttribute ("UseOfMFC", "0"); | |||
| xml.setAttribute ("ATLMinimizesCRunTimeLibraryUsage", "false"); | |||
| xml.setAttribute ("CharacterSet", "2"); | |||
| @@ -738,7 +725,7 @@ protected: | |||
| createToolElement (xml, "VCXMLDataGeneratorTool"); | |||
| createToolElement (xml, "VCWebServiceProxyGeneratorTool"); | |||
| if (! projectType.isLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| { | |||
| XmlElement* midl = createToolElement (xml, "VCMIDLTool"); | |||
| midl->setAttribute ("PreprocessorDefinitions", isDebug ? "_DEBUG" : "NDEBUG"); | |||
| @@ -757,7 +744,7 @@ protected: | |||
| if (isDebug) | |||
| { | |||
| compiler->setAttribute ("BufferSecurityCheck", ""); | |||
| compiler->setAttribute ("DebugInformationFormat", projectType.isLibrary() ? "3" : "4"); | |||
| compiler->setAttribute ("DebugInformationFormat", projectType.isStaticLibrary() ? "3" : "4"); | |||
| } | |||
| else | |||
| { | |||
| @@ -792,7 +779,7 @@ protected: | |||
| createToolElement (xml, "VCPreLinkEventTool"); | |||
| if (! projectType.isLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| { | |||
| XmlElement* linker = createToolElement (xml, "VCLinkerTool"); | |||
| @@ -870,7 +857,7 @@ protected: | |||
| createToolElement (xml, "VCFxCopTool"); | |||
| if (! projectType.isLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| createToolElement (xml, "VCAppVerifierTool"); | |||
| XmlElement* postBuildEvent = createToolElement (xml, "VCPostBuildEventTool"); | |||
| @@ -1331,7 +1318,7 @@ protected: | |||
| { | |||
| if (projectType.isGUIApplication() || projectType.isCommandLineApp()) return "Application"; | |||
| if (isLibraryDLL()) return "DynamicLibrary"; | |||
| if (projectType.isLibrary()) return "StaticLibrary"; | |||
| if (projectType.isStaticLibrary()) return "StaticLibrary"; | |||
| jassertfalse; | |||
| return String::empty; | |||
| @@ -230,14 +230,14 @@ private: | |||
| String targetName (config.getTargetBinaryNameString()); | |||
| if (projectType.isLibrary()) | |||
| if (projectType.isStaticLibrary() || projectType.isDynamicLibrary()) | |||
| targetName = getLibbedFilename (targetName); | |||
| else | |||
| targetName = targetName.upToLastOccurrenceOf (".", false, false) + makefileTargetSuffix; | |||
| out << " TARGET := " << escapeSpaces (targetName) << newLine; | |||
| if (projectType.isLibrary()) | |||
| if (projectType.isStaticLibrary()) | |||
| out << " BLDCMD = ar -rcs $(OUTDIR)/$(TARGET) $(OBJECTS) $(TARGET_ARCH)" << newLine; | |||
| else | |||
| out << " BLDCMD = $(CXX) -o $(OUTDIR)/$(TARGET) $(OBJECTS) $(LDFLAGS) $(RESOURCES) $(TARGET_ARCH)" << newLine; | |||
| @@ -267,7 +267,7 @@ private: | |||
| << "endif" << newLine | |||
| << newLine; | |||
| if (! projectType.isLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| out << "ifeq ($(TARGET_ARCH),)" << newLine | |||
| << " TARGET_ARCH := -march=native" << newLine | |||
| << "endif" << newLine << newLine; | |||
| @@ -124,14 +124,6 @@ public: | |||
| "A comma-separated list of extra frameworks that should be added to the build. " | |||
| "(Don't include the .framework extension in the name)"); | |||
| if (projectType.isLibrary()) | |||
| { | |||
| const char* const libTypes[] = { "Static Library (.a)", "Dynamic Library (.dylib)", 0 }; | |||
| const int libTypeValues[] = { 1, 2, 0 }; | |||
| props.add (new ChoicePropertyComponent (getLibraryType(), "Library Type", | |||
| StringArray (libTypes), Array<var> (libTypeValues))); | |||
| } | |||
| props.add (new TextPropertyComponent (getPreBuildScriptValue(), "Pre-build shell script", 32768, true), | |||
| "Some shell-script that will be run before a build starts."); | |||
| @@ -173,10 +165,6 @@ public: | |||
| } | |||
| protected: | |||
| Value getLibraryType() { return getSetting (Ids::libraryType); } | |||
| bool isStaticLibrary() const { return projectType.isLibrary() && (int) settings [Ids::libraryType] == 1; } | |||
| //============================================================================== | |||
| class XcodeBuildConfiguration : public BuildConfiguration | |||
| { | |||
| @@ -366,7 +354,7 @@ private: | |||
| addShellScriptBuildPhase ("Pre-build script", getPreBuildScript()); | |||
| if (! isStaticLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| addBuildPhase ("PBXResourcesBuildPhase", resourceIDs); | |||
| if (rezFileIDs.size() > 0) | |||
| @@ -374,7 +362,7 @@ private: | |||
| addBuildPhase ("PBXSourcesBuildPhase", sourceIDs); | |||
| if (! isStaticLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| addBuildPhase ("PBXFrameworksBuildPhase", frameworkIDs); | |||
| addShellScriptBuildPhase ("Post-build script", getPostBuildScript()); | |||
| @@ -637,7 +625,7 @@ private: | |||
| s.add ("WARNING_CFLAGS = -Wreorder"); | |||
| s.add ("GCC_MODEL_TUNING = G5"); | |||
| if (projectType.isLibrary()) | |||
| if (projectType.isStaticLibrary()) | |||
| { | |||
| s.add ("GCC_INLINES_ARE_PRIVATE_EXTERN = NO"); | |||
| s.add ("GCC_SYMBOLS_PRIVATE_EXTERN = NO"); | |||
| @@ -711,12 +699,6 @@ private: | |||
| s.add ("CONFIGURATION_BUILD_DIR = \"$(PROJECT_DIR)/build/$(CONFIGURATION)\""); | |||
| } | |||
| if (projectType.isLibrary()) | |||
| { | |||
| s.add ("CONFIGURATION_BUILD_DIR = \"$(BUILD_DIR)\""); | |||
| s.add ("DEPLOYMENT_LOCATION = YES"); | |||
| } | |||
| String gccVersion ("com.apple.compilers.llvm.clang.1_0"); | |||
| if (! iOS) | |||
| @@ -823,7 +805,7 @@ private: | |||
| void addFrameworks() const | |||
| { | |||
| if (! isStaticLibrary()) | |||
| if (! projectType.isStaticLibrary()) | |||
| { | |||
| StringArray s (xcodeFrameworks); | |||
| s.addTokens (getExtraFrameworksString(), ",;", "\"'"); | |||
| @@ -27,48 +27,8 @@ | |||
| #define __JUCER_NEWPROJECTWIZARD_JUCEHEADER__ | |||
| #include "../jucer_Headers.h" | |||
| #include "jucer_Project.h" | |||
| //============================================================================== | |||
| class NewProjectWizard | |||
| { | |||
| public: | |||
| virtual ~NewProjectWizard(); | |||
| //============================================================================== | |||
| static StringArray getWizards(); | |||
| static int getNumWizards(); | |||
| static NewProjectWizard* createWizard (int index); | |||
| static Component* createComponent(); | |||
| //============================================================================== | |||
| virtual String getName() = 0; | |||
| virtual String getDescription() = 0; | |||
| virtual void addSetupItems (Component& setupComp, OwnedArray<Component>& itemsCreated) = 0; | |||
| virtual Result processResultsFromSetupItems (Component& setupComp) = 0; | |||
| virtual bool initialiseProject (Project& project) = 0; | |||
| protected: | |||
| String appTitle; | |||
| File targetFolder, projectFile; | |||
| Component* ownerWindow; | |||
| StringArray failedFiles; | |||
| //============================================================================== | |||
| NewProjectWizard(); | |||
| Project* runWizard (Component* ownerWindow, | |||
| const String& projectName, | |||
| const File& targetFolder); | |||
| class WizardComp; | |||
| friend class WizardComp; | |||
| File getSourceFilesFolder() const { return projectFile.getSiblingFile ("Source"); } | |||
| static File& getLastWizardFolder(); | |||
| }; | |||
| Component* createNewProjectWizardComponent(); | |||
| #endif // __JUCER_NEWPROJECTWIZARD_JUCEHEADER__ | |||
| @@ -30,8 +30,8 @@ | |||
| //============================================================================== | |||
| ProjectType::ProjectType (const String& type_, const String& desc_) | |||
| : type (type_), desc (desc_) | |||
| ProjectType::ProjectType (const String& t, const String& d) | |||
| : type (t), desc (d) | |||
| { | |||
| getAllTypes().add (this); | |||
| } | |||
| @@ -123,13 +123,13 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| class ProjectType_Library : public ProjectType | |||
| class ProjectType_StaticLibrary : public ProjectType | |||
| { | |||
| public: | |||
| ProjectType_Library() : ProjectType (getTypeName(), "Static Library") {} | |||
| ProjectType_StaticLibrary() : ProjectType (getTypeName(), "Static Library") {} | |||
| static const char* getTypeName() noexcept { return "library"; } | |||
| bool isLibrary() const { return true; } | |||
| bool isStaticLibrary() const { return true; } | |||
| void setMissingProjectProperties (Project&) const | |||
| { | |||
| @@ -142,22 +142,41 @@ public: | |||
| void prepareExporter (ProjectExporter& exporter) const | |||
| { | |||
| exporter.xcodeCreatePList = false; | |||
| exporter.xcodeFileType = "archive.ar"; | |||
| exporter.xcodeProductType = "com.apple.product-type.library.static"; | |||
| exporter.xcodeProductInstallPath = String::empty; | |||
| exporter.makefileTargetSuffix = ".a"; | |||
| exporter.msvcTargetSuffix = ".lib"; | |||
| exporter.msvcExtraPreprocessorDefs.set ("_LIB", ""); | |||
| } | |||
| }; | |||
| if (exporter.getSetting (Ids::libraryType) == 2) | |||
| { | |||
| exporter.xcodeFileType = "compiled.mach-o.dylib"; | |||
| exporter.xcodeProductType = "com.apple.product-type.library.dynamic"; | |||
| exporter.xcodeBundleExtension = ".dylib"; | |||
| } | |||
| else | |||
| { | |||
| exporter.xcodeFileType = "archive.ar"; | |||
| exporter.xcodeProductType = "com.apple.product-type.library.static"; | |||
| } | |||
| //============================================================================== | |||
| class ProjectType_DLL : public ProjectType | |||
| { | |||
| public: | |||
| ProjectType_DLL() : ProjectType (getTypeName(), "Dynamic Library") {} | |||
| static const char* getTypeName() noexcept { return "dll"; } | |||
| bool isDynamicLibrary() const { return true; } | |||
| void setMissingProjectProperties (Project&) const | |||
| { | |||
| } | |||
| void createPropertyEditors (Project&, PropertyListBuilder&) const | |||
| { | |||
| } | |||
| void prepareExporter (ProjectExporter& exporter) const | |||
| { | |||
| exporter.xcodeCreatePList = false; | |||
| exporter.xcodeFileType = "compiled.mach-o.dylib"; | |||
| exporter.xcodeProductType = "com.apple.product-type.library.dynamic"; | |||
| exporter.xcodeBundleExtension = ".dylib"; | |||
| exporter.xcodeProductInstallPath = String::empty; | |||
| exporter.makefileTargetSuffix = ".so"; | |||
| exporter.msvcTargetSuffix = exporter.getSetting (Ids::libraryType) == 2 ? ".dll" : ".lib"; | |||
| exporter.msvcTargetSuffix = ".dll"; | |||
| exporter.msvcExtraPreprocessorDefs.set ("_LIB", ""); | |||
| } | |||
| }; | |||
| @@ -321,12 +340,15 @@ public: | |||
| }; | |||
| //============================================================================== | |||
| static ProjectType_GUIApp guiType; | |||
| static ProjectType_ConsoleApp consoleType; | |||
| static ProjectType_Library libraryType; | |||
| static ProjectType_AudioPlugin audioPluginType; | |||
| static ProjectType_GUIApp guiType; | |||
| static ProjectType_ConsoleApp consoleType; | |||
| static ProjectType_StaticLibrary libraryType; | |||
| static ProjectType_DLL dllType; | |||
| static ProjectType_AudioPlugin audioPluginType; | |||
| //============================================================================== | |||
| const char* ProjectType::getGUIAppTypeName() { return ProjectType_GUIApp::getTypeName(); } | |||
| const char* ProjectType::getConsoleAppTypeName() { return ProjectType_ConsoleApp::getTypeName(); } | |||
| const char* ProjectType::getStaticLibTypeName() { return ProjectType_StaticLibrary::getTypeName(); } | |||
| const char* ProjectType::getDynamicLibTypeName() { return ProjectType_DLL::getTypeName(); } | |||
| const char* ProjectType::getAudioPluginTypeName() { return ProjectType_AudioPlugin::getTypeName(); } | |||
| @@ -45,7 +45,8 @@ public: | |||
| static const ProjectType* findType (const String& typeCode); | |||
| //============================================================================== | |||
| virtual bool isLibrary() const { return false; } | |||
| virtual bool isStaticLibrary() const { return false; } | |||
| virtual bool isDynamicLibrary() const { return false; } | |||
| virtual bool isGUIApplication() const { return false; } | |||
| virtual bool isCommandLineApp() const { return false; } | |||
| virtual bool isAudioPlugin() const { return false; } | |||
| @@ -53,6 +54,8 @@ public: | |||
| static const char* getGUIAppTypeName(); | |||
| static const char* getConsoleAppTypeName(); | |||
| static const char* getStaticLibTypeName(); | |||
| static const char* getDynamicLibTypeName(); | |||
| static const char* getAudioPluginTypeName(); | |||
| virtual void setMissingProjectProperties (Project&) const = 0; | |||
| @@ -59,7 +59,6 @@ namespace Ids | |||
| DECLARE_ID (externalLibraries); | |||
| DECLARE_ID (extraDefs); | |||
| DECLARE_ID (projectType); | |||
| DECLARE_ID (libraryType); | |||
| DECLARE_ID (isDebug); | |||
| DECLARE_ID (alwaysGenerateDebugSymbols); | |||
| DECLARE_ID (targetName); | |||