-
Notifications
You must be signed in to change notification settings - Fork 288
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
Preliminary CMake configure support on Windows (#228) #666
base: develop
Are you sure you want to change the base?
Preliminary CMake configure support on Windows (#228) #666
Conversation
They are also may be packaged inside "{includedir}/libev/".
It's not supported, so use the usual Boost.
It's no use for the WIN32.
Instead of GCC/Clang-like -Wall -Wextra -pedantic. MSVC's /WAll produces a lot of noise, so even MS STL authors had not used it. The /sdl flag adds some static analysis checks. See https://learn.microsoft.com/en-us/cpp/build/reference/sdl-enable-additional-security-checks?view=msvc-170 for details.
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/ |
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just find stacktrace_windbg
in OPTIONAL_COMPONENTS
target_compile_options(userver-internal-compile-options INTERFACE | ||
"-Wall" "-Wextra" "-Wpedantic" | ||
) | ||
if (MSVC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please no MSVC for now, Clang on Windows is enough :)
We are not ready for MSVC's bugs and lack of certain intrinsics
@@ -206,7 +206,7 @@ _userver_directory_install(COMPONENT core | |||
) | |||
|
|||
target_include_directories(${PROJECT_NAME} SYSTEM BEFORE PUBLIC | |||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libc_include_fixes> | |||
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/libc_include_fixes>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably NOT WIN32
?
@@ -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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use either CMAKE_SYSTEM_NAME MATCHES "Windows"
or WIN32
consistently
find_program(venv_python | ||
NAMES python python3 | ||
PATHS "${venv_dir}/bin" "${venv_dir}/Scripts" | ||
REQUIRED NO_DEFAULT_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We currently support cmake 3.14+, but REQUIRED
appeared in cmake 3.18
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd use NO_CACHE
, but it appeared in 3.21
It's easier to check WIN32
and either use bin
or Scripts
based on that
Always using either python
or python3
is OK as long as both are present on Windows, choose something that works
The first step on proper compilation on Windows: the CMake configuring.
Some notes and restrictions of this PR:
vcpkg search <depname>
" and "vcpkg install <depname>
");-DUSERVER_FEATURE_TESTSUITE=OFF
;userver_target_cxx_compile_options_if_supported()
";-DUSERVER_FEATURE_UBOOST_CORO=OFF
.Related to #228.
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/