diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index d3c8d31e5f..09d77dcf3b 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -78,7 +78,7 @@ jobs: - name: Build all run: docker exec kphp-build-container-${{matrix.os}} bash -c - "cmake -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" + "cmake -DDOWNLOAD_MISSING_LIBRARIES=On -DCMAKE_CXX_COMPILER=${{matrix.compiler}} -DCMAKE_CXX_STANDARD=${{matrix.cpp}} -DADDRESS_SANITIZER=${{matrix.asan}} -DUNDEFINED_SANITIZER=${{matrix.ubsan}} -DPDO_DRIVER_MYSQL=ON -DPDO_DRIVER_PGSQL=ON -DPDO_LIBS_STATIC_LINKING=ON -S ${{env.kphp_root_dir}} -B ${{env.kphp_build_dir}} && make -C ${{env.kphp_build_dir}} -j$(nproc) all" - name: Run unit tests run: docker exec kphp-build-container-${{matrix.os}} bash -c diff --git a/.github/workflows/Dockerfile.buster b/.github/workflows/Dockerfile.buster index 908dbaed10..abd82a6d6b 100644 --- a/.github/workflows/Dockerfile.buster +++ b/.github/workflows/Dockerfile.buster @@ -22,7 +22,7 @@ RUN apt-get update && \ git cmake-data=3.18* cmake=3.18* make g++ gperf netcat \ python3.7 python3-dev libpython3-dev python3-pip python3-setuptools mysql-server libmysqlclient-dev && \ pip3 install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ postgresql postgresql-server-dev-all libnuma-dev composer && \ rm -rf /var/lib/apt/lists/* && \ diff --git a/.github/workflows/Dockerfile.focal b/.github/workflows/Dockerfile.focal index 255e51a82d..3b07233927 100644 --- a/.github/workflows/Dockerfile.focal +++ b/.github/workflows/Dockerfile.focal @@ -15,7 +15,7 @@ RUN apt-get update && \ git cmake make clang g++ g++-10 gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ - apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt-get install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libldap-dev libkrb5-dev \ postgresql postgresql-server-dev-all libnuma-dev composer unzip && \ rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/Dockerfile.jammy b/.github/workflows/Dockerfile.jammy index 1dd63369c2..d73aa8ce11 100644 --- a/.github/workflows/Dockerfile.jammy +++ b/.github/workflows/Dockerfile.jammy @@ -17,7 +17,7 @@ RUN apt update && \ git cmake make g++ lld gperf netcat \ python3.7 python3-pip python3.7-distutils python3.7-dev libpython3.7-dev python3-jsonschema python3-setuptools mysql-server libmysqlclient-dev && \ python3.7 -m pip install pip && python3.7 -m pip install -r /tmp/requirements.txt && \ - apt install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libfmt-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ + apt install -y --no-install-recommends curl-kphp-vk kphp-timelib libuber-h3-dev libgtest-dev libgmock-dev libre2-dev libpcre3-dev \ libzstd-dev libyaml-cpp-dev libnghttp2-dev zlib1g-dev php7.4-dev libnuma-dev unzip \ libldap-dev libkrb5-dev postgresql postgresql-server-dev-all && \ rm -rf /var/lib/apt/lists/* diff --git a/cmake/external-libraries.cmake b/cmake/external-libraries.cmake index f88954a907..74704f1e00 100644 --- a/cmake/external-libraries.cmake +++ b/cmake/external-libraries.cmake @@ -9,18 +9,6 @@ function(handle_missing_library LIB_NAME) endif() endfunction() -find_package(fmt QUIET) -if(NOT fmt_FOUND) - handle_missing_library("fmtlib") - FetchContent_Declare( - fmt - GIT_REPOSITORY https://github.com/fmtlib/fmt - GIT_TAG 7.0.3 - ) - FetchContent_MakeAvailable(fmt) - include_directories(${fmt_SOURCE_DIR}/include) - message(STATUS "---------------------") -endif() if(KPHP_TESTS) find_package(GTest QUIET) diff --git a/cmake/init-compilation-flags.cmake b/cmake/init-compilation-flags.cmake index a9c8cf6fe4..b841bdd2c9 100644 --- a/cmake/init-compilation-flags.cmake +++ b/cmake/init-compilation-flags.cmake @@ -86,7 +86,7 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") add_compile_options(-march=armv8.2-a+crypto) endif() -add_compile_options(-Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare +add_compile_options(-std=c++2b -fexperimental-library -stdlib=libc++ -Werror -Wall -Wextra -Wunused-function -Wfloat-conversion -Wno-sign-compare -Wuninitialized -Wno-redundant-move -Wno-missing-field-initializers) if(NOT APPLE) diff --git a/common/wrappers/fmt_format.h b/common/wrappers/fmt_format.h index 523b1fb0e3..c36646806b 100644 --- a/common/wrappers/fmt_format.h +++ b/common/wrappers/fmt_format.h @@ -5,45 +5,11 @@ #ifndef COMMON_WRAPPERS_FMT_FORMAT_H #define COMMON_WRAPPERS_FMT_FORMAT_H -#include - -#if __cplusplus <= 201703 || FMT_VERSION < 70000 -# undef FAST_COMPILATION_FMT -#endif - -#ifndef FAST_COMPILATION_FMT -# include -#endif - #include "common/wrappers/string_view.h" -#ifdef FMT_STRING -# define fmt_format(format_s, args...) fmt::format(FMT_STRING(format_s), ##args) -# define fmt_print(format_s, args...) fmt::print(FMT_STRING(format_s), ##args) -# if FMT_VERSION < 60000 -# define fmt_fprintf(file, format_s, args...) fmt::print(file, "{}", fmt_format(format_s, ##args)) -# define fmt_format_to(iter, format_s, args...) fmt::format_to(iter, "{}", fmt_format(format_s, ##args)) -# else -# define fmt_fprintf(file, format_s, args...) fmt::print(file, FMT_STRING(format_s), ##args) -# define fmt_format_to(iter, format_s, args...) fmt::format_to(iter, FMT_STRING(format_s), ##args) -# endif -#else -# define fmt_format(format_s, args...) fmt::format(format_s, ##args) -# define fmt_print(format_s, args...) fmt::print(format_s, ##args) -# define fmt_fprintf(file, format_s, args...) fmt::print(file, format_s, ##args) -# define fmt_format_to(out_iter, format_s, args...) fmt::format_to(out_iter, format_s, ##args) -#endif - -#ifndef FAST_COMPILATION_FMT -namespace fmt { -template<> -struct formatter : fmt::formatter { - template - auto format(vk::string_view a, FormatCtx &ctx) { - return fmt::formatter::format(fmt::string_view{a.data(), a.size()}, ctx); - } -}; -} // namespace fmt -#endif +# define fmt_format(format_s, args...) std::format(format_s, ##args) +# define fmt_print(format_s, args...) std::print(format_s, ##args) +# define fmt_fprintf(file, format_s, args...) std::print(file, format_s, ##args) +# define fmt_format_to(out_iter, format_s, args...) std::format_to(out_iter, format_s, ##args) #endif // COMMON_WRAPPERS_FMT_FORMAT_H diff --git a/compiler/compiler-settings.cpp b/compiler/compiler-settings.cpp index 67560eeca1..192b4a293a 100644 --- a/compiler/compiler-settings.cpp +++ b/compiler/compiler-settings.cpp @@ -274,6 +274,7 @@ void CompilerSettings::init() { << " -iquote " << kphp_src_path.get() << "objs/generated/auto/runtime" << " -fwrapv -Wno-parentheses -Wno-trigraphs" + << "-std=c++2b -fexperimental-library -stdlib=libc++" << " -fno-strict-aliasing -fno-omit-frame-pointer"; #ifdef __x86_64__ ss << " -march=sandybridge"; @@ -289,13 +290,6 @@ void CompilerSettings::init() { if (vk::contains(cxx.get(), "clang")) { ss << " -Wno-invalid-source-encoding"; } - #if __cplusplus <= 201703L - ss << " -std=c++17"; - #elif __cplusplus <= 202002L - ss << " -std=c++20"; - #else - #error unsupported __cplusplus value - #endif std::string cxx_default_flags = ss.str(); diff --git a/compiler/compiler.cmake b/compiler/compiler.cmake index 6ae6aadadf..0ae42e7dbb 100644 --- a/compiler/compiler.cmake +++ b/compiler/compiler.cmake @@ -265,7 +265,7 @@ add_executable(kphp2cpp ${KPHP_COMPILER_DIR}/kphp2cpp.cpp) target_include_directories(kphp2cpp PUBLIC ${KPHP_COMPILER_DIR}) prepare_cross_platform_libs(COMPILER_LIBS yaml-cpp re2) -set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} fmt::fmt OpenSSL::Crypto pthread) +set(COMPILER_LIBS vk::kphp2cpp_src vk::tlo_parsing_src vk::popular_common ${COMPILER_LIBS} OpenSSL::Crypto pthread) if(NOT APPLE) list(APPEND COMPILER_LIBS stdc++fs) endif() diff --git a/test.cpp b/test.cpp new file mode 100644 index 0000000000..74452fb087 --- /dev/null +++ b/test.cpp @@ -0,0 +1,6 @@ +#include +#include +#include +int main() { + std::format_to(std::ostreambuf_iterator(std::cout), "Hello!\n"); +}