-
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?
Changes from all commits
c5ea832
9093f34
283a769
6ef3a75
59308f2
9ac1e74
146b759
3b857ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We currently support cmake 3.14+, but |
||
) | ||
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} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Use either |
||
# 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 | ||
$<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 commentThe reason will be displayed to describe this comment to others. Learn more. Probably |
||
) | ||
|
||
# The bug is only triggered with optimizations enabled -- TAXICOMMON-1729 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Just find |
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please no MSVC for now, Clang on Windows is enough :) |
||
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 | ||
|
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.21It's easier to check
WIN32
and either usebin
orScripts
based on thatAlways using either
python
orpython3
is OK as long as both are present on Windows, choose something that works