diff --git a/cmake/SetupGBench.cmake b/cmake/SetupGBench.cmake index 8fb0ba657d48..3254388f07f6 100644 --- a/cmake/SetupGBench.cmake +++ b/cmake/SetupGBench.cmake @@ -32,7 +32,8 @@ CPMAddPackage( "BENCHMARK_ENABLE_GTEST_TESTS OFF" ) -target_compile_options(benchmark PRIVATE "-Wno-format-nonliteral") +include(UserverCxxCompileOptionsIfSupported) +userver_target_cxx_compile_options_if_supported(benchmark PRIVATE "-Wno-format-nonliteral") if (NOT TARGET benchmark::benchmark) add_library(benchmark::benchmark ALIAS benchmark) # Unify link names endif() diff --git a/cmake/Stacktrace.cmake b/cmake/Stacktrace.cmake index f8e6b165bde8..fa435de845f8 100644 --- a/cmake/Stacktrace.cmake +++ b/cmake/Stacktrace.cmake @@ -19,7 +19,9 @@ function(_make_stacktrace_target TARGET Boost_VERSION_STRING) endif() add_library(userver-stacktrace INTERFACE) - if(USERVER_FEATURE_STACKTRACE) + if(WIN32) + target_link_libraries("${TARGET}" INTERFACE Boost::stacktrace_windbg) + elseif(USERVER_FEATURE_STACKTRACE) target_link_libraries("${TARGET}" INTERFACE Boost::stacktrace_backtrace backtrace dl) else() target_link_libraries("${TARGET}" INTERFACE Boost::stacktrace_basic dl) diff --git a/cmake/UserverRequireDWCAS.cmake b/cmake/UserverRequireDWCAS.cmake index 2652f103edf4..6ece9dafe62c 100644 --- a/cmake/UserverRequireDWCAS.cmake +++ b/cmake/UserverRequireDWCAS.cmake @@ -84,7 +84,7 @@ function (userver_target_require_dwcas target visibility) return() endif() - if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT CMAKE_SYSTEM MATCHES "BSD") + if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT CMAKE_SYSTEM MATCHES "BSD" AND NOT WIN32) list(APPEND TEST_LIBRARIES "atomic") endif() diff --git a/cmake/UserverVenv.cmake b/cmake/UserverVenv.cmake index 34b83fc3cfe7..539440b6d717 100644 --- a/cmake/UserverVenv.cmake +++ b/cmake/UserverVenv.cmake @@ -95,7 +95,12 @@ function(userver_venv_setup) set(venv_dir "${parent_directory}/${venv_name}") set(venv_bin_dir "${venv_dir}/bin") - set("${python_output_var}" "${venv_bin_dir}/python" PARENT_SCOPE) + find_program(venv_python + NAMES python python3 + PATHS "${venv_dir}/bin" "${venv_dir}/Scripts" + REQUIRED NO_DEFAULT_PATH + ) + set("${python_output_var}" "${venv_python}" PARENT_SCOPE) # A unique venv is set up once for the whole build. # For example, a userver gRPC cmake script may be included multiple times @@ -164,7 +169,7 @@ function(userver_venv_setup) ) execute_process( COMMAND - "${venv_bin_dir}/python3" -m pip install + "${venv_python}" -m pip install --disable-pip-version-check -U ${pip_requirements} ${ARG_PIP_ARGS} diff --git a/cmake/modules/FindLibEv.cmake b/cmake/modules/FindLibEv.cmake index e25cbf40b3e0..8d20f244461a 100644 --- a/cmake/modules/FindLibEv.cmake +++ b/cmake/modules/FindLibEv.cmake @@ -7,7 +7,7 @@ _userver_module_begin( ) _userver_module_find_include( - NAMES ev.h + NAMES ev.h libev/ev.h ) _userver_module_find_library( diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index cab10587f941..94aa69693324 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -120,7 +120,7 @@ add_subdirectory(${USERVER_THIRD_PARTY_DIRS}/http-parser http-parser) target_link_libraries(${PROJECT_NAME} PRIVATE userver-http-parser userver-llhttp) set(USERVER_UBOOST_CORO_DEFAULT ON) -if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") +if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" OR CMAKE_SYSTEM_NAME MATCHES "Windows") # Use system Boost.Context and Boost.Coroutine2 with latest patches # for arm64, otherwise userver will crash at startup. # @@ -206,7 +206,7 @@ _userver_directory_install(COMPONENT core ) target_include_directories(${PROJECT_NAME} SYSTEM BEFORE PUBLIC - $ + $<$>:$> ) # The bug is only triggered with optimizations enabled -- TAXICOMMON-1729 diff --git a/universal/CMakeLists.txt b/universal/CMakeLists.txt index 5b6fbbe35dc7..e140232a8e66 100644 --- a/universal/CMakeLists.txt +++ b/universal/CMakeLists.txt @@ -32,12 +32,18 @@ list(REMOVE_ITEM SOURCES ${UNIT_TEST_SOURCES} ${BENCH_SOURCES} ${INTERNAL_SOURCE set(CMAKE_THREAD_PREFER_PTHREAD ON) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) +if (WIN32) + set(userver_boost_stacktrace_component stacktrace_windbg) +else() + set(userver_boost_stacktrace_component stacktrace_basic) +endif() + find_package(Boost REQUIRED COMPONENTS program_options filesystem regex - stacktrace_basic + ${userver_boost_stacktrace_component} OPTIONAL_COMPONENTS stacktrace_backtrace ) @@ -78,9 +84,15 @@ endif() add_library(userver-internal-compile-options INTERFACE) userver_target_require_dwcas(userver-internal-compile-options INTERFACE) target_compile_features(userver-internal-compile-options INTERFACE cxx_std_17) -target_compile_options(userver-internal-compile-options INTERFACE - "-Wall" "-Wextra" "-Wpedantic" -) +if (MSVC) + target_compile_options(userver-internal-compile-options INTERFACE + "/W4" "/sdl" + ) +else() + target_compile_options(userver-internal-compile-options INTERFACE + "-Wall" "-Wextra" "-Wpedantic" + ) +endif() include(UserverCxxCompileOptionsIfSupported) userver_target_cxx_compile_options_if_supported(userver-internal-compile-options INTERFACE