From 4ff0a9d74ef10ecf401cfd99c76644404d3ca51d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Tue, 26 May 2020 16:20:10 -0400 Subject: [PATCH] Can build for windows without precompiled headers... ... Requires some more wx header inclusions, a renaming of CopyFile (to avoid colliding with a certain macro changing it to CopyFileW), and an explicit deletion of a copy constructor and assignment (to avoid generation of std::vector members for an incomplete type) --- src/BatchCommands.cpp | 2 +- src/CrashReport.cpp | 4 ++++ src/DirManager.cpp | 6 +++--- src/FileNames.cpp | 2 +- src/FileNames.h | 2 +- src/PluginManager.cpp | 2 +- src/Project.h | 1 + src/Theme.h | 2 ++ src/effects/EffectUI.h | 2 ++ src/export/ExportMP2.cpp | 1 + src/export/ExportOGG.cpp | 1 + src/widgets/FileHistory.h | 2 ++ 12 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/BatchCommands.cpp b/src/BatchCommands.cpp index dd627c1b5..ffbf4beaa 100644 --- a/src/BatchCommands.cpp +++ b/src/BatchCommands.cpp @@ -1097,7 +1097,7 @@ void MacroCommands::MigrateLegacyChains() newDir.SetFullName(name); const auto newPath = newDir.GetFullPath(); if (!wxFileExists(newPath)) - FileNames::CopyFile(file, newPath); + FileNames::DoCopyFile(file, newPath); } done = true; } diff --git a/src/CrashReport.cpp b/src/CrashReport.cpp index a8f6ca059..ad559488b 100644 --- a/src/CrashReport.cpp +++ b/src/CrashReport.cpp @@ -12,6 +12,10 @@ #if defined(EXPERIMENTAL_CRASH_REPORT) +#if defined(__WXMSW__) +#include +#endif + #include "wxFileNameWrapper.h" #include "AudacityLogger.h" #include "AudioIOBase.h" diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 44f560377..e551e1974 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -1283,7 +1283,7 @@ BlockFilePtr DirManager::CopyBlockFile(const BlockFilePtr &b) //a summary file, so we should check before we copy. if(b->IsSummaryAvailable()) { - if( !FileNames::CopyFile(fn.GetFullPath(), + if( !FileNames::DoCopyFile(fn.GetFullPath(), newFile.GetFullPath()) ) // Disk space exhaustion, maybe throw FileException{ @@ -1423,7 +1423,7 @@ std::pair DirManager::LinkOrCopyToNewProjectDirectory( success = FileNames::HardLinkFile( oldPath, newPath ); if (!success) link = false, - success = FileNames::CopyFile( oldPath, newPath ); + success = FileNames::DoCopyFile( oldPath, newPath ); if (!success) return { false, {} }; } @@ -1454,7 +1454,7 @@ std::pair DirManager::LinkOrCopyToNewProjectDirectory( //if it doesn't, we can assume it was written to the NEW name, which is fine. if (oldFileName.FileExists()) { - bool ok = FileNames::CopyFile(oldPath, newPath); + bool ok = FileNames::DoCopyFile(oldPath, newPath); if (!ok) return { false, {} }; } diff --git a/src/FileNames.cpp b/src/FileNames.cpp index b6eba1cf9..a0eb2ef25 100644 --- a/src/FileNames.cpp +++ b/src/FileNames.cpp @@ -145,7 +145,7 @@ wxString FileNames::FormatWildcard( const FileTypes &fileTypes ) } } -bool FileNames::CopyFile( +bool FileNames::DoCopyFile( const FilePath& file1, const FilePath& file2, bool overwrite) { #ifdef __WXMSW__ diff --git a/src/FileNames.h b/src/FileNames.h index 4e52a6ce1..a2183c8d3 100644 --- a/src/FileNames.h +++ b/src/FileNames.h @@ -55,7 +55,7 @@ namespace FileNames wxString FormatWildcard( const FileTypes &fileTypes ); // This exists to compensate for bugs in wxCopyFile: - bool CopyFile( + bool DoCopyFile( const FilePath& file1, const FilePath& file2, bool overwrite = true); // wxWidgets doesn't have a function to do this: make a hard file-system diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp index bae6be3ec..d2af504de 100644 --- a/src/PluginManager.cpp +++ b/src/PluginManager.cpp @@ -1859,7 +1859,7 @@ bool PluginManager::DropFile(const wxString &fileName) auto dstPath = dst.GetFullPath(); if ( src.FileExists() ) // A simple one-file plug-in - copied = FileNames::CopyFile( + copied = FileNames::DoCopyFile( src.GetFullPath(), dstPath, true ); else { // A sub-folder diff --git a/src/Project.h b/src/Project.h index 4899dca82..007f3eea8 100644 --- a/src/Project.h +++ b/src/Project.h @@ -17,6 +17,7 @@ #include #include // member variable +#include // MSVC wants this class wxFrame; class wxWindow; diff --git a/src/Theme.h b/src/Theme.h index 09481154f..3dc2bc0d5 100644 --- a/src/Theme.h +++ b/src/Theme.h @@ -97,6 +97,8 @@ class AUDACITY_DLL_API ThemeBase /* not final */ { public: ThemeBase(void); + ThemeBase ( const ThemeBase & ) = delete; + ThemeBase &operator =( const ThemeBase & ) = delete; public: virtual ~ThemeBase(void); diff --git a/src/effects/EffectUI.h b/src/effects/EffectUI.h index 44e4388d5..d4f1acd3d 100644 --- a/src/effects/EffectUI.h +++ b/src/effects/EffectUI.h @@ -16,6 +16,8 @@ #include "../Experimental.h" +#include // member variables + #if defined(EXPERIMENTAL_EFFECTS_RACK) #include diff --git a/src/export/ExportMP2.cpp b/src/export/ExportMP2.cpp index ede865a7c..9b2b0e2b9 100644 --- a/src/export/ExportMP2.cpp +++ b/src/export/ExportMP2.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include "Export.h" #include "../FileIO.h" diff --git a/src/export/ExportOGG.cpp b/src/export/ExportOGG.cpp index e15ebae2b..2492dcf86 100644 --- a/src/export/ExportOGG.cpp +++ b/src/export/ExportOGG.cpp @@ -23,6 +23,7 @@ #include #include +#include #include diff --git a/src/widgets/FileHistory.h b/src/widgets/FileHistory.h index 1f6a2dc99..022ec97d0 100644 --- a/src/widgets/FileHistory.h +++ b/src/widgets/FileHistory.h @@ -27,6 +27,8 @@ class AUDACITY_DLL_API FileHistory public: FileHistory(size_t maxfiles = 12, wxWindowID idbase = wxID_FILE); virtual ~FileHistory(); + FileHistory( const FileHistory& ) = delete; + FileHistory &operator =( const FileHistory & ) = delete; // These constants define the range of IDs reserved by the global file history enum {