From 60e83cc208083b7759fded7302c193d34c02cb1a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 6 Jul 2023 23:09:08 +0200 Subject: Patch from Aaron Boxer adding initial support for GPU-powered J2K encoding via his tool "grok". --- src/wx/full_config_dialog.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/wx/full_config_dialog.cc') diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 175d78730..df974c1fa 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -45,6 +45,7 @@ #include "send_test_email_dialog.h" #include "server_dialog.h" #include "static_text.h" +#include "gpu_config_panel.h" #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" @@ -1944,6 +1945,7 @@ create_full_config_dialog () e->AddPage (new SoundPage (ps, border)); e->AddPage (new DefaultsPage (ps, border)); e->AddPage (new EncodingServersPage(ps, border)); + e->AddPage (new GPUPage (ps, border)); e->AddPage (new KeysPage (ps, border)); e->AddPage (new TMSPage (ps, border)); e->AddPage (new EmailPage (ps, border)); -- cgit v1.2.3 From bf770122a39965599cdd23e876dfd8e7db64a639 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 7 Jul 2023 23:42:08 +0200 Subject: Move grok headers into src/wx/grok --- src/wx/full_config_dialog.cc | 2 +- src/wx/gpu_config_panel.h | 186 ----------------------------------------- src/wx/grok/gpu_config_panel.h | 186 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 187 insertions(+), 187 deletions(-) delete mode 100644 src/wx/gpu_config_panel.h create mode 100644 src/wx/grok/gpu_config_panel.h (limited to 'src/wx/full_config_dialog.cc') diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index df974c1fa..119091af3 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -45,7 +45,7 @@ #include "send_test_email_dialog.h" #include "server_dialog.h" #include "static_text.h" -#include "gpu_config_panel.h" +#include "grok/gpu_config_panel.h" #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" diff --git a/src/wx/gpu_config_panel.h b/src/wx/gpu_config_panel.h deleted file mode 100644 index 1478434be..000000000 --- a/src/wx/gpu_config_panel.h +++ /dev/null @@ -1,186 +0,0 @@ -#pragma once - -static std::vector get_gpu_names(std::string binary, std::string filename) -{ - // Execute the GPU listing program and redirect its output to a file - std::system((binary + " > " + filename).c_str()); - - std::vector gpu_names; - std::ifstream file(filename); - if (file.is_open()) - { - std::string line; - while (std::getline(file, line)) - gpu_names.push_back(line); - file.close(); - } - - return gpu_names; -} - -class GpuList : public wxPanel -{ -public: - GpuList(wxPanel* parent) : wxPanel(parent, wxID_ANY), selection(0) { - comboBox = new wxComboBox(this, wxID_ANY, "", wxDefaultPosition, wxSize(400, -1)); - comboBox->Bind(wxEVT_COMBOBOX, &GpuList::OnComboBox, this); - update(); - - wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); - - sizer->Add(comboBox, 0, wxALIGN_CENTER_VERTICAL); // Vertically center the comboBox - - this->SetSizerAndFit(sizer); - } - void update(void) { - auto cfg = Config::instance(); - auto lister_binary = cfg->gpu_binary_location() + "/" + "gpu_lister"; - auto lister_file = cfg->gpu_binary_location () + "/" + "gpus.txt"; - if (boost::filesystem::exists(lister_binary)) { - auto gpu_names = get_gpu_names(lister_binary, lister_file); - - comboBox->Clear(); - for (const auto& name : gpu_names) - comboBox->Append(name); - } - } - - int getSelection(void) { - return selection; - } - void setSelection(int sel) { - if ((int)comboBox->GetCount() > sel) - comboBox->SetSelection(sel); - } - -private: - void OnComboBox([[maybe_unused]] wxCommandEvent& event) { - selection = comboBox->GetSelection(); - if (selection != wxNOT_FOUND) - Config::instance ()->set_selected_gpu(selection); - } - - wxComboBox* comboBox; - int selection; -}; - -class GPUPage : public Page -{ -public: - GPUPage (wxSize panel_size, int border) - : Page (panel_size, border), - _enable_gpu(nullptr), _binary_location(nullptr), _gpu_list_control(nullptr) - {} - - wxString GetName () const override - { - return _("GPU"); - } - -#ifdef DCPOMATIC_OSX - wxBitmap GetLargeIcon () const override - { - return wxBitmap(icon_path("tms"), wxBITMAP_TYPE_PNG); - } -#endif - -private: - void setup () override - { - auto config = Config::instance (); - - _enable_gpu = new CheckBox (_panel, _("Enable GPU Acceleration")); - _panel->GetSizer()->Add (_enable_gpu, 0, wxALL | wxEXPAND, _border); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); - - add_label_to_sizer (table, _panel, _("Acceleration Binary Folder"), true, 0, wxLEFT | wxLEFT | wxALIGN_CENTRE_VERTICAL); - _binary_location = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST); - table->Add (_binary_location, 1, wxEXPAND); - - add_label_to_sizer (table, _panel, _("GPU Selection"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - _gpu_list_control = new GpuList(_panel); - table->Add (_gpu_list_control, 1, wxEXPAND); - - add_label_to_sizer (table, _panel, _("License Server"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - _server = new wxTextCtrl (_panel, wxID_ANY); - table->Add (_server, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _panel, _("Port"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - _port = new wxSpinCtrl (_panel, wxID_ANY); - _port->SetRange (0, 65535); - table->Add (_port); - - add_label_to_sizer (table, _panel, _("License"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); - _license = new PasswordEntry (_panel); - table->Add (_license->get_panel(), 1, wxEXPAND | wxALL); - - _enable_gpu->bind(&GPUPage::enable_gpu_changed, this); - _binary_location->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&GPUPage::binary_location_changed, this)); - _server->Bind (wxEVT_TEXT, boost::bind(&GPUPage::server_changed, this)); - _port->Bind (wxEVT_SPINCTRL, boost::bind(&GPUPage::port_changed, this)); - _license->Changed.connect (boost::bind(&GPUPage::license_changed, this)); - - _binary_location->Enable(config->enable_gpu()); - _gpu_list_control->Enable(config->enable_gpu()); - _server->Enable(config->enable_gpu()); - _port->Enable(config->enable_gpu()); - _license->get_panel()->Enable(config->enable_gpu()); - } - - - void config_changed () override - { - auto config = Config::instance (); - - checked_set (_enable_gpu, config->enable_gpu()); - _binary_location->SetPath(config->gpu_binary_location ()); - _gpu_list_control->update(); - _gpu_list_control->setSelection(config->selected_gpu()); - checked_set (_server, config->gpu_license_server()); - checked_set (_port, config->gpu_license_port()); - checked_set (_license, config->gpu_license()); - } - - void enable_gpu_changed () - { - auto config = Config::instance (); - - config->set_enable_gpu (_enable_gpu->GetValue()); - _binary_location->Enable(config->enable_gpu()); - _gpu_list_control->Enable(config->enable_gpu()); - _server->Enable(config->enable_gpu()); - _port->Enable(config->enable_gpu()); - _license->get_panel()->Enable(config->enable_gpu()); - } - - void binary_location_changed () - { - Config::instance()->set_gpu_binary_location (wx_to_std (_binary_location->GetPath ())); - _gpu_list_control->update(); - } - - void server_changed () - { - Config::instance()->set_gpu_license_server(wx_to_std(_server->GetValue())); - } - - void port_changed () - { - Config::instance()->set_gpu_license_port(_port->GetValue()); - } - - void license_changed () - { - Config::instance()->set_gpu_license(_license->get()); - } - - CheckBox* _enable_gpu; - wxDirPickerCtrl* _binary_location; - GpuList *_gpu_list_control; - wxTextCtrl* _server; - wxSpinCtrl* _port; - PasswordEntry* _license; -}; diff --git a/src/wx/grok/gpu_config_panel.h b/src/wx/grok/gpu_config_panel.h new file mode 100644 index 000000000..1478434be --- /dev/null +++ b/src/wx/grok/gpu_config_panel.h @@ -0,0 +1,186 @@ +#pragma once + +static std::vector get_gpu_names(std::string binary, std::string filename) +{ + // Execute the GPU listing program and redirect its output to a file + std::system((binary + " > " + filename).c_str()); + + std::vector gpu_names; + std::ifstream file(filename); + if (file.is_open()) + { + std::string line; + while (std::getline(file, line)) + gpu_names.push_back(line); + file.close(); + } + + return gpu_names; +} + +class GpuList : public wxPanel +{ +public: + GpuList(wxPanel* parent) : wxPanel(parent, wxID_ANY), selection(0) { + comboBox = new wxComboBox(this, wxID_ANY, "", wxDefaultPosition, wxSize(400, -1)); + comboBox->Bind(wxEVT_COMBOBOX, &GpuList::OnComboBox, this); + update(); + + wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL); + + sizer->Add(comboBox, 0, wxALIGN_CENTER_VERTICAL); // Vertically center the comboBox + + this->SetSizerAndFit(sizer); + } + void update(void) { + auto cfg = Config::instance(); + auto lister_binary = cfg->gpu_binary_location() + "/" + "gpu_lister"; + auto lister_file = cfg->gpu_binary_location () + "/" + "gpus.txt"; + if (boost::filesystem::exists(lister_binary)) { + auto gpu_names = get_gpu_names(lister_binary, lister_file); + + comboBox->Clear(); + for (const auto& name : gpu_names) + comboBox->Append(name); + } + } + + int getSelection(void) { + return selection; + } + void setSelection(int sel) { + if ((int)comboBox->GetCount() > sel) + comboBox->SetSelection(sel); + } + +private: + void OnComboBox([[maybe_unused]] wxCommandEvent& event) { + selection = comboBox->GetSelection(); + if (selection != wxNOT_FOUND) + Config::instance ()->set_selected_gpu(selection); + } + + wxComboBox* comboBox; + int selection; +}; + +class GPUPage : public Page +{ +public: + GPUPage (wxSize panel_size, int border) + : Page (panel_size, border), + _enable_gpu(nullptr), _binary_location(nullptr), _gpu_list_control(nullptr) + {} + + wxString GetName () const override + { + return _("GPU"); + } + +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const override + { + return wxBitmap(icon_path("tms"), wxBITMAP_TYPE_PNG); + } +#endif + +private: + void setup () override + { + auto config = Config::instance (); + + _enable_gpu = new CheckBox (_panel, _("Enable GPU Acceleration")); + _panel->GetSizer()->Add (_enable_gpu, 0, wxALL | wxEXPAND, _border); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border); + + add_label_to_sizer (table, _panel, _("Acceleration Binary Folder"), true, 0, wxLEFT | wxLEFT | wxALIGN_CENTRE_VERTICAL); + _binary_location = new wxDirPickerCtrl (_panel, wxDD_DIR_MUST_EXIST); + table->Add (_binary_location, 1, wxEXPAND); + + add_label_to_sizer (table, _panel, _("GPU Selection"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); + _gpu_list_control = new GpuList(_panel); + table->Add (_gpu_list_control, 1, wxEXPAND); + + add_label_to_sizer (table, _panel, _("License Server"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); + _server = new wxTextCtrl (_panel, wxID_ANY); + table->Add (_server, 1, wxEXPAND | wxALL); + + add_label_to_sizer (table, _panel, _("Port"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); + _port = new wxSpinCtrl (_panel, wxID_ANY); + _port->SetRange (0, 65535); + table->Add (_port); + + add_label_to_sizer (table, _panel, _("License"), true, 0, wxLEFT | wxRIGHT | wxALIGN_CENTRE_VERTICAL); + _license = new PasswordEntry (_panel); + table->Add (_license->get_panel(), 1, wxEXPAND | wxALL); + + _enable_gpu->bind(&GPUPage::enable_gpu_changed, this); + _binary_location->Bind (wxEVT_DIRPICKER_CHANGED, boost::bind (&GPUPage::binary_location_changed, this)); + _server->Bind (wxEVT_TEXT, boost::bind(&GPUPage::server_changed, this)); + _port->Bind (wxEVT_SPINCTRL, boost::bind(&GPUPage::port_changed, this)); + _license->Changed.connect (boost::bind(&GPUPage::license_changed, this)); + + _binary_location->Enable(config->enable_gpu()); + _gpu_list_control->Enable(config->enable_gpu()); + _server->Enable(config->enable_gpu()); + _port->Enable(config->enable_gpu()); + _license->get_panel()->Enable(config->enable_gpu()); + } + + + void config_changed () override + { + auto config = Config::instance (); + + checked_set (_enable_gpu, config->enable_gpu()); + _binary_location->SetPath(config->gpu_binary_location ()); + _gpu_list_control->update(); + _gpu_list_control->setSelection(config->selected_gpu()); + checked_set (_server, config->gpu_license_server()); + checked_set (_port, config->gpu_license_port()); + checked_set (_license, config->gpu_license()); + } + + void enable_gpu_changed () + { + auto config = Config::instance (); + + config->set_enable_gpu (_enable_gpu->GetValue()); + _binary_location->Enable(config->enable_gpu()); + _gpu_list_control->Enable(config->enable_gpu()); + _server->Enable(config->enable_gpu()); + _port->Enable(config->enable_gpu()); + _license->get_panel()->Enable(config->enable_gpu()); + } + + void binary_location_changed () + { + Config::instance()->set_gpu_binary_location (wx_to_std (_binary_location->GetPath ())); + _gpu_list_control->update(); + } + + void server_changed () + { + Config::instance()->set_gpu_license_server(wx_to_std(_server->GetValue())); + } + + void port_changed () + { + Config::instance()->set_gpu_license_port(_port->GetValue()); + } + + void license_changed () + { + Config::instance()->set_gpu_license(_license->get()); + } + + CheckBox* _enable_gpu; + wxDirPickerCtrl* _binary_location; + GpuList *_gpu_list_control; + wxTextCtrl* _server; + wxSpinCtrl* _port; + PasswordEntry* _license; +}; -- cgit v1.2.3 From 014cffeabbf9710c927bd9518b558211298f52e2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 24 Sep 2023 12:09:16 +0200 Subject: Only build grok for Ubuntu 22.04. --- cscript | 3 +++ src/lib/j2k_encoder.cc | 27 +++++++++++++++++++++++---- src/lib/j2k_encoder.h | 6 +++++- src/lib/writer.h | 1 + src/lib/wscript | 4 +++- src/tools/dcpomatic.cc | 4 ++++ src/tools/dcpomatic_batch.cc | 4 ++++ src/tools/dcpomatic_server.cc | 4 ++++ src/tools/dcpomatic_server_cli.cc | 4 ++++ src/wx/full_config_dialog.cc | 4 ++++ wscript | 5 +++++ 11 files changed, 60 insertions(+), 6 deletions(-) (limited to 'src/wx/full_config_dialog.cc') diff --git a/cscript b/cscript index e96ff0ae9..ad68da6e7 100644 --- a/cscript +++ b/cscript @@ -564,6 +564,9 @@ def configure_options(target, options, for_package=False): if target.platform == 'osx' and target.arch == 'arm64': opt += ' --target-macos-arm64 --wx-config=%s/wx-config' % target.bin + if target.platform == 'linux' and target.distro == 'ubuntu' and target.version in ['22.04']: + opt += ' --enable-grok' + return opt def build(target, options, for_package): diff --git a/src/lib/j2k_encoder.cc b/src/lib/j2k_encoder.cc index a3cab7c1c..22f2ea6d7 100644 --- a/src/lib/j2k_encoder.cc +++ b/src/lib/j2k_encoder.cc @@ -33,7 +33,9 @@ #include "encode_server_finder.h" #include "film.h" #include "cpu_j2k_encoder_thread.h" +#ifdef DCPOMATIC_GROK #include "grok_j2k_encoder_thread.h" +#endif #include "remote_j2k_encoder_thread.h" #include "j2k_encoder.h" #include "log.h" @@ -65,8 +67,10 @@ J2KEncoder::J2KEncoder(shared_ptr film, Writer& writer) : _film (film) , _history (200) , _writer (writer) +#ifdef DCPOMATIC_GROK , _dcpomatic_context(film, writer, _history, Config::instance()->gpu_binary_location()) , _context(Config::instance()->enable_gpu() ? new grk_plugin::GrokContext(_dcpomatic_context) : nullptr) +#endif { servers_list_changed (); } @@ -78,7 +82,9 @@ J2KEncoder::~J2KEncoder () terminate_threads(); +#ifdef DCPOMATIC_GROK delete _context; +#endif } @@ -115,8 +121,10 @@ J2KEncoder::pause() /* Something might have been thrown during terminate_threads */ rethrow (); +#ifdef DCPOMATIC_GROK delete _context; _context = nullptr; +#endif } @@ -126,7 +134,9 @@ void J2KEncoder::resume() return; } +#ifdef DCPOMATIC_GROK _context = new grk_plugin::GrokContext(_dcpomatic_context); +#endif servers_list_changed(); } @@ -163,13 +173,16 @@ J2KEncoder::end() So just mop up anything left in the queue here. */ for (auto & i: _queue) { +#ifdef DCPOMATIC_GROK if (Config::instance()->enable_gpu ()) { if (!_context->scheduleCompress(i)){ LOG_GENERAL (N_("[%1] J2KEncoder thread pushes frame %2 back onto queue after failure"), thread_id(), i.index()); // handle error } - } - else { + } else { +#else + { +#endif LOG_GENERAL(N_("Encode left-over frame %1"), i.index()); try { _writer.write( @@ -184,8 +197,10 @@ J2KEncoder::end() } } +#ifdef DCPOMATIC_GROK delete _context; _context = nullptr; +#endif } @@ -311,7 +326,11 @@ J2KEncoder::terminate_threads () void +#ifdef DCPOMATIC_GROK J2KEncoder::remake_threads(int cpu, int gpu, list servers) +#else +J2KEncoder::remake_threads(int cpu, int, list servers) +#endif { boost::mutex::scoped_lock lm (_threads_mutex); if (_ending) { @@ -345,7 +364,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list serve remove_threads(cpu, current_cpu_threads, is_cpu_thread); - +#ifdef DCPOMATIC_GROK /* GPU */ auto const is_grok_thread = [](shared_ptr thread) { @@ -361,7 +380,7 @@ J2KEncoder::remake_threads(int cpu, int gpu, list serve } remove_threads(gpu, current_gpu_threads, is_grok_thread); - +#endif /* Remote */ diff --git a/src/lib/j2k_encoder.h b/src/lib/j2k_encoder.h index a6e190dcf..9d9d85894 100644 --- a/src/lib/j2k_encoder.h +++ b/src/lib/j2k_encoder.h @@ -28,11 +28,13 @@ */ -#include "grok/context.h" #include "cross.h" #include "enum_indexed_vector.h" #include "event_history.h" #include "exception_store.h" +#ifdef DCPOMATIC_GROK +#include "grok/context.h" +#endif #include "j2k_encoder_thread.h" #include "writer.h" #include @@ -122,8 +124,10 @@ private: boost::signals2::scoped_connection _server_found_connection; +#ifdef DCPOMATIC_GROK grk_plugin::DcpomaticContext _dcpomatic_context; grk_plugin::GrokContext *_context; +#endif bool _ending = false; }; diff --git a/src/lib/writer.h b/src/lib/writer.h index 1fbf7bbd5..0b38e9030 100644 --- a/src/lib/writer.h +++ b/src/lib/writer.h @@ -34,6 +34,7 @@ #include "exception_store.h" #include "font_id_map.h" #include "player_text.h" +#include "text_type.h" #include "weak_film.h" #include #include diff --git a/src/lib/wscript b/src/lib/wscript index e0cfaa79c..67c6b5869 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -123,7 +123,6 @@ sources = """ font_id_map.cc frame_interval_checker.cc frame_rate_change.cc - grok_j2k_encoder_thread.cc guess_crop.cc hints.cc internet.cc @@ -246,6 +245,9 @@ def build(bld): if bld.env.TARGET_LINUX: obj.uselib += ' POLKIT' + if bld.env.ENABLE_GROK: + obj.source += ' grok_j2k_encoder_thread.cc' + if bld.env.TARGET_WINDOWS_64 or bld.env.TARGET_WINDOWS_32: obj.uselib += ' WINSOCK2 DBGHELP SHLWAPI MSWSOCK BOOST_LOCALE SETUPAPI OLE32 UUID' obj.source += ' cross_windows.cc' diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index af864ad09..db18d1a2f 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -75,7 +75,9 @@ #include "lib/ffmpeg_encoder.h" #include "lib/film.h" #include "lib/font_config.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/hints.h" #include "lib/job_manager.h" #include "lib/kdm_with_metadata.h" @@ -1714,7 +1716,9 @@ private: notes.ShowModal(); } +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif } catch (exception& e) { diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index bf0ea5237..d112f2060 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -31,7 +31,9 @@ #include "lib/config.h" #include "lib/dcpomatic_socket.h" #include "lib/film.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/job.h" #include "lib/job_manager.h" #include "lib/make_dcp.h" @@ -497,7 +499,9 @@ class App : public wxApp } } +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif return true; } diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 528af8858..b7100d62a 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -25,7 +25,9 @@ #include "lib/encoded_log_entry.h" #include "lib/encode_server.h" #include "lib/config.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/log.h" #include "lib/signaller.h" #include "lib/cross.h" @@ -327,7 +329,9 @@ private: SetExitOnFrameDelete (false); +#ifdef DCPOMATIC_GROK grk_plugin::setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif return true; } diff --git a/src/tools/dcpomatic_server_cli.cc b/src/tools/dcpomatic_server_cli.cc index 30f119a5e..9e4a8814f 100644 --- a/src/tools/dcpomatic_server_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -25,7 +25,9 @@ #include "lib/config.h" #include "lib/image.h" #include "lib/file_log.h" +#ifdef DCPOMATIC_GROK #include "lib/grok/context.h" +#endif #include "lib/null_log.h" #include "lib/version.h" #include "lib/encode_server.h" @@ -110,7 +112,9 @@ main (int argc, char* argv[]) dcpomatic_log.reset (new FileLog("dcpomatic_server_cli.log")); } +#ifdef DCPOMATIC_GROK setMessengerLogger(new grk_plugin::GrokLogger("[GROK] ")); +#endif EncodeServer server (verbose, num_threads); diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index 119091af3..bc5b5de4e 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -45,7 +45,9 @@ #include "send_test_email_dialog.h" #include "server_dialog.h" #include "static_text.h" +#ifdef DCPOMATIC_GROK #include "grok/gpu_config_panel.h" +#endif #include "wx_util.h" #include "lib/config.h" #include "lib/cross.h" @@ -1945,7 +1947,9 @@ create_full_config_dialog () e->AddPage (new SoundPage (ps, border)); e->AddPage (new DefaultsPage (ps, border)); e->AddPage (new EncodingServersPage(ps, border)); +#ifdef DCPOMATIC_GROK e->AddPage (new GPUPage (ps, border)); +#endif e->AddPage (new KeysPage (ps, border)); e->AddPage (new TMSPage (ps, border)); e->AddPage (new EmailPage (ps, border)); diff --git a/wscript b/wscript index a6f3617b6..4629fb243 100644 --- a/wscript +++ b/wscript @@ -76,6 +76,7 @@ def options(opt): opt.add_option('--workaround-gssapi', action='store_true', default=False, help='link to gssapi_krb5') opt.add_option('--use-lld', action='store_true', default=False, help='use lld linker') opt.add_option('--enable-disk', action='store_true', default=False, help='build dcpomatic2_disk tool; requires Boost process, lwext4 and nanomsg libraries') + opt.add_option('--enable-grok', action='store_true', default=False, help='build with support for grok J2K encoder') opt.add_option('--warnings-are-errors', action='store_true', default=False, help='build with -Werror') opt.add_option('--wx-config', help='path to wx-config') @@ -96,6 +97,7 @@ def configure(conf): conf.env.DEBUG = conf.options.enable_debug conf.env.STATIC_DCPOMATIC = conf.options.static_dcpomatic conf.env.ENABLE_DISK = conf.options.enable_disk + conf.env.ENABLE_GROK = conf.options.enable_grok if conf.options.destdir == '': conf.env.INSTALL_PREFIX = conf.options.prefix else: @@ -140,6 +142,9 @@ def configure(conf): if conf.options.enable_disk: conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_DISK') + if conf.options.enable_grok: + conf.env.append_value('CXXFLAGS', '-DDCPOMATIC_GROK') + if conf.options.use_lld: try: conf.find_program('ld.lld') -- cgit v1.2.3