xref: /reactos/sdk/lib/ucrt/CMakeLists.txt (revision b09b5584)
1
2set(CMAKE_CXX_STANDARD 17)
3
4# Replace the old CRT include directory with the UCRT include directory
5get_property(INCLUDE_DIRS DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
6list(REMOVE_ITEM INCLUDE_DIRS "${REACTOS_SOURCE_DIR}/sdk/include/crt")
7set_property(DIRECTORY . PROPERTY INCLUDE_DIRECTORIES ${INCLUDE_DIRS})
8include_directories(${REACTOS_SOURCE_DIR}/sdk/include/ucrt)
9
10if(MSVC)
11    # Disable warning C4083: expected ')'; found identifier '<warning identifier>'
12    add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4083>)
13
14    # Disable warning C4189: 'cvt': local variable is initialized but not referenced
15    add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4189>)
16endif()
17
18# Internal includes
19include_directories(BEFORE inc)
20
21if(${ARCH} STREQUAL "i386")
22    include_directories(inc/i386)
23endif()
24
25remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
26add_compile_definitions(
27    WINVER=0x600
28    _WIN32_WINNT=0x600
29    _UCRT
30    _CORECRT_BUILD
31    _CRT_DECLARE_GLOBAL_VARIABLES_DIRECTLY
32    _GCC_NO_SAL_ATTRIIBUTES
33    CRTDLL
34)
35
36if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
37   CMAKE_C_COMPILER_ID STREQUAL "Clang")
38    # Silence GCC/Clang warnings
39    add_compile_options(
40        -Wno-unknown-warning-option
41        -Wno-unused-function
42        -Wno-unknown-pragmas
43        -Wno-builtin-declaration-mismatch
44        -Wno-parentheses
45        -Wno-unused-variable
46        -Wno-sign-compare
47        -Wno-enum-compare
48        -Wno-switch
49        -Wno-write-strings
50        -Wno-comment
51        -Wno-narrowing
52        -Wno-misleading-indentation
53        -Wno-missing-braces
54        -Wno-unused-value
55        -Wno-unused-local-typedef
56        -Wno-unused-function
57        -Wno-writable-strings
58        -Wno-microsoft-template
59        -Wno-switch
60        -Wno-ignored-pragmas
61        -Wno-empty-body
62        -Wno-tautological-constant-out-of-range-compare
63        -Wno-ignored-attributes
64        -Wno-uninitialized
65    )
66    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Wno-reorder>)
67endif()
68
69if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
70    add_compile_definitions(
71        _lrotl=___lrotl
72        _rotl=___rotl
73        _rotl64=___rotl64
74        _lrotr=___lrotr
75        _rotr=___rotr
76        _rotr64=___rotr64
77    )
78endif()
79
80# Hack until we support globally defining _DEBUG
81if(DBG)
82    add_compile_definitions(_DEBUG)
83endif()
84
85include(conio/conio.cmake)
86include(convert/convert.cmake)
87include(dll/dll.cmake)
88include(env/env.cmake)
89include(exec/exec.cmake)
90include(filesystem/filesystem.cmake)
91include(float/float.cmake)
92include(heap/heap.cmake)
93include(initializers/initializers.cmake)
94include(internal/internal.cmake)
95include(locale/locale.cmake)
96include(lowio/lowio.cmake)
97include(math/math.cmake)
98include(mbstring/mbstring.cmake)
99include(misc/misc.cmake)
100include(startup/startup.cmake)
101include(stdio/stdio.cmake)
102include(stdlib/stdlib.cmake)
103include(string/string.cmake)
104include(time/time.cmake)
105include(vcruntime/vcruntime.cmake)
106
107add_library(ucrt OBJECT
108    ${UCRT_CONIO_SOURCES}
109    ${UCRT_CONVERT_SOURCES}
110    ${UCRT_DLL_SOURCES}
111    ${UCRT_ENV_SOURCES}
112    ${UCRT_EXEC_SOURCES}
113    ${UCRT_FILESYSTEM_SOURCES}
114    ${UCRT_FLOAT_SOURCES}
115    ${UCRT_HEAP_SOURCES}
116    ${UCRT_INITIALIZERS_SOURCES}
117    ${UCRT_INTERNAL_SOURCES}
118    ${UCRT_LOCALE_SOURCES}
119    ${UCRT_LOWIO_SOURCES}
120    ${UCRT_MATH_SOURCES}
121    ${UCRT_MBSTRING_SOURCES}
122    ${UCRT_MISC_SOURCES}
123    ${UCRT_STARTUP_SOURCES}
124    ${UCRT_STDIO_SOURCES}
125    ${UCRT_STDLIB_SOURCES}
126    ${UCRT_STRING_SOURCES}
127    ${UCRT_TIME_SOURCES}
128    ${UCRT_VCRUNTIME_SOURCES}
129)
130
131#target_link_libraries(ucrt pseh)
132add_dependencies(ucrt psdk asm)
133