diff --git a/Rakefile b/Rakefile index abb956faa..0c48d7751 100644 --- a/Rakefile +++ b/Rakefile @@ -347,6 +347,13 @@ cxx_compiler = lambda do |*args| flags.gsub!(%r{-Wpedantic}, '') end + if %r{src/common/iso639_language_list.cpp}.match(source) + # Even -O1 causes compilation time & memory usage to skyrocket, + # possibly exponentially, with the number of entries to + # emplace_back() into the vector. + flags.gsub!(%r{ -O\d+ }, ' -O0 ') + end + args = [ "cxx", source, "#{c(:CXX)} #{flags}#{pchu}#{pchx} #{$system_includes} -c -MMD -MF #{dep} -o #{t.name} -x #{lang} #{source}", diff --git a/rake.d/iso639.rb b/rake.d/iso639.rb index cb037d0a7..96d5ba182 100644 --- a/rake.d/iso639.rb +++ b/rake.d/iso639.rb @@ -39,9 +39,9 @@ def create_iso639_language_list_file // NOTE: this file is auto-generated by the "dev:iso639_list" rake target. // ----------------------------------------------------------------------- -#include "common/common_pch.h" +#include "common/iso639_types.h" -#include "common/iso639.h" +using namespace std::string_literals; namespace mtx::iso639 { diff --git a/rake.d/pch.rb b/rake.d/pch.rb index c1655f05b..6b2af5102 100644 --- a/rake.d/pch.rb +++ b/rake.d/pch.rb @@ -403,7 +403,7 @@ PCH status: <%= c?(:USE_PRECOMPILED_HEADERS) ? "enabled" : "disabled" %> def self.info_for_user(user, ofile) f = Info.new - if c?(:USE_PRECOMPILED_HEADERS) + if c?(:USE_PRECOMPILED_HEADERS) && !%r{src/common/iso639_language_list.cpp}.match(user) user = Pathname.new(user).cleanpath.to_s f.language = "c++-header" if user.end_with?(".h") header = @db_scan.fetch(user, nil) diff --git a/src/common/iso639.h b/src/common/iso639.h index 6cb673454..7d35acd1c 100644 --- a/src/common/iso639.h +++ b/src/common/iso639.h @@ -15,24 +15,10 @@ #include "common/common_pch.h" +#include "common/iso639_types.h" + namespace mtx::iso639 { -struct language_t { - std::string const english_name, alpha_3_code, alpha_2_code, terminology_abbrev; - bool is_part_of_iso639_2{}; - - language_t(std::string &&p_english_name, std::string &&p_alpha_3_code, std::string &&p_alpha_2_code, std::string &&p_terminology_abbrev, bool p_is_part_of_iso639_2) - : english_name{std::move(p_english_name)} - , alpha_3_code{std::move(p_alpha_3_code)} - , alpha_2_code{std::move(p_alpha_2_code)} - , terminology_abbrev{std::move(p_terminology_abbrev)} - , is_part_of_iso639_2{p_is_part_of_iso639_2} - { - } -}; - -extern std::vector g_languages; - void init(); std::optional look_up(std::string const &s, bool allow_short_english_names = false); void list_languages(); diff --git a/src/common/iso639_language_list.cpp b/src/common/iso639_language_list.cpp index a43a92342..4fd84099b 100644 --- a/src/common/iso639_language_list.cpp +++ b/src/common/iso639_language_list.cpp @@ -15,9 +15,9 @@ // NOTE: this file is auto-generated by the "dev:iso639_list" rake target. // ----------------------------------------------------------------------- -#include "common/common_pch.h" +#include "common/iso639_types.h" -#include "common/iso639.h" +using namespace std::string_literals; namespace mtx::iso639 { diff --git a/src/common/iso639_types.h b/src/common/iso639_types.h new file mode 100644 index 000000000..2e1de5a6b --- /dev/null +++ b/src/common/iso639_types.h @@ -0,0 +1,37 @@ +/* + mkvmerge -- utility for splicing together matroska files + from component media subtypes + + Distributed under the GPL v2 + see the file COPYING for details + or visit https://www.gnu.org/licenses/old-licenses/gpl-2.0.html + + ISO 639 types + + Written by Moritz Bunkus . +*/ + +#pragma once + +#include +#include + +namespace mtx::iso639 { + +struct language_t { + std::string const english_name, alpha_3_code, alpha_2_code, terminology_abbrev; + bool is_part_of_iso639_2{}; + + language_t(std::string &&p_english_name, std::string &&p_alpha_3_code, std::string &&p_alpha_2_code, std::string &&p_terminology_abbrev, bool p_is_part_of_iso639_2) + : english_name{std::move(p_english_name)} + , alpha_3_code{std::move(p_alpha_3_code)} + , alpha_2_code{std::move(p_alpha_2_code)} + , terminology_abbrev{std::move(p_terminology_abbrev)} + , is_part_of_iso639_2{p_is_part_of_iso639_2} + { + } +}; + +extern std::vector g_languages; + +} // namespace mtx::iso639