Skip to content

Commit 36b73aa

Browse files
authored
Merge branch 'reactos:master' into NTFS
2 parents 91181a7 + 46db657 commit 36b73aa

File tree

8,408 files changed

+1592867
-543410
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

8,408 files changed

+1592867
-543410
lines changed

.github/labeler.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Labelling by the files touched
2+
drivers:
3+
- drivers/**
4+
- sdk/lib/drivers/**
5+
- any: ["win32ss/drivers/**", "!win32ss/drivers/font/**"]
6+
7+
freeldr:
8+
- boot/freeldr/**
9+
10+
"kernel&hal":
11+
- hal/**
12+
- ntoskrnl/**
13+
14+
ROSTESTS:
15+
- modules/rostests/**

.github/workflows/build.yml

Lines changed: 247 additions & 109 deletions
Large diffs are not rendered by default.

.github/workflows/labeler.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
- pull_request_target
4+
5+
jobs:
6+
triage:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/labeler@v3
10+
with:
11+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
compile_commands.json
12
output-*
23
modules/optional
34
modules/bootcd_extras
45
modules/livecd_extras
56
modules/hybridcd_extras
67
modules/3rdparty
78
modules/[Aa][Hh][Kk]_[Tt]ests
9+
.cache
810
.cproject
911
.project
1012
.settings

.gitmessage

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# [MODULE] A short but descriptive summary (#pr-num)
55
#
66
# A comprehensible description of WHY you did this work. Do not limit
7-
# yourself here.
8-
# The width of the description is arbitary, but it is a good idea to
9-
# wrap the text by 72 chars.
7+
# yourself here.
8+
# The width of the description is arbitary, but it is a good idea to
9+
# wrap the text by 72 chars.
1010
#
1111
# CORE-XXXX CIDXXXXX
1212
# ----------------------
@@ -17,6 +17,6 @@
1717
# * Description of a commit should explain WHY a change was made.
1818
# * JIRA, Coverity ID references should be placed at the bottom row.
1919
# * There must be a newline between summary, description and bug IDs.
20-
# * GitHub Pull Request ID should be referenced in the summary in
21-
# parens. If the resulting summary is longer than 70 chars it may
20+
# * GitHub Pull Request ID should be referenced in the summary in
21+
# parens. If the resulting summary is longer than 70 chars it may
2222
# be placed last in the ID row to prevent hard wrapping on GitHub.

.gitpod.Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM gitpod/workspace-full-vnc
2-
2+
33
USER gitpod
44

55
# Install custom tools, runtime, etc. using apt-get
@@ -14,8 +14,7 @@ RUN sudo apt-get -q update && \
1414
sudo rm -rf /var/lib/apt/lists/*
1515

1616
RUN wget https://svn.reactos.org/amine/RosBEBinFull.tar.gz && \
17-
sudo tar -xzf RosBEBinFull.tar.gz -C /usr/local && \
18-
sudo mv /usr/local/RosBEBinFull /usr/local/RosBE && \
17+
sudo tar -xzvf RosBEBinFull.tar.gz -C /usr/local --one-top-level=RosBE --strip-components 1 && \
1918
rm -f RosBEBinFull.tar.gz
2019

2120
RUN echo 'export PATH=/usr/local/RosBE/i386/bin:$PATH' >> /home/gitpod/.profile

CMakeLists.txt

Lines changed: 150 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ if(NOT CMAKE_VERSION MATCHES "ReactOS")
55
message(WARNING "Building with \"${CMAKE_COMMAND}\", which is not the custom CMake included in RosBE, might cause build issues...")
66
endif()
77

8-
project(REACTOS)
8+
include(CMakeDependentOption)
99

10-
# Versioning
11-
include(sdk/include/reactos/version.cmake)
10+
# CMAKE_CROSSCOMPILING and MSVC_IDE are not set until project() is called, so let's test this instead
11+
if ((DEFINED CMAKE_TOOLCHAIN_FILE) AND (CMAKE_GENERATOR MATCHES "Visual Studio.*"))
12+
# Do not use MSVC_RUNTIME_LIBRARY target property. We use our own flags instead
13+
message(WARNING "Setting policy CMP0091 to OLD behaviour")
14+
cmake_policy(SET CMP0091 OLD)
15+
endif()
16+
17+
project(REACTOS)
1218

1319
set(CMAKE_INCLUDE_CURRENT_DIR ON)
1420
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
@@ -18,10 +24,13 @@ set(CMAKE_SKIP_PREPROCESSED_SOURCE_RULES TRUE)
1824
set(CMAKE_SKIP_ASSEMBLY_SOURCE_RULES TRUE)
1925
set(CMAKE_COLOR_MAKEFILE OFF)
2026
set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
27+
set(CMAKE_C_STANDARD 99)
28+
set(CMAKE_CXX_STANDARD 11)
2129
#set_property(GLOBAL PROPERTY RULE_MESSAGES OFF)
2230

31+
# check that the ARCH (target architecture) variable is defined
2332
if(NOT ARCH)
24-
set(ARCH i386)
33+
message(FATAL_ERROR "Target architecture (ARCH) is not defined. Please, choose one of: i386, amd64, arm, arm64")
2534
endif()
2635
# Now the ARCH variable will be in lowercase.
2736
# It is needed because STREQUAL comparison
@@ -30,34 +39,97 @@ endif()
3039
# for more information.
3140
string(TOLOWER ${ARCH} ARCH)
3241

33-
# Compile options
42+
# set possible values for cmake GUI
43+
set_property(CACHE ARCH PROPERTY STRINGS "i386" "amd64" "arm" "arm64")
44+
45+
# Alternative WinNT-compatible architecture string
3446
if(ARCH STREQUAL "i386")
35-
include(sdk/cmake/config.cmake)
36-
elseif(ARCH STREQUAL "amd64")
37-
include(sdk/cmake/config-amd64.cmake)
38-
elseif(ARCH STREQUAL "arm")
39-
include(sdk/cmake/config-arm.cmake)
47+
set(WINARCH "x86")
48+
else()
49+
set(WINARCH ${ARCH})
50+
endif()
51+
52+
# set CMAKE_BUILD_TYPE if not set
53+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
54+
message(STATUS "Setting build type to Debug as none was specified.")
55+
set(CMAKE_BUILD_TYPE "Debug" CACHE
56+
STRING "Choose the type of build." FORCE)
57+
# Set the possible values of build type for cmake-gui
58+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
59+
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
4060
endif()
4161

62+
# Versioning
63+
include(sdk/include/reactos/version.cmake)
64+
65+
# Compile options
66+
include(sdk/cmake/config.cmake)
67+
4268
# Compiler flags handling
4369
include(sdk/cmake/compilerflags.cmake)
4470

45-
add_definitions(-D__REACTOS__)
46-
47-
# Double escape, since CMake unescapes before putting it on the command-line, where it's unescaped again by GCC/CL.
48-
add_definitions(-DREACTOS_SOURCE_DIR="${REACTOS_SOURCE_DIR}")
49-
add_definitions(-DREACTOS_BINARY_DIR="${REACTOS_BINARY_DIR}")
71+
add_definitions(
72+
-D__REACTOS__
73+
# swprintf without count argument is used in most of the codebase
74+
-D_CRT_NON_CONFORMING_SWPRINTFS
75+
)
5076

5177
# There doesn't seem to be a standard for __FILE__ being relative or absolute, so detect it at runtime.
5278
file(RELATIVE_PATH _PATH_PREFIX ${REACTOS_BINARY_DIR} ${REACTOS_SOURCE_DIR})
53-
add_compile_flags(-D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? sizeof \\\"${_PATH_PREFIX}\\\" - 1 : sizeof REACTOS_SOURCE_DIR]")
79+
if (GCC AND ((CMAKE_C_COMPILER_ID STREQUAL "GNU") AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0.0")
80+
OR ((CMAKE_C_COMPILER_ID STREQUAL "Clang") AND (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL "10.0.0"))))
81+
# Thankfully, GCC has this
82+
add_compile_options(-ffile-prefix-map=${REACTOS_SOURCE_DIR}=)
83+
add_compile_options(-ffile-prefix-map=${_PATH_PREFIX}=)
84+
else()
85+
string(LENGTH ${_PATH_PREFIX} _PATH_PREFIX_LENGTH)
86+
string(LENGTH ${REACTOS_SOURCE_DIR} REACTOS_SOURCE_DIR_LENGTH)
87+
math(EXPR REACTOS_SOURCE_DIR_LENGTH "${REACTOS_SOURCE_DIR_LENGTH} + 1")
88+
add_compile_definitions("$<$<COMPILE_LANGUAGE:C,CXX>:__RELFILE__=&__FILE__[__FILE__[0] == '.' ? ${_PATH_PREFIX_LENGTH} : ${REACTOS_SOURCE_DIR_LENGTH}]>")
89+
endif()
5490

5591
if(MSVC_IDE)
56-
add_compile_flags("/MP")
92+
add_compile_options("/MP")
5793
endif()
5894

5995
# Bison and Flex support
60-
# include(sdk/cmake/bison-flex.cmake)
96+
find_package(BISON REQUIRED)
97+
find_package(FLEX REQUIRED)
98+
99+
if(MSVC_IDE)
100+
# Bison needs M4 and BISON_PKGDATADIR set at build time,
101+
# but visual studio is hardly ever opened from the configure-time environment.
102+
# Since cmake does not support setting env variables for a custom command,
103+
# we have to write a wrapper that sets the variables and then executes bison.
104+
# Idea taken from https://stackoverflow.com/a/35032051/4928207
105+
if(DEFINED ENV{M4})
106+
# Store this environment variable for configure re-runs from withing visual studio.
107+
SET(ROS_SAVED_M4 "$ENV{M4}" CACHE INTERNAL "")
108+
endif()
109+
if(DEFINED ENV{BISON_PKGDATADIR})
110+
SET(ROS_SAVED_BISON_PKGDATADIR "$ENV{BISON_PKGDATADIR}" CACHE INTERNAL "")
111+
endif()
112+
113+
# Tell the user about a misconfigured environment
114+
if("x${ROS_SAVED_M4}x" STREQUAL "xx" OR "x${ROS_SAVED_BISON_PKGDATADIR}x" STREQUAL "xx")
115+
message(FATAL_ERROR "\nM4 or BISON_PKGDATADIR environment variables not set, cannot continue!\n"
116+
"See https://reactos.org/wiki/Visual_Studio for more information!")
117+
endif()
118+
119+
file(WRITE "${CMAKE_BINARY_DIR}/bison_wrapper.cmd"
120+
"@ECHO OFF\n"
121+
"set M4=${ROS_SAVED_M4}\n"
122+
"set BISON_PKGDATADIR=${ROS_SAVED_BISON_PKGDATADIR}\n"
123+
"${BISON_EXECUTABLE} %*\n")
124+
set(BISON_EXECUTABLE "${CMAKE_BINARY_DIR}/bison_wrapper.cmd")
125+
# And the same hacks for FLEX
126+
file(WRITE "${CMAKE_BINARY_DIR}/flex_wrapper.cmd"
127+
"@ECHO OFF\n"
128+
"set M4=${ROS_SAVED_M4}\n"
129+
"set BISON_PKGDATADIR=${ROS_SAVED_BISON_PKGDATADIR}\n"
130+
"${FLEX_EXECUTABLE} %*\n")
131+
set(FLEX_EXECUTABLE "${CMAKE_BINARY_DIR}/flex_wrapper.cmd")
132+
endif()
61133

62134
if(NOT CMAKE_CROSSCOMPILING)
63135
set(TOOLS_FOLDER ${CMAKE_CURRENT_BINARY_DIR})
@@ -72,10 +144,6 @@ if(NOT CMAKE_CROSSCOMPILING)
72144
if(MSVC_VERSION GREATER 1699)
73145
add_definitions(/D_ALLOW_KEYWORD_MACROS)
74146
endif()
75-
if(NOT USE_CLANG_CL)
76-
# FIXME: Inspect
77-
add_definitions(/Dinline=__inline)
78-
endif()
79147
endif()
80148
add_subdirectory(sdk/include/host)
81149

@@ -90,9 +158,7 @@ if(NOT CMAKE_CROSSCOMPILING)
90158
list(APPEND NATIVE_TARGETS rsym pefixup)
91159
endif()
92160

93-
export(TARGETS ${NATIVE_TARGETS} FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- )
94-
configure_file(sdk/cmake/host-tools.in ${CMAKE_BINARY_DIR}/TargetList.cmake)
95-
161+
install(TARGETS ${NATIVE_TARGETS})
96162
else()
97163
# Add host tools target
98164
include(sdk/cmake/host-tools.cmake)
@@ -101,8 +167,21 @@ else()
101167
# We don't need CMake importlib handling.
102168
unset(CMAKE_IMPORT_LIBRARY_SUFFIX)
103169

104-
# Print build type
105-
message("-- Build Type: ${CMAKE_BUILD_TYPE}")
170+
# Print build type(s)
171+
if(CMAKE_CONFIGURATION_TYPES)
172+
# Multi-config generators, like Visual Studio (MSBuild).
173+
message("-- Configuration types: ${CMAKE_CONFIGURATION_TYPES}")
174+
else()
175+
# Single-configuration generators, like Ninja.
176+
message("-- Build type: ${CMAKE_BUILD_TYPE}")
177+
endif()
178+
179+
# Always add /MT in VS CMAKE_GENERATOR and define _SBCS otherwise VS thinks it's a multi-byte or whatever project
180+
if (MSVC_IDE)
181+
add_compile_options("/MT")
182+
add_compile_definitions(_SBCS)
183+
endif()
184+
106185

107186
# adjust the default behaviour of the FIND_XXX() commands:
108187
# search headers and libraries in the target environment, search
@@ -111,8 +190,26 @@ else()
111190
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
112191
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
113192

114-
#useful stuff!
115-
include(CMakeParseArguments)
193+
# Add our own target properties
194+
# General module definitions
195+
define_property(TARGET PROPERTY REACTOS_MODULE_TYPE
196+
BRIEF_DOCS "The type of this module"
197+
FULL_DOCS [[
198+
The type of this module.
199+
One of "nativecui", "nativedll", "kernelmodedriver", "wdmdriver", "kerneldll", "win32cui", "win32gui", "win32dll", "win32ocx", "cpl" or "module"]])
200+
201+
# C++
202+
define_property(TARGET PROPERTY WITH_CXX_EXCEPTIONS
203+
BRIEF_DOCS "Enable C++ exceptions on this target"
204+
FULL_DOCS [[
205+
Enables C++ exception handling.
206+
Enable this if the module uses try/catch or throw. You might also need this if you use a standard operator new (the one without nothrow).]])
207+
define_property(TARGET PROPERTY WITH_CXX_RTTI
208+
BRIEF_DOCS "Enable C++ RTTI on this target"
209+
FULL_DOCS [[
210+
Enables run-time type information.
211+
Enable this if the module uses typeid or dynamic_cast. You will probably need to link yith cpprt as well, if you are not already using STL.]])
212+
116213

117214
if(DBG)
118215
add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE)
@@ -131,6 +228,7 @@ else()
131228
if(ENABLE_CCACHE)
132229
message(WARNING "-- Disabling precompiled headers support (ccache).")
133230
option(PCH "Whether to use precompiled headers" OFF)
231+
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
134232
elseif(GCC)
135233
message(WARNING "-- Disabling precompiled headers on GCC by default CORE-17108.")
136234
option(PCH "Whether to use precompiled headers" OFF)
@@ -158,27 +256,40 @@ else()
158256
add_definitions(-DSARCH_PC98)
159257
endif()
160258
elseif(ARCH STREQUAL "amd64")
161-
add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
259+
# clang-cl defines this one for itself
260+
if (NOT (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang"))
261+
add_compile_definitions(_M_AMD64)
262+
endif()
263+
add_definitions(-D_AMD64_ -D__x86_64__ -D_WIN64)
162264
elseif(ARCH STREQUAL "arm")
163265
# _M_ARM is already defined by toolchain
164266
add_definitions(-D_ARM_ -D__arm__ -DWIN32)
165-
if(SARCH STREQUAL "omap-zoom2")
267+
if(SARCH STREQUAL "omap3-zoom2")
166268
add_definitions(-D_ZOOM2_)
167269
endif()
270+
elseif(ARCH STREQUAL "arm64")
271+
# GNU tools refer to arm64 as aarch64
272+
add_definitions(-D_ARM64_ -D__arm64__ -D__aarch64__ -D_WIN64)
168273
endif()
169274

170275
# Other
171276
add_definitions(-D_NEW_DELETE_OPERATORS_)
172277
if(ARCH STREQUAL "i386")
173278
add_definitions(-DUSE_COMPILER_EXCEPTIONS -D_USE_32BIT_TIME_T)
174279
elseif(ARCH STREQUAL "amd64")
175-
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
280+
add_compile_definitions(USE_COMPILER_EXCEPTIONS)
176281
elseif(ARCH STREQUAL "arm")
177-
add_definitions(-DUSE_COMPILER_EXCEPTIONS -DNO_UNDERSCORE_PREFIX)
282+
add_compile_definitions(USE_COMPILER_EXCEPTIONS)
283+
elseif(ARCH STREQUAL "arm64")
284+
add_compile_definitions(USE_COMPILER_EXCEPTIONS)
178285
endif()
179286

180287
# Activate support for assembly source files
181-
enable_language(ASM)
288+
if (MSVC)
289+
enable_language(ASM_MASM)
290+
else()
291+
enable_language(ASM)
292+
endif()
182293

183294
# Activate language support for resource files
184295
enable_language(RC)
@@ -236,7 +347,11 @@ else()
236347
if(NO_ROSSYM)
237348
include(sdk/cmake/baseaddress_dwarf.cmake)
238349
elseif(MSVC)
239-
include(sdk/cmake/baseaddress_msvc.cmake)
350+
if (ARCH STREQUAL "amd64")
351+
include(sdk/cmake/baseaddress_msvc_x64.cmake)
352+
else()
353+
include(sdk/cmake/baseaddress_msvc.cmake)
354+
endif()
240355
else()
241356
include(sdk/cmake/baseaddress.cmake)
242357
endif()

0 commit comments

Comments
 (0)