Skip to content

Commit 7bb1266

Browse files
committed
[UCRT] Add CMake files
1 parent ef440b9 commit 7bb1266

File tree

21 files changed

+654
-1
lines changed

21 files changed

+654
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to
256256
elseif(ARCH STREQUAL "amd64")
257257
# clang-cl defines this one for itself
258258
if (NOT (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang"))
259-
add_compile_definitions(_M_AMD64)
259+
add_compile_definitions(_M_AMD64 _M_X64)
260260
endif()
261261
add_definitions(-D_AMD64_ -D__x86_64__ -D_WIN64)
262262
elseif(ARCH STREQUAL "arm")

sdk/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ add_subdirectory(strmiids)
5252
add_subdirectory(smlib)
5353
add_subdirectory(tdilib)
5454
add_subdirectory(tzlib)
55+
add_subdirectory(ucrt)
5556
add_subdirectory(udmihelp)
5657
add_subdirectory(uuid)
5758
add_subdirectory(wdmguid)

sdk/lib/ucrt/CMakeLists.txt

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
2+
set(CMAKE_CXX_STANDARD 17)
3+
4+
# Replace the old CRT include directory with the UCRT include directory
5+
get_property(INCLUDE_DIRS DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
6+
list(REMOVE_ITEM INCLUDE_DIRS "${REACTOS_SOURCE_DIR}/sdk/include/crt")
7+
set_property(DIRECTORY . PROPERTY INCLUDE_DIRECTORIES ${INCLUDE_DIRS})
8+
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/ucrt)
9+
10+
if(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>)
16+
endif()
17+
18+
# Internal includes
19+
include_directories(BEFORE inc)
20+
21+
if(${ARCH} STREQUAL "i386")
22+
include_directories(inc/i386)
23+
endif()
24+
25+
remove_definitions(-D_WIN32_WINNT=0x502 -DWINVER=0x502)
26+
add_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+
36+
if(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>)
67+
endif()
68+
69+
if(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+
)
78+
endif()
79+
80+
# Hack until we support globally defining _DEBUG
81+
if(DBG)
82+
add_compile_definitions(_DEBUG)
83+
endif()
84+
85+
include(conio/conio.cmake)
86+
include(convert/convert.cmake)
87+
include(dll/dll.cmake)
88+
include(env/env.cmake)
89+
include(exec/exec.cmake)
90+
include(filesystem/filesystem.cmake)
91+
include(heap/heap.cmake)
92+
include(initializers/initializers.cmake)
93+
include(internal/internal.cmake)
94+
include(locale/locale.cmake)
95+
include(lowio/lowio.cmake)
96+
include(mbstring/mbstring.cmake)
97+
include(misc/misc.cmake)
98+
include(startup/startup.cmake)
99+
include(stdio/stdio.cmake)
100+
include(stdlib/stdlib.cmake)
101+
include(string/string.cmake)
102+
include(time/time.cmake)
103+
104+
add_library(ucrt OBJECT
105+
${UCRT_CONIO_SOURCES}
106+
${UCRT_CONVERT_SOURCES}
107+
${UCRT_DLL_SOURCES}
108+
${UCRT_ENV_SOURCES}
109+
${UCRT_EXEC_SOURCES}
110+
${UCRT_FILESYSTEM_SOURCES}
111+
${UCRT_HEAP_SOURCES}
112+
${UCRT_INITIALIZERS_SOURCES}
113+
${UCRT_INTERNAL_SOURCES}
114+
${UCRT_LOCALE_SOURCES}
115+
${UCRT_LOWIO_SOURCES}
116+
${UCRT_MBSTRING_SOURCES}
117+
${UCRT_MISC_SOURCES}
118+
${UCRT_STARTUP_SOURCES}
119+
${UCRT_STDIO_SOURCES}
120+
${UCRT_STDLIB_SOURCES}
121+
${UCRT_STRING_SOURCES}
122+
${UCRT_TIME_SOURCES}
123+
)
124+
125+
#target_link_libraries(ucrt pseh)
126+
add_dependencies(ucrt psdk asm)

sdk/lib/ucrt/conio/conio.cmake

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
list(APPEND UCRT_CONIO_SOURCES
3+
conio/cgets.cpp
4+
conio/cgetws.cpp
5+
conio/cprintf.cpp
6+
conio/cputs.cpp
7+
conio/cputws.cpp
8+
conio/cscanf.cpp
9+
conio/getch.cpp
10+
conio/getwch.cpp
11+
conio/initcon.cpp
12+
conio/initconin.cpp
13+
conio/pipe.cpp
14+
conio/popen.cpp
15+
conio/putch.cpp
16+
conio/putwch.cpp
17+
)

sdk/lib/ucrt/convert/convert.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
list(APPEND UCRT_CONVERT_SOURCES
3+
convert/atof.cpp
4+
convert/atoldbl.cpp
5+
convert/atox.cpp
6+
convert/c16rtomb.cpp
7+
convert/c32rtomb.cpp
8+
convert/cfout.cpp
9+
convert/common_utf8.cpp
10+
convert/cvt.cpp
11+
convert/fcvt.cpp
12+
convert/fp_flags.cpp
13+
convert/gcvt.cpp
14+
convert/isctype.cpp
15+
convert/ismbstr.cpp
16+
convert/iswctype.cpp
17+
convert/mblen.cpp
18+
convert/mbrtoc16.cpp
19+
convert/mbrtoc32.cpp
20+
convert/mbrtowc.cpp
21+
convert/mbstowcs.cpp
22+
convert/mbtowc.cpp
23+
convert/strtod.cpp
24+
convert/strtox.cpp
25+
convert/swab.cpp
26+
convert/tolower_toupper.cpp
27+
convert/towlower.cpp
28+
convert/towupper.cpp
29+
convert/wcrtomb.cpp
30+
convert/wcstombs.cpp
31+
convert/wctomb.cpp
32+
convert/wctrans.cpp
33+
convert/wctype.cpp
34+
convert/xtoa.cpp
35+
convert/_ctype.cpp
36+
convert/_fptostr.cpp
37+
convert/_mbslen.cpp
38+
convert/_wctype.cpp
39+
)
40+
41+
# All multibyte string functions require the _MBCS macro to be defined
42+
set_source_files_properties(convert/ismbstr.cpp PROPERTIES COMPILE_DEFINITIONS _MBCS)

sdk/lib/ucrt/dll/dll.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
list(APPEND UCRT_DLL_SOURCES
3+
dll/appcrt_dllmain.cpp
4+
dll/empty.cpp
5+
)

sdk/lib/ucrt/env/env.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
list(APPEND UCRT_ENV_SOURCES
3+
env/environment_initialization.cpp
4+
env/getenv.cpp
5+
env/getpath.cpp
6+
env/get_environment_from_os.cpp
7+
env/putenv.cpp
8+
env/searchenv.cpp
9+
env/setenv.cpp
10+
)

sdk/lib/ucrt/exec/exec.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
list(APPEND UCRT_EXEC_SOURCES
3+
exec/cenvarg.cpp
4+
exec/exec.cmake
5+
exec/getproc.cpp
6+
exec/loaddll.cpp
7+
exec/spawnl.cpp
8+
exec/spawnlp.cpp
9+
exec/spawnv.cpp
10+
exec/spawnvp.cpp
11+
exec/system.cpp
12+
exec/wait.cpp
13+
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
list(APPEND UCRT_FILESYSTEM_SOURCES
3+
filesystem/access.cpp
4+
filesystem/chmod.cpp
5+
filesystem/findfile.cpp
6+
filesystem/fullpath.cpp
7+
filesystem/makepath.cpp
8+
filesystem/mkdir.cpp
9+
filesystem/rename.cpp
10+
filesystem/rmdir.cpp
11+
filesystem/splitpath.cpp
12+
filesystem/stat.cpp
13+
filesystem/unlink.cpp
14+
filesystem/waccess.cpp
15+
filesystem/wchmod.cpp
16+
filesystem/wmkdir.cpp
17+
filesystem/wrename.cpp
18+
filesystem/wrmdir.cpp
19+
filesystem/wunlink.cpp
20+
)
21+
22+
if(MSVC)
23+
# Disable warning C4838: conversion from 'int' to 'size_t' requires a narrowing conversion
24+
set_source_files_properties(filesystem/splitpath.cpp PROPERTIES COMPILE_FLAGS "/wd4838")
25+
endif()

sdk/lib/ucrt/heap/heap.cmake

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
list(APPEND UCRT_HEAP_SOURCES
3+
heap/align.cpp
4+
heap/calloc.cpp
5+
heap/calloc_base.cpp
6+
heap/expand.cpp
7+
heap/free.cpp
8+
heap/free_base.cpp
9+
heap/heapchk.cpp
10+
heap/heapmin.cpp
11+
heap/heapwalk.cpp
12+
heap/heap_handle.cpp
13+
heap/malloc.cpp
14+
heap/malloc_base.cpp
15+
heap/msize.cpp
16+
heap/new_handler.cpp
17+
heap/new_mode.cpp
18+
heap/realloc.cpp
19+
heap/realloc_base.cpp
20+
heap/recalloc.cpp
21+
)
22+
23+
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
24+
list(APPEND UCRT_HEAP_SOURCES
25+
heap/debug_heap.cpp
26+
heap/debug_heap_hook.cpp
27+
)
28+
endif()

0 commit comments

Comments
 (0)