Commit a521a2ef authored by Fabien Bosquet's avatar Fabien Bosquet
Browse files

Merge branch 'vcpkg' into 'main'

Introduce VCPKG manager for build dependencies

See merge request osdu/platform/domain-data-mgmt-services/reservoir/open-etp-server!64
parents 671d237b 06cc653c
build/**
# Build results
[Bb]uild/
Testing/Temporary/**
*~
......
{
"configurations": [
{
"name": "Win64-Debug-vcpkg",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${env.VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "STRING"
},
{
"name": "VCPKG_FEATURE_FLAGS",
"value": "versions",
"type": "STRING"
},
{
"name": "USE_SSL_CLIENT",
"value": "FALSE",
"type": "BOOL"
}
]
},
{
"name": "Win64-Release-vcpkg",
"generator": "Ninja",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "${env.VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"type": "STRING"
},
{
"name": "VCPKG_FEATURE_FLAGS",
"value": "versions",
"type": "STRING"
},
{
"name": "USE_SSL_CLIENT",
"value": "FALSE",
"type": "BOOL"
}
]
},
{
"name": "Linux-Debug-vcpkg",
"generator": "Ninja",
"configurationType": "Debug",
"cmakeExecutable": "cmake",
"remoteCopySourcesExclusionList": [ ".vs", ".git", "out", "build" ],
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"remoteMachineName": "${defaultRemoteMachineName}",
"remoteCMakeListsRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/src",
"remoteBuildRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}",
"remoteInstallRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}",
"remoteCopySources": true,
"rsyncCommandArgs": "-t --delete --delete-excluded",
"remoteCopyBuildOutput": false,
"remoteCopySourcesMethod": "rsync",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "STRING"
},
{
"name": "VCPKG_FEATURE_FLAGS",
"value": "versions",
"type": "STRING"
},
{
"name": "CODE_COVERAGE",
"value": "FALSE",
"type": "BOOL"
},
{
"name": "USE_SSL_CLIENT",
"value": "FALSE",
"type": "BOOL"
}
]
},
{
"name": "Linux-Release-vcpkg",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"cmakeExecutable": "cmake",
"remoteCopySourcesExclusionList": [ ".vs", ".git", "out", "build" ],
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"remoteMachineName": "${defaultRemoteMachineName}",
"remoteCMakeListsRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/src",
"remoteBuildRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/build/${name}",
"remoteInstallRoot": "$HOME/.vs/${projectDirName}/${workspaceHash}/out/install/${name}",
"remoteCopySources": true,
"rsyncCommandArgs": "-t --delete --delete-excluded",
"remoteCopyBuildOutput": false,
"remoteCopySourcesMethod": "rsync",
"variables": [
{
"name": "CMAKE_TOOLCHAIN_FILE",
"value": "$HOME/vcpkg/scripts/buildsystems/vcpkg.cmake",
"type": "STRING"
},
{
"name": "VCPKG_FEATURE_FLAGS",
"value": "versions",
"type": "STRING"
},
{
"name": "CODE_COVERAGE",
"value": "FALSE",
"type": "BOOL"
},
{
"name": "USE_SSL_CLIENT",
"value": "FALSE",
"type": "BOOL"
}
]
}
]
}
\ No newline at end of file
......@@ -20,14 +20,14 @@ The service API is based on [Energistics Transfer Protocol version 1.2](http://d
To deploy openETPserver on Azure, follow the [instructions](devops/azure/README.md).
## Build
### Requirements
### Building inside a Docker container
#### Requirements
- A Linux-based system (or Windows Subsystem for Linux)
- Docker (which now comes with docker-compose)
- For older Docker versions: docker-compose
### <a name="buildSection"></a> Build process
#### <a name="buildSection"></a> Build process
The solution is based on two docker images:
......@@ -38,7 +38,7 @@ The solution also uses a Postgres Docker image, for the unit tests and in the de
To use an alternative Postgres server, you need to provide a Postgres connection string in the variable POSTGRESQL_CONN_STRING in a format like "host=172.0.0.1 port=5432 dbname=postkv user=tester password=tester".
### Creating Docker Image (Golden Path)
#### Creating Docker Image (Golden Path)
To run the Docker container, build OpenETPServer and run unit tests:
......@@ -62,27 +62,32 @@ To remove the running postgresql container, execute:
docker-compose down
```
### Using custom build
If you prefer to build inside a more conventional build environment, simply create a build directory (for instance, build/custom_build) and run:
```bash
cmake SOURCE_DIRECTORY -GNinja
ninja
```
This can be adapted for your needs with normal CMake options.
### Custom third-party libraries
It is possible to use custom third-party libraries instead of system ones by filling the `3rdParties` directory.
It is also possible to keep third-parties inside a dedicated directory and provide it using the following option:
```bash
cmake SOURCE_DIR -GNinja -DOPEN_ETP_SERVER_3RDPARTY_DIR="PATH_TO_3RDPARTIES"
```
The provided directory must have the same structure as the `3rdParties` directory inside the source tree.
### Building via CMake on your native OS
If you prefer to develop inside a more conventional build environment, on your native OS and with favorite IDE, then follow this guide.
1. Install [VCPKG manager](https://github.com/microsoft/vcpkg) that will help to build third-party dependencies. You need to follow the official instructions for your OS (required to install minimal build tools set). Installing VCPKG itself is quite simple, you just need to clone the repository (better to not use long path) and run the bootstrap script.
```shell
git clone https://github.com/microsoft/vcpkg
# Linux/MacOs
./vcpkg/bootstrap-vcpkg.sh
# Windows
.\vcpkg\bootstrap-vcpkg.bat
```
2. Add environment variable `VCPKG_ROOT` with VCPKG installation path.
3. Build Open-ETP-server via CMake, open command line and go to directory with application sources. If you are using Visual Studio IDE, you need "x64 Native Tools Command Prompt" (can be found through Windows search), otherwise build tools won't be found. Build the project via below commands:
```shell
# Linux/MacOs
cmake -GNinja -B build -DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake -DVCPKG_FEATURE_FLAGS=versions -DCMAKE_BUILD_TYPE=Debug
cmake --build build
# Windows
cmake -GNinja -B build -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake -DVCPKG_FEATURE_FLAGS=versions -DCMAKE_BUILD_TYPE=Debug
cmake --build build
```
4. Configure your favorite IDE, need to add CMake parameters like in the previous step (CMAKE_TOOLCHAIN_FILE and VCPKG_FEATURE_FLAGS). For Visual Studio IDE, you can just open the project with "Open Folder" feature (the configuration file "CMakeSettings.json" already exists in the sources).
5. For able to run tests or application, you will also need to install [PostgreSQL](https://www.postgresql.org/), please follow instructions for your platform.
### Logger
......
{
"name": "open-etp-server",
"homepage": "https://community.opengroup.org/osdu/platform/domain-data-mgmt-services/reservoir/open-etp-server",
"description": "OpenETPServer is the open-source implementation of the Reservoir Domain Data Management Services (Reservoir DDMS) which is one of the backend services and a part of the Open Subsurface Data Universe (OSDU) software ecosystem. OpenETPServer is a single, containerized service written in C++ which stores reservoir data in the RESQML format inside a PostgreSQL database.",
"dependencies": [
"avro-cpp",
"boost-core",
"boost-asio",
"boost-accumulators",
"boost-beast",
"boost-thread",
"boost-math",
"boost-date-time",
"boost-filesystem",
"boost-endian",
"boost-scope-exit",
"boost-variant",
"boost-iostreams",
"boost-process",
"boost-preprocessor",
"boost-program-options",
"boost-regex",
"boost-uuid",
"boost-system",
"boost-test",
"curl",
"nlohmann-json",
"prometheus-cpp",
{
"name": "hdf5",
"features": [ "szip", "zlib", "cpp" ]
},
"openssl",
"zlib",
"libpq",
"websocketpp",
"gtest"
],
"builtin-baseline": "34d2cf7e62d781f4bcb9c7f44f4d2389f568e92b",
"overrides": [
{
"name": "hdf5",
"version": "1.10.5-12"
},
{
"name": "boost-asio",
"version": "1.75.0"
},
{
"name": "avro-cpp",
"version-date": "2022-11-07"
}
]
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment