From 0ca9937987ecf2bf3f579147ffc952838565415b Mon Sep 17 00:00:00 2001 From: Benjamin Radel Date: Fri, 28 Jun 2024 21:56:36 +0200 Subject: Make DCPoMatic compatible with ICU >= 75 ICU >= 75 uses c++17 features and therefore requires compilation with -std=c++17. However, this causes some namespace issues in src/wx/file_picker_ctrl.cc and src/wx/film_name_location_dialog.cc between boost::optional, boost::filesystem and the corresponding names from the std lib. The patch fixes this namespace issues and adds a version check in wscript to enable compilation with c++17, if icu >= 75 is detected. --- src/wx/about_dialog.cc | 1 + src/wx/file_picker_ctrl.cc | 8 ++++---- src/wx/film_name_location_dialog.cc | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 2c742cce3..59fad0878 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -99,6 +99,7 @@ AboutDialog::AboutDialog (wxWindow* parent) written_by.Add (wxT ("Terrence Meiczinger")); written_by.Add (wxT ("Mart Jansink")); written_by.Add (wxT ("Ole Laursen")); + written_by.Add (wxT ("Benjamin Radel")); add_section (_("Written by"), written_by); wxArrayString with_help_from; diff --git a/src/wx/file_picker_ctrl.cc b/src/wx/file_picker_ctrl.cc index 7aa0bfb40..82978dad6 100644 --- a/src/wx/file_picker_ctrl.cc +++ b/src/wx/file_picker_ctrl.cc @@ -43,8 +43,8 @@ FilePickerCtrl::FilePickerCtrl( bool open, bool warn_overwrite, std::string initial_path_key, - optional initial_filename, - optional override_path + boost::optional initial_filename, + boost::optional override_path ) : wxPanel (parent) , _prompt (prompt) @@ -72,7 +72,7 @@ FilePickerCtrl::FilePickerCtrl( void -FilePickerCtrl::set_filename(optional filename) +FilePickerCtrl::set_filename(boost::optional filename) { if (filename) { _file->SetLabel(std_to_wx(*filename)); @@ -83,7 +83,7 @@ FilePickerCtrl::set_filename(optional filename) void -FilePickerCtrl::set_path(optional path) +FilePickerCtrl::set_path(boost::optional path) { _path = path; diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc index 05ffa7a68..6c54f1848 100644 --- a/src/wx/film_name_location_dialog.cc +++ b/src/wx/film_name_location_dialog.cc @@ -39,7 +39,7 @@ using namespace std; using namespace boost; -optional FilmNameLocationDialog::_directory; +boost::optional FilmNameLocationDialog::_directory; FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title, bool offer_templates) @@ -112,17 +112,17 @@ FilmNameLocationDialog::folder_changed () } -filesystem::path +boost::filesystem::path FilmNameLocationDialog::path () const { - filesystem::path p; + boost::filesystem::path p; p /= wx_to_std (_folder->GetPath()); p /= wx_to_std (_name->GetValue()); return p; } -optional +boost::optional FilmNameLocationDialog::template_name () const { if (!_use_template->GetValue() || _template_name->GetSelection() == -1) { @@ -139,7 +139,7 @@ FilmNameLocationDialog::template_name () const bool FilmNameLocationDialog::check_path () { - if (filesystem::is_directory(path()) && !filesystem::is_empty(path())) { + if (boost::filesystem::is_directory(path()) && !boost::filesystem::is_empty(path())) { if (!confirm_dialog ( this, std_to_wx ( @@ -150,7 +150,7 @@ FilmNameLocationDialog::check_path () )) { return false; } - } else if (filesystem::is_regular_file(path())) { + } else if (boost::filesystem::is_regular_file(path())) { error_dialog ( this, String::compose (wx_to_std(_("%1 already exists as a file, so you cannot use it for a film.")), path().c_str()) -- cgit v1.2.3 From fefcccd526bd4cf12dfdf43ce36ccb62b044528e Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 6 Jul 2024 09:32:10 +0200 Subject: Add some missing ArgFixers for Windows command lines (#2844). --- src/lib/kdm_cli.cc | 7 +++++-- src/tools/dcpomatic_cli.cc | 17 ++++++++++------- src/tools/dcpomatic_create.cc | 4 +++- src/tools/dcpomatic_server_cli.cc | 13 ++++++++----- 4 files changed, 26 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index 4199f8430..ee9622255 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -25,6 +25,7 @@ #include "cinema.h" +#include "cross.h" #include "config.h" #include "dkdm_wrapper.h" #include "email.h" @@ -458,6 +459,8 @@ optional kdm_cli (int argc, char* argv[], std::function out) try { + ArgFixer fixer(argc, argv); + boost::filesystem::path output = dcp::filesystem::current_path(); auto container_name_format = Config::instance()->kdm_container_name_format(); auto filename_format = Config::instance()->kdm_filename_format(); @@ -512,7 +515,7 @@ try { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:G", long_options, &option_index); + int c = getopt_long(fixer.argc(), fixer.argv(), "ho:K:Z:f:t:d:F:pae::zvc:S:C:T:BDE:G", long_options, &option_index); if (c == -1) { break; @@ -646,7 +649,7 @@ try throw KDMCLIError ("you must specify --valid-from"); } - if (optind >= argc) { + if (optind >= fixer.argc()) { throw KDMCLIError ("no film, CPL ID or DKDM specified"); } diff --git a/src/tools/dcpomatic_cli.cc b/src/tools/dcpomatic_cli.cc index 65252ff29..5a7ec3c72 100644 --- a/src/tools/dcpomatic_cli.cc +++ b/src/tools/dcpomatic_cli.cc @@ -260,6 +260,9 @@ show_jobs_on_console (bool progress) int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + auto const program_name = fixer.argv()[0]; + boost::filesystem::path film_dir; bool progress = true; bool no_remote = false; @@ -300,7 +303,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index); + int c = getopt_long(fixer.argc(), fixer.argv(), "vhfnrt:j:kAs:ldc:BC:D:E", long_options, &option_index); if (c == -1) { break; @@ -311,7 +314,7 @@ main (int argc, char* argv[]) cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': - help (argv[0]); + help(program_name); exit (EXIT_SUCCESS); case 'f': cout << dcpomatic_cxx_flags << "\n"; @@ -387,8 +390,8 @@ main (int argc, char* argv[]) exit (EXIT_SUCCESS); } - if (optind >= argc) { - help (argv[0]); + if (optind >= fixer.argc()) { + help(program_name); exit (EXIT_FAILURE); } @@ -407,7 +410,7 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - film_dir = argv[optind]; + film_dir = fixer.argv()[optind]; dcpomatic_setup_path_encoding (); dcpomatic_setup (); @@ -430,7 +433,7 @@ main (int argc, char* argv[]) film.reset (new Film (film_dir)); film->read_metadata (); } catch (std::exception& e) { - cerr << argv[0] << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n"; + cerr << program_name << ": error reading film `" << film_dir.string() << "' (" << e.what() << ")\n"; exit (EXIT_FAILURE); } @@ -445,7 +448,7 @@ main (int argc, char* argv[]) auto paths = i->paths(); for (auto j: paths) { if (!dcp::filesystem::exists(j)) { - cerr << argv[0] << ": content file " << j << " not found.\n"; + cerr << program_name << ": content file " << j << " not found.\n"; exit (EXIT_FAILURE); } } diff --git a/src/tools/dcpomatic_create.cc b/src/tools/dcpomatic_create.cc index 5b5f4dba2..e0d5b3973 100644 --- a/src/tools/dcpomatic_create.cc +++ b/src/tools/dcpomatic_create.cc @@ -70,10 +70,12 @@ public: int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + dcpomatic_setup_path_encoding (); dcpomatic_setup (); - CreateCLI cc (argc, argv); + CreateCLI cc(fixer.argc(), fixer.argv()); if (cc.error) { cerr << *cc.error << "\n"; exit (1); diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 6d7f6aba7..023099034 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -62,6 +62,9 @@ help (string n) int main (int argc, char* argv[]) { + ArgFixer fixer(argc, argv); + auto const program_name = fixer.argv()[0]; + dcpomatic_setup_path_encoding (); dcpomatic_setup (); @@ -80,7 +83,7 @@ main (int argc, char* argv[]) { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vht:AB", long_options, &option_index); + int c = getopt_long(fixer.argc(), fixer.argv(), "vht:AB", long_options, &option_index); if (c == -1) { break; @@ -91,7 +94,7 @@ main (int argc, char* argv[]) cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': - help (argv[0]); + help(program_name); exit (EXIT_SUCCESS); case 't': num_threads = atoi (optarg); @@ -115,12 +118,12 @@ main (int argc, char* argv[]) server.run (); } catch (boost::system::system_error& e) { if (e.code() == boost::system::errc::address_in_use) { - cerr << argv[0] << ": address already in use. Is another DCP-o-matic server instance already running?\n"; + cerr << program_name << ": address already in use. Is another DCP-o-matic server instance already running?\n"; exit (EXIT_FAILURE); } - cerr << argv[0] << ": " << e.what() << "\n"; + cerr << program_name << ": " << e.what() << "\n"; } catch (std::exception& e) { - cerr << argv[0] << ": failed to start server; " << e.what() << "\n"; + cerr << program_name << ": failed to start server; " << e.what() << "\n"; } return 0; } -- cgit v1.2.3