[win] compilation on windows verified

This commit is contained in:
amukhamadiev 2026-02-20 20:37:08 +03:00
parent ece26e7b1f
commit 8ee06fe6a0
3 changed files with 63 additions and 7 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ subprojects/glog/
subprojects/googletest-* subprojects/googletest-*
subprojects/nlohmann_json/ subprojects/nlohmann_json/
subprojects/packagecache/ subprojects/packagecache/
subprojects/yaml-cpp-0.8.0 subprojects/yaml-cpp-0.8.0
.venv/

View File

@ -69,7 +69,7 @@ deactivate CloudPointClient
Caller -> CloudPointClient : destruct Caller -> CloudPointClient : destruct
CloudPointClient -> TCPClient : finish waiting CloudPointClient -> TCPClient : finish waiting
deactivate TCPClient deactivate TCPClient
deactivate CloudPointClient deactivate CloudPointClient
UnityWorld -> CloudPointServer : destruct UnityWorld -> CloudPointServer : destruct
deactivate CloudPointServer deactivate CloudPointServer
@ -82,38 +82,66 @@ deactivate CloudPointServer
The project uses **Meson** build system and **C++20**. The project uses **Meson** build system and **C++20**.
### Dependencies ### Dependencies
- Meson, Ninja - Meson, Ninja
- GCC/Clang (C++20 support) - GCC/Clang (C++20 support)
- Git (for subprojects) - Git (for subprojects)
### Build & Run ### Build & Run
```bash ```bash
git submodule init
git submodule update
meson setup build meson setup build
meson compile -C build meson compile -C build
./build/src/cloud_point_rpc_server config.yaml ./build/src/cloud_point_rpc_server config.yaml
``` ```
#### Build on windows
It's assumed that you have `GCC` and `make`/`ninja` installed on your system (and available in `PATH`)
```powershell
## FIRST OF ALL!
git submodule init
git submodule update
# Next python:
python3 -m venv .\venv
.\.venv\Scripts\Activate.ps1
pip install meson cmake
meson setup -Ddefault_library=static build
meson compile -C build
# To correctly get dlls:
meson devenv -C build
## .\build\tests\unit_tests < for dummy test
## .\build\src\.. < produced execs and libs
```
### Testing ### Testing
```bash ```bash
meson test -C build -v meson test -C build -v
``` ```
## Docker ## Docker
You can build and run the cli using Docker. You can build and run the cli using `Docker`.
### 1. Build Image ### 1. Build Image
```bash ```bash
docker build -t cloud-point-rpc . docker build -t cloud-point-rpc .
``` ```
### 2. Run Container ### 2. Run Container
The cli will try to connect to a **running server** on ip and port defined in config.yml file. (defined in `config.yaml` inside the image).
For simplicity, it's better to use a host network, so you will not have any headache with accessability.
> *Server is not configured to run through container, if you need, contact me* The cli will try to connect to a **running server** on ip and port defined in config.yml file. (defined in `config.yaml` inside the image).
For simplicity, it's better to use a host network, so you will not have any headache with accessability.
> _Server is not configured to run through container, if you need, contact me_
You also can mount your own `config.yaml` to override the default settings: You also can mount your own `config.yaml` to override the default settings:
```bash ```bash
docker run --network=host -it -v $(pwd)/my_config.yaml:/app/config.yaml cloud-point-rpc docker run --network=host -it -v $(pwd)/my_config.yaml:/app/config.yaml cloud-point-rpc
``` ```

View File

@ -10,7 +10,19 @@ asio_dep = dependency('asio', fallback : ['asio', 'asio_dep'])
# GLog via CMake fallback # GLog via CMake fallback
cmake = import('cmake') cmake = import('cmake')
glog_opt = cmake.subproject_options() glog_opt = cmake.subproject_options()
glog_opt.add_cmake_defines({'WITH_GFLAGS': 'OFF', 'WITH_GTEST': 'OFF'}) glog_opt.add_cmake_defines({
'WITH_GFLAGS': 'OFF',
'WITH_GTEST': 'OFF',
})
libtype = get_option('default_library')
if libtype == 'static'
message('Will share static state with glog')
glog_opt.add_cmake_defines({
'BUILD_SHARED_LIBS': 'OFF',
})
endif
glog_proj = cmake.subproject('glog', options: glog_opt) glog_proj = cmake.subproject('glog', options: glog_opt)
glog_dep = glog_proj.dependency('glog') glog_dep = glog_proj.dependency('glog')
@ -26,3 +38,18 @@ inc = include_directories(['include', 'rpc/include'])
subdir('src') subdir('src')
subdir('tests') subdir('tests')
if host_machine.system() == 'windows' and libtype == 'shared'
message('We are on Windows, so to prevent our ass from pain')
devenv = environment()
message('By the way, I hate windows :O')
prefixed = meson.global_build_root() / 'subprojects'
message('Prefixed dir is: ', prefixed)
devenv.append('PATH', prefixed / 'glog')
devenv.append('PATH', prefixed / 'googletest-1.17.0' / 'googletest')
devenv.append('PATH', prefixed / 'googletest-1.17.0' / 'googlemock')
devenv.append('PATH', prefixed / 'yaml-cpp-0.8.0')
meson.add_devenv(devenv)
endif