|
| 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) |
0 commit comments