@@ -24,24 +24,53 @@ cmake_dependent_option(LIBUV_BUILD_BENCH
24
24
"Build the benchmarks when building unit tests and we are the root project" ON
25
25
"LIBUV_BUILD_TESTS" OFF )
26
26
27
+ # Qemu Build
28
+ option (QEMU "build for qemu" OFF )
29
+ if (QEMU)
30
+ add_definitions (-D__QEMU__=1)
31
+ endif ()
32
+
27
33
# Compiler check
28
34
string (CONCAT is-msvc $<OR :
29
35
$<C_COMPILER_ID:MSVC >,
30
36
$<STREQUAL :${CMAKE_C_COMPILER_FRONTEND_VARIANT} ,MSVC >
31
37
>)
32
38
33
39
check_c_compiler_flag(/W4 UV_LINT_W4)
40
+ check_c_compiler_flag(/wd4100 UV_LINT_NO_UNUSED_PARAMETER_MSVC)
41
+ check_c_compiler_flag(/wd4127 UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC)
42
+ check_c_compiler_flag(/wd4201 UV_LINT_NO_NONSTANDARD_MSVC)
43
+ check_c_compiler_flag(/wd4206 UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC)
44
+ check_c_compiler_flag(/wd4210 UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC)
45
+ check_c_compiler_flag(/wd4232 UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC)
46
+ check_c_compiler_flag(/wd4456 UV_LINT_NO_HIDES_LOCAL)
47
+ check_c_compiler_flag(/wd4457 UV_LINT_NO_HIDES_PARAM)
48
+ check_c_compiler_flag(/wd4459 UV_LINT_NO_HIDES_GLOBAL)
49
+ check_c_compiler_flag(/wd4706 UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC)
50
+ check_c_compiler_flag(/wd4996 UV_LINT_NO_UNSAFE_MSVC)
51
+
34
52
check_c_compiler_flag(-Wall UV_LINT_WALL) # DO NOT use this under MSVC
35
53
36
54
# TODO: Place these into its own function
37
55
check_c_compiler_flag(-Wno-unused-parameter UV_LINT_NO_UNUSED_PARAMETER)
38
56
check_c_compiler_flag(-Wstrict-prototypes UV_LINT_STRICT_PROTOTYPES)
39
57
check_c_compiler_flag(-Wextra UV_LINT_EXTRA)
40
58
41
- set (lint-no -unused-parameter $<$<BOOL :${UV_LINT_NO_UNUSED_PARAMETER} >:-Wno-unused-parameter>)
59
+ set (lint-no -unused-parameter $<$<BOOL :${UV_LINT_NO_UNUSED_PARAMETER} >:-Wno-unused-parameter>)
42
60
set (lint-strict-prototypes $<$<BOOL :${UV_LINT_STRICT_PROTOTYPES} >:-Wstrict-prototypes>)
43
61
set (lint-extra $<$<BOOL :${UV_LINT_EXTRA} >:-Wextra>)
44
62
set (lint-w4 $<$<BOOL :${UV_LINT_W4} >:/W4>)
63
+ set (lint-no -unused-parameter-msvc $<$<BOOL :${UV_LINT_NO_UNUSED_PARAMETER_MSVC} >:/wd4100>)
64
+ set (lint-no -conditional-constant-msvc $<$<BOOL :${UV_LINT_NO_CONDITIONAL_CONSTANT_MSVC} >:/wd4127>)
65
+ set (lint-no -nonstandard-msvc $<$<BOOL :${UV_LINT_NO_NONSTANDARD_MSVC} >:/wd4201>)
66
+ set (lint-no -nonstandard-empty-tu-msvc $<$<BOOL :${UV_LINT_NO_NONSTANDARD_EMPTY_TU_MSVC} >:/wd4206>)
67
+ set (lint-no -nonstandard-file-scope-msvc $<$<BOOL :${UV_LINT_NO_NONSTANDARD_FILE_SCOPE_MSVC} >:/wd4210>)
68
+ set (lint-no -nonstandard-nonstatic-dlimport-msvc $<$<BOOL :${UV_LINT_NO_NONSTANDARD_NONSTATIC_DLIMPORT_MSVC} >:/wd4232>)
69
+ set (lint-no -hides-local-msvc $<$<BOOL :${UV_LINT_NO_HIDES_LOCAL} >:/wd4456>)
70
+ set (lint-no -hides-param-msvc $<$<BOOL :${UV_LINT_NO_HIDES_PARAM} >:/wd4457>)
71
+ set (lint-no -hides-global -msvc $<$<BOOL :${UV_LINT_NO_HIDES_GLOBAL} >:/wd4459>)
72
+ set (lint-no -conditional-assignment-msvc $<$<BOOL :${UV_LINT_NO_CONDITIONAL_ASSIGNMENT_MSVC} >:/wd4706>)
73
+ set (lint-no -unsafe-msvc $<$<BOOL :${UV_LINT_NO_UNSAFE_MSVC} >:/wd4996>)
45
74
# Unfortunately, this one is complicated because MSVC and clang-cl support -Wall
46
75
# but using it is like calling -Weverything
47
76
string (CONCAT lint-default $<
@@ -50,6 +79,17 @@ string(CONCAT lint-default $<
50
79
51
80
list (APPEND uv_cflags ${lint-strict-prototypes} ${lint-extra} ${lint-default} ${lint-w4})
52
81
list (APPEND uv_cflags ${lint-no -unused-parameter})
82
+ list (APPEND uv_cflags ${lint-no -unused-parameter-msvc })
83
+ list (APPEND uv_cflags ${lint-no -conditional-constant-msvc })
84
+ list (APPEND uv_cflags ${lint-no -nonstandard-msvc })
85
+ list (APPEND uv_cflags ${lint-no -nonstandard-empty-tu-msvc })
86
+ list (APPEND uv_cflags ${lint-no -nonstandard-file-scope-msvc })
87
+ list (APPEND uv_cflags ${lint-no -nonstandard-nonstatic-dlimport-msvc })
88
+ list (APPEND uv_cflags ${lint-no -hides-local-msvc })
89
+ list (APPEND uv_cflags ${lint-no -hides-param-msvc })
90
+ list (APPEND uv_cflags ${lint-no -hides-global -msvc })
91
+ list (APPEND uv_cflags ${lint-no -conditional-assignment-msvc })
92
+ list (APPEND uv_cflags ${lint-no -unsafe-msvc })
53
93
54
94
set (uv_sources
55
95
src/fs-poll.c
@@ -64,22 +104,9 @@ set(uv_sources
64
104
src/version .c)
65
105
66
106
if (WIN32 )
67
- if (CMAKE_SYSTEM_VERSION VERSION_GREATER 10) # Windows 10
68
- set (windows-version 0x0A00)
69
- elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.3) # Windows 8.1
70
- set (windows-version 0x0603)
71
- elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.2) # Windows 8
72
- set (windows-version 0x0602)
73
- elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.1) # Windows 7
74
- set (windows-version 0x0601)
75
- elseif (CMAKE_SYSTEM_VERSION VERSION_GREATER 6.0) # Windows Vista
76
- set (windows-version 0x0600)
77
- else ()
78
- message (FATAL_ERROR "Windows Vista is the minimum version supported" )
79
- endif ()
80
- list (APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=${windows-version })
107
+ list (APPEND uv_defines WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0600)
81
108
list (APPEND uv_libraries
82
- $<$< STREQUAL :${windows- version },0x0600>: psapi>
109
+ psapi
83
110
iphlpapi
84
111
userenv
85
112
ws2_32)
@@ -155,7 +182,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
155
182
endif ()
156
183
157
184
if (CMAKE_SYSTEM_NAME STREQUAL "Android" )
158
- list (APPEND uv_libs dl)
185
+ list (APPEND uv_libraries dl)
159
186
list (APPEND uv_sources
160
187
src/unix /android-ifaddrs.c
161
188
src/unix /linux-core.c
@@ -489,7 +516,7 @@ if(LIBUV_BUILD_TESTS)
489
516
test /test -walk-handles.c
490
517
test /test -watcher-cross-stop.c)
491
518
492
- add_executable (uv_run_tests ${uv_test_sources} )
519
+ add_executable (uv_run_tests ${uv_test_sources} uv_win_longpath.manifest )
493
520
target_compile_definitions (uv_run_tests
494
521
PRIVATE ${uv_defines} USING_UV_SHARED=1)
495
522
target_compile_options (uv_run_tests PRIVATE ${uv_cflags} )
@@ -501,10 +528,14 @@ if(LIBUV_BUILD_TESTS)
501
528
set_tests_properties (uv_test PROPERTIES ENVIRONMENT
502
529
"LIBPATH=${CMAKE_BINARY_DIR} :$ENV{LIBPATH} " )
503
530
endif ()
504
- add_executable (uv_run_tests_a ${uv_test_sources} )
531
+ add_executable (uv_run_tests_a ${uv_test_sources} uv_win_longpath.manifest )
505
532
target_compile_definitions (uv_run_tests_a PRIVATE ${uv_defines} )
506
533
target_compile_options (uv_run_tests_a PRIVATE ${uv_cflags} )
507
- target_link_libraries (uv_run_tests_a uv_a ${uv_test_libraries} )
534
+ if (QEMU)
535
+ target_link_libraries (uv_run_tests_a uv_a ${uv_test_libraries} -static )
536
+ else ()
537
+ target_link_libraries (uv_run_tests_a uv_a ${uv_test_libraries} )
538
+ endif ()
508
539
add_test (NAME uv_test_a
509
540
COMMAND uv_run_tests_a
510
541
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
@@ -544,3 +575,11 @@ if(WIN32)
544
575
RUNTIME DESTINATION lib/$<CONFIG>
545
576
ARCHIVE DESTINATION lib/$<CONFIG>)
546
577
endif ()
578
+
579
+ message (STATUS "summary of build options:
580
+ Install prefix: ${CMAKE_INSTALL_PREFIX}
581
+ Target system: ${CMAKE_SYSTEM_NAME}
582
+ Compiler:
583
+ C compiler: ${CMAKE_C_COMPILER}
584
+ CFLAGS: ${CMAKE_C_FLAGS_${_build_type} } ${CMAKE_C_FLAGS}
585
+ " )
0 commit comments