Skip to content

Commit 472e632

Browse files
committed
Prepare the MeVisLab thirdparty libraries for the 4.0.0 release
Note that the required Conan version is now 2.2
1 parent 8c66d0c commit 472e632

1,802 files changed

Lines changed: 31240 additions & 437346 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.

README.md

Lines changed: 33 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,99 +2,87 @@
22

33
Recipes for MeVisLab Thirdparty packages
44

5-
The `recipes` directory contains all recipes. The overall build order is currently defined in the `build_configuratuion.yml`.
5+
The `recipes` directory contains all recipes. The overall build order is currently defined in the `build_configuration.yml`.
66

77
## Local package development
88

99
### Preconditions
1010

11-
First of all we need [Python >=3.9 and Pip](https://www.python.org/).
11+
First of all we need [Python >=3.10 and Pip](https://www.python.org/).
12+
Currently we recommend Python 3.11.
1213

14+
Check the installed versions with:
1315
```
1416
python -V
1517
pip --version
1618
```
1719

18-
Note that on all platforms except Windows the Python 3 executables are mostly called `python3` while `pip3`/`pip` don't exist at all. But to be compatible with Windows _(yes, that's the wrong way around - blame MS!)_, we currently need the `python` and `pip` symlinks point to `python3` and `pip3` _(or better `python3 -m pip`)_ respectively. Everything else may work, but has not been tested.
20+
Note that on POSIX platforms the Python 3 executable is called `python3`, while under Windows it is called `python`.
21+
Additionally, under POSIX, `pip3` is not installed per default, while under Windows it is installed with Python as `pip`.
22+
To be compatible with Windows _(yes, that's the wrong way around - blame MS!)_, we currently need the `python` and `pip` symlinks point to `python3` and `pip3` _(or better `python3 -m pip`)_ respectively. Everything else may work, but has not been tested.
1923

2024
Note also that on current Windows versions [Microsoft hijacks](https://docs.microsoft.com/en-us/windows/python/faqs#why-does-running-pythonexe-open-the-microsoft-store) the `python` and `python3` executables.
2125

2226

2327
### Install Conan
2428

2529
[Conan](https://conan.io) is the package manager used to build our third party libraries.
26-
Additionally, we are using [Conan Package Tools](https://github.com/conan-io/conan-package-tools) to generate multiple binary packages from a recipe with ease.
27-
28-
Both packages can be installed using pip:
30+
On Windows, use:
2931
```
30-
python -m pip install -U conan conan-package-tools
32+
python -m pip install -U conan packaging spdx-license-list tomli
3133
```
3234

33-
Now conan should be installed:
35+
On Linux, use:
3436
```
35-
conan --version
37+
pip3 install -U conan packaging spdx-license-list tomli pyelftools
3638
```
3739

38-
### Install MeVisLab Build Tool
39-
40-
`mbt`, the MeVisLab Build Tool, is a small wrapper for Conan and the Conan Package Tools.
41-
It mainly ensures that Conan is properly configured and initialized before invoking conan itself.
42-
43-
```
44-
python -m pip install -U git+http://gitlab.mevis.lokal/mevislab/mbt.git
45-
```
4640

4741
## Build a package
4842

49-
### Using mbt, conan-package-tools or conan
50-
51-
All wrappers (`mbt`, `conan-package-tools`) are just convenience.
52-
They make certain things easier, while making advanced things very difficult.
53-
That seems to be the nature of wrappers. Therefore it is always possible to
54-
work without these tools.
55-
56-
So a recipe can be built directly with `mbt`:
57-
43+
To build the debug and release versions of a package:
5844
```
5945
cd recipes/<recipe_name>
60-
mbt build
61-
```
62-
63-
_Note_: If you are building under Windows, have several Visual Studio versions installed and want to use _not_ the
64-
newest one, you have to set an environment variable with the desired version to communicate this to `mbt`:
65-
```
66-
SET CONAN_VISUAL_VERSIONS=16
46+
conan create -s build_type=Debug .
47+
conan create -s build_type=Release .
6748
```
6849

69-
Or using `conan-package-tools`:
50+
If you have the `conan-config` package installed (MeVisLab internal only, see README.md in the main MeVisLab directory), you can instead use:
7051
```
7152
cd recipes/<recipe_name>
72-
./build.py
53+
conan tp:build .
7354
```
55+
to build both the debug and release packages.
56+
7457

75-
Or using `conan`:
58+
To fetch the package sources (includes applying patches):
7659
```
7760
cd recipes/<recipe_name>
78-
conan create .
61+
conan source .
7962
```
8063

64+
8165
## Jenkins Integration
8266

8367
### Pipeline Description
84-
There are mainly two Jenkinsfiles that control the build of all thirdparty library and tools: Jenkinsfile and JenkinsfileLibrary. The first parses the `build_configuration.yml` and triggers the build of one tier after the other, starting with tier0. For further details see the chapter Build Configuration
68+
There are mainly two Jenkins files that control the build of all thirdparty libraries and tools: `Jenkinsfile` and `JenkinsfileLibrary` (both in the repository root). The first file parses `build_configuration.yml` and triggers the sequential build of all tiers, starting with tier0. For further details see the chapter _Build Configuration_.
8569

86-
The conan package system is written in a way that it checks if the package itself or one of its dependencies has been changed since the last successful build. If nothing has changed then the build and archiving step is been skipped.
87-
Since even this check takes a certain amount of time, an additional optimization has been implemented. All changed files are collected since the last successful build of the complete thirdparty/branch build. And only those directly affected projects and the tiers below are triggered to be rebuild. This shortens the build time enormously. If one of the files `Jenkinsfile`, `JenkinsfileLibrary`, or `build_configuration.yml` is part of any changeset, then this optimisation is skipped and all tiers with all projects are build.
70+
The conan package system is written in a way that it checks if the package itself or one of its dependencies has been changed since the last successful build. If nothing has changed, then the build and archiving step is skipped.
71+
Since even this check takes a certain amount of time, an additional optimization has been implemented. All changed files are collected since the last successful build of the complete thirdparty/branch build. And only those directly affected projects and the tiers below are triggered to be rebuild. This shortens the build time enormously. If one of the files `Jenkinsfile`, `JenkinsfileLibrary`, or `build_configuration.yml` is part of any changeset, then this optimization is skipped and all tiers with all projects are build.
8872

8973
### Build Configuration
90-
The build configuration is organised in the `build_configuration.yml` file. All libraries and tools that are needed to build MeVisLab are organised in this file. Since it very tedios and cumpersome to descripe smallest possible dependecy graph, the dependencies are broken down in different tiers. The content of the different tier is organised according to the dependencies of the individual libraries and tools. So if a e.g. a library A depends on an other library B, then B must be referenced in an one of the upper tiers.
74+
The build configuration is described in the `build_configuration.yml` file, which references all the libraries and tools needed to build MeVisLab.
75+
Organizing the dependencies can be very tedious and cumbersome, especially when attempting to describe the smallest possible dependency graph.
76+
To simplify this, dependencies are broken down into different tiers, with the content of each tier organized according to the dependencies of the individual libraries and tools.
77+
For instance, if library A depends on another library B, then B must be referenced in one of the upper tiers (e.g. a tier with a lower number).
9178

92-
The build of each library and tool for all specified platform and build types must finish in a defined time. There is a default, that is been used for all packages. In case that a certain package needs much more time, e.g. qt5, then there is the possibility to define a timeout exception.
79+
The build of each library and tool for all specified platforms and build types must finish within a defined time frame. There is a default timeout that is used for all packages.
80+
However, if a certain package requires significantly more time, there is the possibility to define a timeout exception.
9381

9482
These are the parameters that are defined in the file:
9583

9684
| Parameter | Description |
9785
| --------- | ------------|
98-
| timeout_default: | Default time in minutes for all not other specified packages. |
99-
| timeout_exception: | A map of all packages with their individual timeouts. |
100-
| tiers: | It must contain an ordered list of all tiers, starting with tier0 |
86+
| timeout_default: | Default time in minutes for all packages not specified otherwise |
87+
| timeout_exception: | A map of all packages with their individual timeouts |
88+
| tiers: | An ordered list of all tiers, starting with tier0 |

recipes/.conanignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

recipes/7zip/conanfile.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
from conan import ConanFile
2+
from conan.tools.files import copy, get, replace_in_file
3+
from conan.tools.layout import basic_layout
4+
from conan.tools.microsoft import NMakeToolchain
5+
from conans.errors import ConanInvalidConfiguration
6+
7+
required_conan_version = ">=2.2.2"
8+
9+
10+
class ConanRecipe(ConanFile):
11+
name = "7zip"
12+
version = "23.01"
13+
license = ("LGPL-2.1-or-later", "BSD-3-Clause")
14+
homepage = "https://www.7-zip.org"
15+
description = "7-Zip is a file archiver with a high compression ratio"
16+
settings = "os", "arch", "compiler", "build_type"
17+
package_type = "application"
18+
19+
def package_id(self):
20+
self.info.settings.rm_safe("build_type")
21+
self.info.settings.rm_safe("compiler.runtime_type")
22+
23+
def configure(self):
24+
if self.settings.os != "Windows":
25+
raise ConanInvalidConfiguration(f"{self.name} is only supported on Windows")
26+
27+
def validate(self):
28+
if self.settings.os != "Windows":
29+
raise ConanInvalidConfiguration(f"{self.name} is only supported on Windows")
30+
31+
def validate_build(self):
32+
if self.settings.build_type != "Release":
33+
raise ConanInvalidConfiguration(f"{self.name} is built in release mode only.")
34+
35+
def layout(self):
36+
basic_layout(self, src_folder="src")
37+
38+
def source(self):
39+
version = "".join(self.version.split("."))
40+
get(self,
41+
url=f"https://sourceforge.net/projects/sevenzip/files/7-Zip/{self.version}/7z{version}-src.tar.xz",
42+
sha256="356071007360e5a1824d9904993e8b2480b51b570e8c9faf7c0f58ebe4bf9f74")
43+
44+
def generate(self):
45+
tc = NMakeToolchain(self)
46+
tc.generate()
47+
48+
def build(self):
49+
make_file = self.source_path / "CPP" / "Build.mak"
50+
make_file.chmod(0o644)
51+
replace_in_file(self, make_file, "-MT", f"-{self.settings.compiler.runtime}")
52+
replace_in_file(self, make_file, "-MD", f"-{self.settings.compiler.runtime}")
53+
self.run(f"nmake /f makefile PLATFORM=x64", cwd=self.source_path / "CPP" / "7zip")
54+
55+
def package(self):
56+
copy(self, "License.txt", dst=self.package_path / "licenses", src=self.source_path / "DOC")
57+
copy(self, "unRarLicense.txt", dst=self.package_path / "licenses", src=self.source_path / "DOC")
58+
copy(self, "*/7z.exe", dst=self.package_path / "bin", src=self.source_path / "CPP" / "7zip", keep_path=False)
59+
copy(self, "*/7z.dll", dst=self.package_path / "bin", src=self.source_path / "CPP" / "7zip", keep_path=False)
60+
61+
def package_info(self):
62+
self.cpp_info.includedirs.clear()
63+
self.cpp_info.libdirs.clear()
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from conan import ConanFile
2+
from conan.tools.build import can_run
3+
4+
5+
class TestPackageConan(ConanFile):
6+
settings = "os", "arch", "compiler", "build_type"
7+
test_type = "explicit"
8+
9+
def build_requirements(self):
10+
self.tool_requires(self.tested_reference_str)
11+
12+
def test(self):
13+
if can_run(self):
14+
self.run("7z.exe --help")

recipes/abseil/conanfile.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
from conan import ConanFile
2+
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
3+
from conan.tools.files import copy, get, rmdir
4+
import os
5+
6+
required_conan_version = ">=2.2.2"
7+
8+
9+
class ConanRecipe(ConanFile):
10+
name = "abseil"
11+
version = "20240116.1"
12+
homepage = "https://abseil.io"
13+
description = "Collection of C++ libraries from Google"
14+
license = "Apache-2.0"
15+
settings = "os", "arch", "compiler", "build_type"
16+
exports_sources = "patches/*.patch"
17+
package_type = "static-library"
18+
19+
mlab_hooks = {"cmake_files.exclude": ["lib/cmake/*.cmake"]}
20+
21+
def layout(self):
22+
cmake_layout(self, src_folder="src")
23+
24+
def source(self):
25+
get(
26+
self,
27+
sha256="3c743204df78366ad2eaf236d6631d83f6bc928d1705dd0000b872e53b73dc6a",
28+
url=f"https://github.com/abseil/abseil-cpp/archive/refs/tags/{self.version}.tar.gz",
29+
strip_root=True,
30+
)
31+
32+
def generate(self):
33+
tc = CMakeToolchain(self)
34+
tc.variables["CMAKE_DEBUG_POSTFIX"] = "_d"
35+
tc.variables["BUILD_SHARED_LIBS"] = False
36+
tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = True
37+
tc.variables["ABSL_ENABLE_INSTALL"] = True
38+
tc.variables["ABSL_PROPAGATE_CXX_STD"] = True
39+
tc.variables["BUILD_TESTING"] = False
40+
tc.generate()
41+
42+
def build(self):
43+
cmake = CMake(self)
44+
cmake.configure()
45+
cmake.build()
46+
47+
def package(self):
48+
copy(self, pattern="LICENSE", src=self.source_path, dst=self.package_path / "licenses")
49+
cmake = CMake(self)
50+
cmake.install()
51+
rmdir(self, self.package_path / "lib" / "pkgconfig")
52+
53+
def package_info(self):
54+
self.cpp_info.builddirs.append(os.path.join("lib", "cmake"))
55+
self.cpp_info.set_property("cmake_find_mode", "none") # do NOT generate cmake files, they are generated by abseil
56+
self.cpp_info.set_property("cmake_file_name", "absl") # let CMake search for absl, not abseil (the package name)
57+
self.cpp_info.set_property(
58+
"cmake_target_name", "absl::base"
59+
) # let CMake link to absl::base, not abseil::abseil (derived from the package name)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
cmake_minimum_required(VERSION 3.27)
2+
project(test_package LANGUAGES CXX)
3+
4+
find_package(absl REQUIRED)
5+
6+
add_executable(test_package test_package.cpp)
7+
8+
target_link_libraries(test_package PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from conan import ConanFile
2+
from conan.tools.build import can_run
3+
from conan.tools.cmake import CMake, cmake_layout
4+
import os
5+
6+
7+
class TestPackage(ConanFile):
8+
settings = "os", "arch", "compiler", "build_type"
9+
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
10+
11+
def layout(self):
12+
cmake_layout(self)
13+
14+
def requirements(self):
15+
self.requires(self.tested_reference_str)
16+
17+
def build(self):
18+
cmake = CMake(self)
19+
cmake.configure()
20+
cmake.build()
21+
22+
def test(self):
23+
if can_run(self):
24+
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
25+
self.run(bin_path, env="conanrun")
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include <string>
2+
#include <utility>
3+
#include <iostream>
4+
#include <vector>
5+
6+
#include <absl/strings/str_cat.h>
7+
#include <absl/strings/str_split.h>
8+
#include <absl/container/flat_hash_map.h>
9+
#include <absl/container/flat_hash_set.h>
10+
#include <absl/numeric/int128.h>
11+
#include <absl/time/time.h>
12+
#include <absl/types/variant.h>
13+
14+
int main()
15+
{
16+
absl::Time t1 = absl::Now();
17+
absl::Time t2 = absl::Time();
18+
absl::Time t3 = absl::UnixEpoch();
19+
20+
absl::variant<int> v1 = absl::variant<int>();
21+
absl::bad_variant_access e1;
22+
23+
std::string const year = absl::FormatTime("%Y", absl::Now(), absl::UTCTimeZone());
24+
std::cout << "year " << year << std::endl;
25+
}

recipes/antt/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

recipes/antt/build.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)