Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support CMake 3.10-3.20 #2532

Merged
merged 4 commits into from
May 18, 2021
Merged

Support CMake 3.10-3.20 #2532

merged 4 commits into from
May 18, 2021

Conversation

carstene1ns
Copy link
Member

@carstene1ns carstene1ns commented May 14, 2021

Analogous to EasyRPG/liblcf#422.

This shows a problem btw.: We are currently not compatible to libfmt version 5 (since StringView is in). Solved.

log with 5.2.1
2021-05-14T19:23:08.8410634Z [15/342] Building CXX object CMakeFiles/EasyRPG_Player.dir/src/autobattle.cpp.o
2021-05-14T19:23:08.8412921Z FAILED: CMakeFiles/EasyRPG_Player.dir/src/autobattle.cpp.o 
2021-05-14T19:23:08.8417399Z /usr/bin/c++  -DHAVE_FREETYPE=1 -DHAVE_HARFBUZZ=1 -DHAVE_LIBSNDFILE=1 -DHAVE_LIBSPEEXDSP=1 -DHAVE_MPG123=1 -DHAVE_OGGVORBIS=1 -DHAVE_OPUS=1 -DHAVE_WINE=1 -DSUPPORT_AUDIO=1 -DUSE_SDL=2 -DWANT_FMMIDI=1 -I../src -Ilib/liblcf/src -I../lib/liblcf/src -I../lib/liblcf/src/generated -isystem /usr/include/SDL2 -isystem /usr/include/pixman-1 -isystem /usr/include/freetype2 -isystem /usr/include/harfbuzz -isystem /usr/include/speex -isystem /usr/include/vorbis -isystem /usr/include/opus -O3 -DNDEBUG   -fno-math-errno -std=gnu++14 -MD -MT CMakeFiles/EasyRPG_Player.dir/src/autobattle.cpp.o -MF CMakeFiles/EasyRPG_Player.dir/src/autobattle.cpp.o.d -o CMakeFiles/EasyRPG_Player.dir/src/autobattle.cpp.o -c ../src/autobattle.cpp
2021-05-14T19:23:08.8420466Z In file included from ../src/string_view.h:23,
2021-05-14T19:23:08.8421233Z                  from ../src/utils.h:27,
2021-05-14T19:23:08.8421732Z                  from ../src/game_battler.h:31,
2021-05-14T19:23:08.8422244Z                  from ../src/autobattle.h:23,
2021-05-14T19:23:08.8422778Z                  from ../src/autobattle.cpp:17:
2021-05-14T19:23:08.8425240Z /usr/include/fmt/core.h: In instantiation of 'struct fmt::v5::formatter<nonstd::sv_lite::basic_string_view<char>, char, void>':
2021-05-14T19:23:08.8428170Z /usr/include/fmt/core.h:590:56:   required from 'static void fmt::v5::internal::value<Context>::format_custom_arg(const void*, Context&) [with T = nonstd::sv_lite::basic_string_view<char>; Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>]'
2021-05-14T19:23:08.8430677Z /usr/include/fmt/core.h:576:19:   required from 'fmt::v5::internal::value<Context>::value(const T&) [with T = nonstd::sv_lite::basic_string_view<char>; Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>]'
2021-05-14T19:23:08.8433544Z /usr/include/fmt/core.h:604:58:   required from 'constexpr fmt::v5::internal::init<Context, T, TYPE>::operator fmt::v5::internal::value<Context>() const [with Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>; T = const nonstd::sv_lite::basic_string_view<char>&; fmt::v5::internal::type TYPE = (fmt::v5::internal::type)13]'
2021-05-14T19:23:08.8437440Z /usr/include/fmt/core.h:1056:35:   required from 'typename std::enable_if<IS_PACKED, fmt::v5::internal::value<Context> >::type fmt::v5::internal::make_arg(const T&) [with bool IS_PACKED = true; Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>; T = nonstd::sv_lite::basic_string_view<char>; typename std::enable_if<IS_PACKED, fmt::v5::internal::value<Context> >::type = fmt::v5::internal::value<fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char> >]'
2021-05-14T19:23:08.8441536Z /usr/include/fmt/core.h:1114:51:   required from 'fmt::v5::format_arg_store<Context, Args>::format_arg_store(const Args& ...) [with Context = fmt::v5::basic_format_context<std::back_insert_iterator<fmt::v5::internal::basic_buffer<char> >, char>; Args = {nonstd::sv_lite::basic_string_view<char, std::char_traits<char> >, const char*}]'
2021-05-14T19:23:08.8444734Z /usr/include/fmt/core.h:1444:40:   required from 'std::__cxx11::basic_string<typename fmt::v5::internal::format_string_traits<S>::char_type> fmt::v5::format(const String&, const Args& ...) [with String = char [57]; Args = {nonstd::sv_lite::basic_string_view<char, std::char_traits<char> >, const char*}; typename fmt::v5::internal::format_string_traits<S>::char_type = char]'
2021-05-14T19:23:08.8447127Z ../src/output.h:189:22:   required from 'void Output::Debug(FmtStr&&, Args&& ...) [with FmtStr = const char (&)[57]; Args = {nonstd::sv_lite::basic_string_view<char, std::char_traits<char> >&, const char* const&}]'
2021-05-14T19:23:08.8448167Z ../src/autobattle.cpp:57:101:   required from here
2021-05-14T19:23:08.8449485Z /usr/include/fmt/core.h:349:17: error: static assertion failed: don't know how to format the type, include fmt/ostream.h if it provides an operator<< that should be used
2021-05-14T19:23:08.8450500Z    static_assert(no_formatter_error<T>::value,
2021-05-14T19:23:08.8451448Z                  ^~~~~~~~~~~~~~~~~~~~~
2021-05-14T19:23:09.4088235Z [16/342] Building CXX object CMakeFiles/EasyRPG_Player.dir/src/background.cpp.o
2021-05-14T19:23:10.2208231Z [17/342] Building CXX object CMakeFiles/EasyRPG_Player.dir/src/baseui.cpp.o
2021-05-14T19:23:10.2209041Z ninja: build stopped: subcommand failed.

to check for compilation failures on older cmake/compilers
@carstene1ns carstene1ns added this to the 0.7.0 milestone May 14, 2021
@Ghabry
Copy link
Member

Ghabry commented May 14, 2021

The solution written in the assert (include fmt/ostream.h) works BUT it makes the build ~30% slower.

So as a workaround I suggest the following in src/string_view.h (only pay for the slow build when needed)

#if FMT_VERSION < 60000
#include <fmt/ostream.h>
#endif

@carstene1ns carstene1ns force-pushed the bugfix/old-cmake branch 3 times, most recently from 91fe42e to 2362030 Compare May 15, 2021 23:03
@EasyRPG EasyRPG deleted a comment from Ghabry May 15, 2021
@carstene1ns
Copy link
Member Author

@Ghabry
Copy link
Member

Ghabry commented May 16, 2021

Figured out how to make Player compatible with fmtlib 4.x:

https://gist.github.com/Ghabry/ce6583102dcf9706495509ea73e7de53

Note that the "configure.ac" part is incomplete. This will only work when you #include config.h like in system.h. Was not sure if this causes any problems so I left this out and you can decide if you want support for fmt 4.x with autotools or not.

@carstene1ns
Copy link
Member Author

I think we should apply the 4.x patch only for release builds in obs-config repository.

@Ghabry Ghabry merged commit db193cc into EasyRPG:master May 18, 2021
@carstene1ns carstene1ns deleted the bugfix/old-cmake branch May 18, 2021 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants