Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile.buster
Original file line number Diff line number Diff line change
Expand Up @@ -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/* && \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile.focal
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile.jammy
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
Expand Down
12 changes: 0 additions & 12 deletions cmake/external-libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/init-compilation-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
42 changes: 4 additions & 38 deletions common/wrappers/fmt_format.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,11 @@
#ifndef COMMON_WRAPPERS_FMT_FORMAT_H
#define COMMON_WRAPPERS_FMT_FORMAT_H

#include <fmt/core.h>

#if __cplusplus <= 201703 || FMT_VERSION < 70000
# undef FAST_COMPILATION_FMT
#endif

#ifndef FAST_COMPILATION_FMT
# include <fmt/format.h>
#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<vk::string_view> : fmt::formatter<fmt::string_view> {
template<typename FormatCtx>
auto format(vk::string_view a, FormatCtx &ctx) {
return fmt::formatter<fmt::string_view>::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
8 changes: 1 addition & 7 deletions compiler/compiler-settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion compiler/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 6 additions & 0 deletions test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include <format>
#include <iostream>
#include <iterator>
int main() {
std::format_to(std::ostreambuf_iterator<char>(std::cout), "Hello!\n");
}