Skip to content

Commit 2b42ffa

Browse files
authored
Merge pull request #229 from gojimmypi/pr-realm-vs2022
Introduce realm-core Visual Studio 2022 projects
2 parents e48cff3 + 8858056 commit 2b42ffa

336 files changed

Lines changed: 61051 additions & 61 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,67 @@ openssh/regress/authorized_keys*
110110
stunnel/example/echoserver/echoserver*
111111
*.plist
112112
server_err.log
113-
/.vs
113+
114+
# Visual Studio
115+
**/.vs
116+
117+
# All backup files
118+
*.bak
119+
120+
# CMake files to exclude
121+
/realm/VS2022/**/CMakeCache.txt
122+
/realm/VS2022/**/*.cmake
123+
124+
/realm/VS2022/**/install_manifest_devel.txt
125+
/realm/VS2022/**/build/wolfssl
126+
127+
128+
# Download by build process:
129+
/realm/VS2022/zlib/**
130+
131+
/realm/VS2022/**/*.log
132+
133+
# Build-time cache
134+
/realm/VS2022/**/THIS_WOLFSSL_ROOT_REG.txt
135+
/realm/VS2022/CMakeFiles/**/*
136+
/realm/VS2022/test/DebugSync_**
137+
/realm/VS2022/test/*.lock
138+
/realm/VS2022/test/*.realm
139+
/realm/VS2022/test/*.backup-log
140+
/realm/VS2022/**/*.realm.lock
141+
/realm/VS2022/**/generate.stamp
142+
/realm/VS2022/**/generate.stamp.depend
143+
/realm/VS2022/external/catch/src/Catch2.dir/**/objects.txt
144+
145+
# Realm build-time generated test files
146+
/realm/VS2022/Testing/**/CTestCheckpoint.txt
147+
/realm/VS2022/Testing/**/LastTest.log.tmp
148+
/realm/VS2022/test/benchmark-common-tasks/Debugbenchmark_common_tasks_EmptyCommit_Full_EncryptionOff.realm
149+
/realm/VS2022/test/benchmark-common-tasks/Debugbenchmark_common_tasks_AddTable_Full_EncryptionOff.realm
150+
/realm/VS2022/test/benchmark-common-tasks/Debugbenchmark_common_tasks_AddTable_Full_EncryptionOff.realm.lock
151+
/realm/VS2022/test/DebugLangBindHelper_CompactLargeEncryptedFile.1.path.realm.tmp_compaction_space
152+
/realm/VS2022/test/DebugShared_CompactEmpty.1.path.realm.tmp_compaction_space
153+
/realm/VS2022/test/DebugFile_Offset.*
154+
155+
# Realm test-time generated files
156+
/realm/VS2022/test/**/data.realm
157+
/realm/VS2022/test/**/Debug**.realm
158+
/realm/VS2022/test/**/Debugresults.*
159+
/realm/VS2022/test/**/Debugresults.latest.json
160+
/realm/VS2022/test/**/*.tmp_compaction_space
161+
/realm/VS2022/test/**/Debugresults.*.csv
162+
163+
# Realm auto-generated dependency files
164+
/realm/VS2022/_deps/libuv-build/CMakeFiles
165+
/realm/VS2022/_deps/libuv-build/Testing
166+
/realm/VS2022/_deps/libuv-build/DartConfiguration.tcl
167+
168+
/realm/VS2022/_deps/libuv-subbuild/CMakeLists.txt
169+
/realm/VS2022/_deps/libuv-subbuild/CMakeFiles
170+
/realm/VS2022/_deps/libuv-subbuild/libuv-populate-prefix/tmp
171+
/realm/VS2022/_deps/libuv-subbuild/libuv-populate-prefix/src
172+
173+
# Ensure a couple of placeholder files are always included
174+
!/realm/VS2022/CMakeFiles/VerifyGlobs.cmake
175+
!/realm/VS2022/CMakeFiles/cmake.verify_globs
176+

realm/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
message(STATUS "wolfSSL OSP Realm CMake")

realm/README.md

Lines changed: 177 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The [build_wolfssl_with_realm.sh](./build_wolfssl_with_realm.sh) script can be u
1515
* `-t` use tarball, not git
1616
* `-u` use $USER name suffix for repository
1717

18-
###
18+
### Notes
1919

2020
Defaults are to clone [wolfSSL](https://github.com/wolfSSL/wolfssl) and [realm-core](https://github.com/realm/realm-core) to local directory.
2121

@@ -44,6 +44,12 @@ BUILD_WOLFSSL=false
4444
INSTALL_WOLFSSL=false
4545
```
4646

47+
Example:
48+
49+
```bash
50+
cmake -B build -DREALM_INCLUDE_CERTS=1 -DREALM_ENABLE_ENCRYPTION=1 -DREALM_ENABLE_SYNC=1 -DREALM_HAVE_WOLFSSL=1 -DREALM_WOLFSSL_ROOT_DIR=/home/gojimmypi/wolfssl-install-dir
51+
```
52+
4753
## Linux manual build: Build wolfSSL
4854

4955
These commands are wrapped in the `build_wolfssl_with_realm.sh` script, mentioned above:
@@ -77,16 +83,141 @@ cmake --build build
7783
./build/test/realm-tests
7884
```
7985

80-
You can also use the build_wolfssl_with_realm.sh script after adjusting the global variables as needed.
86+
You can also use the `build_wolfssl_with_realm.sh [-u]` script after adjusting the global variables as needed.
87+
88+
## Visual Studio
89+
90+
To fetch files for a Visual Studio build:
91+
92+
```
93+
#!/bin/bash
94+
95+
# wolfSSL OSP
96+
git clone https://github.com/gojimmypi/osp.git
97+
cd osp
98+
git checkout dev
99+
git submodule update --init --recursive
100+
101+
# realm-core is part of wolfssl osp/realm
102+
cd realm
103+
git clone https://github.com/gojimmypi/realm-core.git
104+
105+
# If not cloned to osp/realm/realm-core,
106+
# Edit REALM_DIR_TEMP and REALM_CORE_ROOT values in
107+
# [workspace]/osp/realm/VS2022/realm-core-GlobalProperties.props
108+
109+
cd realm-core
110+
git checkout dev
111+
git submodule update --init --recursive
112+
```
113+
114+
The main Ream-Core solution file is located in `VS2022\RealmCore.sln`.
115+
116+
There's also a stand-alone wolfSSH solution that contains only the wolfSSL project in `VS2022\wolfssl-VS2022-cmake.sln`
117+
118+
The platform and machine independent settings such as `$(CurrentVsInstallRoot)` will likely be reset to fully-qualified paths at build time.
119+
120+
See the `vs_clean.sh` to reset variables such as Visual Studio Edition paths to `$(CurrentVsInstallRoot)`.
121+
122+
If no other changes have made, the project `*.vcxproj` changes can also be reverted. Builds should be successful with either full paths or VS macros.
123+
124+
The project files assume there are already source code directories available. For instance:
125+
126+
```
127+
cd \workspace
128+
git clone https://github.com/wolfSSL/wolfssl.git [wolfssl-%USERNAME%]
129+
git clone https://github.com/wolfSSL/osp.git [osp-%USERNAME%]
130+
131+
cd [osp-%USERNAME%]
132+
git clone https://github.com/realm/realm-core.git [realm-core-%USERNAME%]
133+
```
134+
135+
Resulting in directories like this (user suffixes optional, but must be consistent):
136+
137+
```
138+
C:\workspace\wolfssl[-%USERNAME%]
139+
C:\workspace\osp[-%USERNAME%]
140+
C:\workspace\osp[-%USERNAME%]\realm-core[-%USERNAME%]
141+
```
142+
143+
The patch must be applied:
144+
145+
```
146+
cd C:\workspace\realm-core
147+
git apply ../osp-gojimmypi/realm/realm-commit-a5e87a39.patch
148+
```
149+
150+
There's an enclosed WSL script called [build_wolfssl_with_realm.sh](./build_wolfssl_with_realm.sh) that automates installation.
151+
152+
## Clean from DOS Prompt or Visual Studio Developer Command Prompt
153+
154+
Run the enclosed `clean_realm.bat` in the `osp[-%USERNAME%]/realm` directory to delete all build-time generated files:
155+
156+
```
157+
cd realm
158+
.\clean_realm.bat
159+
```
160+
161+
Optionally clean in quiet mode with `/Q` parameter:
162+
163+
```
164+
cd realm
165+
.\clean_realm.bat /Q
166+
```
167+
168+
## Build from Visual Studio Developer Command Prompt
169+
170+
Start a Developer Command Prompt for VS 2022
171+
172+
```
173+
cd C:\workspace\osp-%USERNAME%\realm\VS2022
174+
msbuild .\wolfssl-VS2022-cmake.vcxproj /p:Configuration=Debug /p:Platform=x64
175+
msbuild .\ALL_BUILD.vcxproj /p:Configuration=Debug /p:Platform=x64
176+
```
177+
178+
## Known Visual Studio Issues
179+
180+
Project files were designed with Visual Studio 2022 version 17.11.5.
181+
182+
Some minor issues are known:
183+
184+
### Project Reload Path Replacements
185+
186+
Occasionally the project files may spontaneously reload, replacing all parameterized values with current fixed paths.
187+
188+
This should be fine for typical end-users, but is highly undesired for developers wishing to contribute changes to project files.
189+
190+
There's no known solution at this time. Undo all changes in the `VS2022` directories, in particular for `.vscproj` and `.filters` files.
191+
192+
Consider performing a full, brute-force clean with `clean_realm.bat`.
193+
194+
For more information see [dotnet/msbuild #5486](https://github.com/dotnet/msbuild/issues/5486) and [Visual Studio Developer Community](https://developercommunity.visualstudio.com/t/NETSdk-build-runs-unexpectedly-undesir/10816622?).
195+
196+
After the initial undo of changes, the reload typically does not occur again.
197+
198+
This issue seems to be related to the `VS2022/CMakeFiles/VerifyGlobs.cmake` file (see below).
199+
200+
# Extra VerifyGlobs.cmake file in CMakeFiles
201+
202+
There's a `VerifyGlobs.cmake` placeholder file located in `[osp]\realm\VS2022\CMakeFiles` that is required for fresh clones to build properly.
203+
204+
### Maximum Path Length
205+
206+
The default Windows configuration has a maximum 256 character path limitation.
207+
See [Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) for more details.
208+
209+
### VerifyGlobs.cmake Placeholder
210+
211+
Without the `VS2022/CMakeFiles/VerifyGlobs.cmake` file, the initial project build fails due to this auto-generated file being "missing".
212+
213+
Subsequent build attempts are typically successful. Not that _including_ this file also seems to be related to the undesired Project Reload (see above).
81214

82215
## Generating a new Realm-core patch file:
83216

84217
To generate a new patch compare a particular commit (a5e87a39) to your fork/branch (`dev`):
85218

86219
Save the generated file from this link to the `realm-commit-a5e87a39.patch` file:
87220

88-
89-
90221
```
91222
https://github.com/gojimmypi/realm-core/compare/a5e87a39...dev.patch
92223
@@ -99,19 +230,41 @@ Do *not* edit the patch file for tailing spaces, etc. It must be saved exactly a
99230

100231
## Troubleshooting
101232

233+
### Unexpected value of WOLFSSL_ROOT
234+
235+
Check system and user environment settings.
236+
237+
```powershell
238+
Get-ChildItem Env:WOLFSSL_ROOT
239+
```
240+
241+
Check registry, particularly if you use `SETX`:
242+
243+
* User-specific: `HKEY_CURRENT_USER\Environment`
244+
* System-wide: `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment`
245+
246+
Check any other parent processes, startup scripts, Group Policy, etc.
247+
248+
If the registry value continues to be undesirably cached, try one or more of these options:
249+
250+
* Use `SET` and `SETX` to update the value.
251+
* Log out and back in.
252+
* Restart Windows Explorer from Task Manager.
253+
* Reboot.
254+
102255
### Confirming build with wolfSSL
103256

104257
See generated `config.h` files:
105258

106259
For Linux compile: `build` directory:
107260
```
108-
[wolfssl osp root]\realm\realm-core\build\src\realm\util
261+
[wolfssl osp root]\realm\realm-core[-username]\build\src\realm\util
109262
```
110263

111264
For Visual Studio compile: `out` directory, plus build configuration (e.g. `build\x64-Debug`):
112265

113266
```
114-
[wolfssl osp root]\realm\realm-core\out\build\x64-Debug\src\realm\util
267+
[wolfssl osp root]\realm\realm-core[-username]\out\build\x64-Debug\src\realm\util
115268
```
116269

117270
### Cannot find OpenSSL
@@ -128,4 +281,21 @@ openSSL disabled `0` and wolfSSL enabled `1` like this:
128281
#define REALM_HAVE_WOLFSSL 1
129282
```
130283

131-
###
284+
### CMake error Not a file: VerifyGlobs.cmake
285+
286+
This file is typically not included in source control, but was found to be problematic when missing in this solution. Thus, there's a placeholder file.
287+
288+
```
289+
1>Checking File Globs
290+
1>EXEC : CMake error : Not a file: C:/workspace/osp-gojimmypi/realm/VS2022/CMakeFiles/VerifyGlobs.cmake
291+
1>EXEC : CMake error : Error processing file: C:/workspace/osp-gojimmypi/realm/VS2022/CMakeFiles/VerifyGlobs.cmake
292+
```
293+
294+
### Missing LibUV
295+
296+
Open the cloned `realm-core` in Visual Studio and let cmake download and setup LibUV.
297+
298+
```
299+
1> [CMake] -- Could NOT find LibUV (missing: LibUV_LIBRARY LibUV_INCLUDE_DIR) (found version "")
300+
1> [CMake] -- LibUV not found, building from source with FetchContent
301+
```

realm/VS2022/.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# CMake backup files
2+
*.old
3+
*.bak
4+
5+
# auto-downloaded & generated tar files
6+
*.tar.gz
7+
8+
# temp files
9+
CTestCostData.txt
10+
11+
# Log files
12+
LastTest.log
13+
LastTestsFailed.log
14+
15+
# Build-time downloads and auto-generated files
16+
_CPack_Packages/**
17+
/install_manifest_runtime.txt
18+
/install_manifest_Unspecified.txt

0 commit comments

Comments
 (0)