Skip to content

Commit 4e85a83

Browse files
committed
Update cmake and CI
1 parent 7f467f4 commit 4e85a83

3 files changed

Lines changed: 69 additions & 81 deletions

File tree

.github/workflows/build.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,43 @@ env:
1111

1212
# for matrix check https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners
1313
jobs:
14+
prepare_matrix:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
matrix: ${{ steps.matrix_setup.outputs.matrix }}
18+
steps:
19+
- name: Get matrix from file
20+
id: matrix_setup
21+
uses: ManiVaultStudio/github-actions/matrix_setup@main
22+
with:
23+
matrix_ids : 'windows_2022 linux_gcc13 macos_code14'
24+
1425
cross-platform-build:
1526
name: Cross platform build
27+
needs: prepare_matrix
1628
# The CMake configure and build commands are platform agnostic and should work equally
1729
# well on Windows or Mac. You can convert this to a matrix build if you need
1830
# cross-platform coverage.
1931
# See: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
2032
runs-on: ${{ matrix.os }}
2133
strategy:
2234
matrix:
23-
include:
24-
- name: Windows-msvc2019
25-
os: windows-2019
26-
compiler: msvc-2019
27-
build-cversion: 16
28-
build-runtime: MD
29-
build-config: Release
30-
31-
- name: Linux_gcc11
32-
os: ubuntu-22.04
33-
build-cc: gcc
34-
build-cxx: g++
35-
build-compiler: gcc
36-
build-cversion: 11
37-
build-config: Release
38-
build-os: Linux
39-
build-libcxx: libstdc++
40-
41-
- name: Macos_xcode13.4
42-
os: macos-12
43-
build-compiler: apple-clang
44-
build-cversion: 13
45-
build-config: Release
46-
build-os: Macos
47-
build-xcode-version: 13.4
48-
build-libcxx: libc++
35+
include: ${{ fromJson(needs.prepare_matrix.outputs.matrix) }}
4936

5037
steps:
5138
- name: Checkout the source
52-
uses: actions/checkout@v2
39+
if: github.event_name != 'pull_request'
40+
uses: actions/checkout@v4
41+
with:
42+
submodules: recursive
43+
fetch-depth: 0
44+
45+
- name: Checkout the source - pull request
46+
if: github.event_name == 'pull_request'
47+
uses: actions/checkout@v4
5348
with:
5449
submodules: recursive
50+
fetch-depth: 0
5551
ref: ${{ github.event.pull_request.head.ref }}
5652

5753
- name: Select Xcode for Mac only
@@ -60,12 +56,12 @@ jobs:
6056
sudo xcode-select -switch /Applications/Xcode_${{matrix.build-xcode-version}}.app
6157
6258
- name: Setup python version
63-
uses: actions/setup-python@v1
59+
uses: actions/setup-python@v5
6460
with:
6561
python-version: "3.11"
6662

6763
- name: Start ssh key agent
68-
uses: webfactory/ssh-agent@v0.7.0
64+
uses: webfactory/ssh-agent@v0.9.0
6965
with:
7066
ssh-private-key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
7167

@@ -96,6 +92,7 @@ jobs:
9692
conan-libcxx-version: ${{matrix.build-libcxx}}
9793
conan-build-type: ${{matrix.build-config}}
9894
conan-build-os: ${{matrix.build-os}}
95+
build-arch: ${{matrix.build-arch}}
9996
conan-user: ${{secrets.LKEB_UPLOAD_USER}}
10097
conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}}
10198
conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}}

CMakeLists.txt

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.17.0)
1+
cmake_minimum_required(VERSION 3.22.0)
22

33
# -----------------------------------------------------------------------------
44
# Volume Viewer Plugin
@@ -16,8 +16,8 @@ set(CMAKE_AUTOUIC ON)
1616

1717
if(MSVC)
1818
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DWIN32 /EHsc /MP /permissive- /Zc:__cplusplus")
19-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG /NODEFAULTLIB:LIBCMT")
2019
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
20+
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
2121
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
2222
endif(MSVC)
2323

@@ -26,9 +26,7 @@ endif(MSVC)
2626
# -----------------------------------------------------------------------------
2727
find_package(OpenGL REQUIRED)
2828
find_package(Qt6 COMPONENTS Core Widgets WebEngineWidgets Xml OpenGL OpenGLWidgets REQUIRED)
29-
find_package(OpenMP)
30-
31-
find_package(ManiVault COMPONENTS Core PointData ClusterData ImageData CONFIG)
29+
find_package(ManiVault COMPONENTS Core PointData ClusterData ImageData CONFIG QUIET)
3230

3331
# -----------------------------------------------------------------------------
3432
# Source files
@@ -104,7 +102,7 @@ target_include_directories(${PROJECT} PRIVATE src)
104102
# -----------------------------------------------------------------------------
105103
# Target properties
106104
# -----------------------------------------------------------------------------
107-
target_compile_features(${PROJECT} PRIVATE cxx_std_17)
105+
target_compile_features(${PROJECT} PRIVATE cxx_std_20)
108106

109107
# -----------------------------------------------------------------------------
110108
# Target library linking
@@ -146,6 +144,6 @@ set_target_properties(${PROJECT}
146144
# -----------------------------------------------------------------------------
147145
# Automatically set the debug environment (command + working directory) for MSVC
148146
if(MSVC)
149-
set_property(TARGET ${PROJECT} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY $<IF:$<CONFIG:DEBUG>,${ManiVault_INSTALL_DIR}/debug,${ManiVault_INSTALL_DIR}/release>)
150-
set_property(TARGET ${PROJECT} PROPERTY VS_DEBUGGER_COMMAND $<IF:$<CONFIG:DEBUG>,"${ManiVault_INSTALL_DIR}/debug/ManiVault Studio.exe","${ManiVault_INSTALL_DIR}/release/ManiVault Studio.exe">)
147+
set_property(TARGET ${PROJECT} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY $<IF:$<CONFIG:DEBUG>,${ManiVault_INSTALL_DIR}/Debug,$<IF:$<CONFIG:RELWITHDEBINFO>,${ManiVault_INSTALL_DIR}/RelWithDebInfo,${ManiVault_INSTALL_DIR}/Release>>)
148+
set_property(TARGET ${PROJECT} PROPERTY VS_DEBUGGER_COMMAND $<IF:$<CONFIG:DEBUG>,"${ManiVault_INSTALL_DIR}/Debug/ManiVault Studio.exe",$<IF:$<CONFIG:RELWITHDEBINFO>,"${ManiVault_INSTALL_DIR}/RelWithDebInfo/ManiVault Studio.exe","${ManiVault_INSTALL_DIR}/Release/ManiVault Studio.exe">>)
151149
endif()

conanfile.py

Lines changed: 37 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
class VolumeViewer(ConanFile):
1212
"""Class to package the plugin using conan
1313
14-
Packages both RELEASE and DEBUG.
15-
Uses rules_support (github.com/hdps/rulessupport) to derive
14+
Packages both RELEASE and RELWITHDEBINFO.
15+
Uses rules_support (github.com/ManiVaultStudio/rulessupport) to derive
1616
versioninfo based on the branch naming convention
1717
as described in https://github.com/ManiVaultStudio/core/wiki/Branch-naming-rules
1818
"""
@@ -42,10 +42,13 @@ class VolumeViewer(ConanFile):
4242
}
4343

4444
def __get_git_path(self):
45-
path = load(
46-
pathlib.Path(pathlib.Path(__file__).parent.resolve(), "__gitpath.txt")
47-
)
48-
print(f"git info from {path}")
45+
if pathlib.Path(".git").exists():
46+
path = pathlib.Path.cwd()
47+
else:
48+
path = load(
49+
pathlib.Path(pathlib.Path(__file__).parent.resolve(), "__gitpath.txt")
50+
)
51+
print(f"Loaded path {path}")
4952
return path
5053

5154
def export(self):
@@ -84,25 +87,26 @@ def generate(self):
8487
generator = "Xcode"
8588
if self.settings.os == "Linux":
8689
generator = "Ninja Multi-Config"
90+
91+
tc = CMakeToolchain(self, generator=generator)
92+
93+
tc.variables["CMAKE_CXX_STANDARD_REQUIRED"] = "ON"
94+
8795
# Use the Qt provided .cmake files
88-
qtpath = pathlib.Path(self.deps_cpp_info["qt"].rootpath)
89-
qt_root = str(list(qtpath.glob("**/Qt6Config.cmake"))[0].parents[3].as_posix())
96+
qt_path = pathlib.Path(self.deps_cpp_info["qt"].rootpath)
97+
qt_cfg = list(qt_path.glob("**/Qt6Config.cmake"))[0]
98+
qt_dir = qt_cfg.parents[0].as_posix()
9099

91-
tc = CMakeToolchain(self, generator=generator)
92-
if self.settings.os == "Windows" and self.options.shared:
93-
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
94-
if self.settings.os == "Linux" or self.settings.os == "Macos":
95-
tc.variables["CMAKE_CXX_STANDARD_REQUIRED"] = "ON"
96-
tc.variables["CMAKE_PREFIX_PATH"] = qt_root
100+
tc.variables["Qt6_DIR"] = qt_dir
97101

98-
# Set the installation directory for ManiVault based on the MV_INSTALL_DIR environment variable
99-
# or if none is specified, set it to the build/install dir.
100-
if not os.environ.get("MV_INSTALL_DIR", None):
101-
os.environ["MV_INSTALL_DIR"] = os.path.join(self.build_folder, "install")
102-
print("MV_INSTALL_DIR: ", os.environ["MV_INSTALL_DIR"])
103-
self.install_dir = pathlib.Path(os.environ["MV_INSTALL_DIR"]).as_posix()
104-
# Give the installation directory to CMake
105-
tc.variables["MV_INSTALL_DIR"] = self.install_dir
102+
# Use the ManiVault .cmake file to find ManiVault with find_package
103+
mv_core_root = self.deps_cpp_info["hdps-core"].rootpath
104+
manivault_dir = pathlib.Path(mv_core_root, "cmake", "mv").as_posix()
105+
print("ManiVault_DIR: ", manivault_dir)
106+
tc.variables["ManiVault_DIR"] = manivault_dir
107+
108+
# Set some build options
109+
tc.variables["MV_UNITY_BUILD"] = "ON"
106110

107111
tc.generate()
108112

@@ -113,33 +117,26 @@ def _configure_cmake(self):
113117
return cmake
114118

115119
def build(self):
116-
print("Build OS is : ", self.settings.os)
117-
118-
# The BinNIO plugins expect the HDPS package to be in this install dir
119-
hdps_pkg_root = self.deps_cpp_info["hdps-core"].rootpath
120-
print("Install dir type: ", self.install_dir)
121-
shutil.copytree(hdps_pkg_root, self.install_dir)
120+
print("Build OS is: ", self.settings.os)
122121

123122
cmake = self._configure_cmake()
124-
cmake.build(build_type="Debug")
125-
cmake.install(build_type="Debug")
126-
127-
# cmake_release = self._configure_cmake()
123+
cmake.build(build_type="RelWithDebInfo")
128124
cmake.build(build_type="Release")
129-
cmake.install(build_type="Release")
130125

131126
def package(self):
132-
package_dir = os.path.join(self.build_folder, "package")
127+
package_dir = pathlib.Path(self.build_folder, "package")
128+
relWithDebInfo_dir = package_dir / "RelWithDebInfo"
129+
release_dir = package_dir / "Release"
133130
print("Packaging install dir: ", package_dir)
134131
subprocess.run(
135132
[
136133
"cmake",
137134
"--install",
138135
self.build_folder,
139136
"--config",
140-
"Debug",
137+
"RelWithDebInfo",
141138
"--prefix",
142-
os.path.join(package_dir, "Debug"),
139+
relWithDebInfo_dir,
143140
]
144141
)
145142
subprocess.run(
@@ -150,19 +147,15 @@ def package(self):
150147
"--config",
151148
"Release",
152149
"--prefix",
153-
os.path.join(package_dir, "Release"),
150+
release_dir,
154151
]
155152
)
156153
self.copy(pattern="*", src=package_dir)
157-
# Add the debug support files to the package
158-
# (*.pdb) if building the Visual Studio version
159-
if self.settings.compiler == "Visual Studio":
160-
self.copy("*.pdb", dst="Debug/Plugins", keep_path=False)
161154

162155
def package_info(self):
163-
self.cpp_info.debug.libdirs = ["Debug/lib"]
164-
self.cpp_info.debug.bindirs = ["Debug/Plugins", "Debug"]
165-
self.cpp_info.debug.includedirs = ["Debug/include", "Debug"]
156+
self.cpp_info.relwithdebinfo.libdirs = ["RelWithDebInfo/lib"]
157+
self.cpp_info.relwithdebinfo.bindirs = ["RelWithDebInfo/Plugins", "RelWithDebInfo"]
158+
self.cpp_info.relwithdebinfo.includedirs = ["RelWithDebInfo/include", "RelWithDebInfo"]
166159
self.cpp_info.release.libdirs = ["Release/lib"]
167160
self.cpp_info.release.bindirs = ["Release/Plugins", "Release"]
168161
self.cpp_info.release.includedirs = ["Release/include", "Release"]

0 commit comments

Comments
 (0)