Skip to content

Commit b3e8a76

Browse files
Add CI files
1 parent 6cac216 commit b3e8a76

File tree

3 files changed

+283
-2
lines changed

3 files changed

+283
-2
lines changed

.github/workflows/build.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: MEView
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
env:
9+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
10+
BUILD_TYPE: Release
11+
12+
# for matrix check https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners
13+
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+
23+
cross-platform-build:
24+
name: Cross platform build
25+
needs: prepare_matrix
26+
# The CMake configure and build commands are platform agnostic and should work equally
27+
# well on Windows or Mac. You can convert this to a matrix build if you need
28+
# cross-platform coverage.
29+
# See: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
30+
runs-on: ${{ matrix.os }}
31+
strategy:
32+
matrix:
33+
include: ${{ fromJson(needs.prepare_matrix.outputs.matrix) }}
34+
35+
steps:
36+
- name: Checkout the source
37+
uses: actions/checkout@v4
38+
with:
39+
submodules: recursive
40+
ref: ${{ github.event.pull_request.head.ref }}
41+
42+
- name: Select Xcode for Mac only
43+
if: startsWith(runner.os, 'macOS')
44+
run: |
45+
sudo xcode-select -switch /Applications/Xcode_${{matrix.build-xcode-version}}.app
46+
47+
- name: Setup python version
48+
uses: actions/setup-python@v5
49+
with:
50+
python-version: "3.11"
51+
52+
- name: Start ssh key agent
53+
uses: webfactory/[email protected]
54+
with:
55+
ssh-private-key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
56+
57+
- name: Install SSH deploy key for rulessupport
58+
uses: shimataro/ssh-key-action@v2
59+
with:
60+
key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
61+
known_hosts: github.com AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
62+
63+
- name: Windows build
64+
if: startsWith(runner.os, 'Windows')
65+
uses: ManiVaultStudio/github-actions/conan_windows_build@main
66+
with:
67+
conan-visual-version: ${{matrix.build-cversion}}
68+
conan-visual-runtime: ${{matrix.build-runtime}}
69+
conan-build-type: ${{matrix.build-config}}
70+
conan-user: ${{secrets.LKEB_UPLOAD_USER}}
71+
conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}}
72+
conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}}
73+
rs_ssh_key: ${{ secrets.RULESSUPPORT_DEPLOY_KEY }}
74+
75+
- name: Linux build
76+
if: startsWith(matrix.os, 'ubuntu')
77+
uses: ManiVaultStudio/github-actions/conan_linuxmac_build@main
78+
with:
79+
conan-compiler: ${{matrix.build-compiler}}
80+
conan-compiler-version: ${{matrix.build-cversion}}
81+
conan-libcxx-version: ${{matrix.build-libcxx}}
82+
conan-build-type: ${{matrix.build-config}}
83+
conan-build-os: ${{matrix.build-os}}
84+
build-arch: ${{matrix.build-arch}}
85+
conan-user: ${{secrets.LKEB_UPLOAD_USER}}
86+
conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}}
87+
conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}}
88+
conan-cc: gcc-${{matrix.build-cversion}}
89+
conan-cxx: g++-${{matrix.build-cversion}}
90+
91+
- name: Mac build
92+
if: startsWith(matrix.os, 'macos')
93+
uses: ManiVaultStudio/github-actions/conan_linuxmac_build@main
94+
with:
95+
conan-compiler: ${{matrix.build-compiler}}
96+
conan-compiler-version: ${{matrix.build-cversion}}
97+
conan-libcxx-version: ${{matrix.build-libcxx}}
98+
conan-build-type: ${{matrix.build-config}}
99+
conan-build-os: ${{matrix.build-os}}
100+
build-arch: ${{matrix.build-arch}}
101+
conan-user: ${{secrets.LKEB_UPLOAD_USER}}
102+
conan-password: ${{secrets.LKEB_UPLOAD_USER_PASSWORD}}
103+
conan-pem: ${{secrets.LKEB_UPLOAD_CERT_CHAIN}}

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ endif(MSVC)
2222
# -----------------------------------------------------------------------------
2323
# Dependencies
2424
# -----------------------------------------------------------------------------
25+
if(NOT DEFINED MV_CMD_INSTALL_DIR)
26+
set(MV_CMD_INSTALL_DIR ${ManiVault_INSTALL_DIR} CACHE PATH "Directory where CellMorphologyData is installed")
27+
endif()
28+
29+
if(NOT DEFINED MV_EPD_INSTALL_DIR)
30+
set(MV_EPD_INSTALL_DIR ${ManiVault_INSTALL_DIR} CACHE PATH "Directory where EphysData is installed")
31+
endif()
32+
2533
#find_package(OpenSSL REQUIRED)
2634
find_package(Qt6 COMPONENTS Widgets WebEngineWidgets OpenGLWidgets REQUIRED)
2735

@@ -103,6 +111,8 @@ add_library(${PROJECT_NAME} SHARED ${PLUGIN_SOURCES} ${RENDER_SOURCES} ${EPHYS_S
103111
target_include_directories(${PROJECT_NAME} PRIVATE "${ManiVault_INCLUDE_DIR}")
104112
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/src")
105113
#target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/3rdparty/curl/include/")
114+
target_include_directories(${PROJECT_NAME} PRIVATE "${MV_CMD_INSTALL_DIR}/$<CONFIGURATION>/include/")
115+
target_include_directories(${PROJECT_NAME} PRIVATE "${MV_EPD_INSTALL_DIR}/$<CONFIGURATION>/include/")
106116

107117

108118
# -----------------------------------------------------------------------------
@@ -129,10 +139,12 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Network)
129139
# to adapt the MV_LINK_PATH and PLUGIN_LINK_PATH to your install folder
130140
set(MV_LINK_PATH "${ManiVault_INSTALL_DIR}/$<CONFIGURATION>/lib")
131141
set(PLUGIN_LINK_PATH "${ManiVault_INSTALL_DIR}/$<CONFIGURATION>/$<IF:$<CXX_COMPILER_ID:MSVC>,lib,Plugins>")
142+
set(CMDPLUGIN_LINK_PATH "${MV_CMD_INSTALL_DIR}/$<CONFIGURATION>/$<IF:$<CXX_COMPILER_ID:MSVC>,lib,Plugins>")
143+
set(EPDPLUGIN_LINK_PATH "${MV_EPD_INSTALL_DIR}/$<CONFIGURATION>/$<IF:$<CXX_COMPILER_ID:MSVC>,lib,Plugins>")
132144
set(MV_LINK_SUFFIX $<IF:$<CXX_COMPILER_ID:MSVC>,${CMAKE_LINK_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>)
133145

134-
set(CELL_MORPHOLOGY_DATA_LINK_LIBRARY "${PLUGIN_LINK_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CellMorphologyData${MV_LINK_SUFFIX}")
135-
set(EPHYS_DATA_LINK_LIBRARY "${PLUGIN_LINK_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}EphysData${MV_LINK_SUFFIX}")
146+
set(CELL_MORPHOLOGY_DATA_LINK_LIBRARY "${CMDPLUGIN_LINK_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}CellMorphologyData${MV_LINK_SUFFIX}")
147+
set(EPHYS_DATA_LINK_LIBRARY "${EPDPLUGIN_LINK_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}EphysData${MV_LINK_SUFFIX}")
136148

137149
# Link to ManiVault and data plugins
138150
target_link_libraries(${PROJECT_NAME} PRIVATE ManiVault::Core)

conanfile.py

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
from conans import ConanFile
2+
from conan.tools.cmake import CMakeDeps, CMake, CMakeToolchain
3+
from conans.tools import save, load
4+
import os
5+
import pathlib
6+
import subprocess
7+
from rules_support import PluginBranchInfo
8+
9+
class MEViewConan(ConanFile):
10+
"""Class to package using conan
11+
12+
Packages both RELEASE and RELWITHDEBINFO.
13+
Uses rules_support (github.com/ManiVaultStudio/rulessupport) to derive
14+
versioninfo based on the branch naming convention
15+
as described in https://github.com/ManiVaultStudio/core/wiki/Branch-naming-rules
16+
"""
17+
18+
name = "MEView"
19+
description = """Viewer of cell morphology data and associated ephys traces."""
20+
topics = ("manivault", "plugin", "view", "morphology", "ephys")
21+
url = "https://github.com/ManiVaultStudio/MEView"
22+
author = "[email protected]" # conan recipe author
23+
license = "LGPL 3.0"
24+
25+
short_paths = True
26+
generators = "CMakeDeps"
27+
28+
# Options may need to change depending on the packaged library
29+
settings = {"os": None, "build_type": None, "compiler": None, "arch": None}
30+
options = {"shared": [True, False], "fPIC": [True, False]}
31+
default_options = {"shared": True, "fPIC": True}
32+
33+
# Data plugin dependencies
34+
requires = ("CellMorphologyData/bican_bg@lkeb/stable", "EphysData/bican_bg@lkeb/stable")
35+
36+
# Qt requirement is inherited from hdps-core
37+
38+
scm = {
39+
"type": "git",
40+
"subfolder": "hdps/MEView",
41+
"url": "auto",
42+
"revision": "auto",
43+
}
44+
45+
def __get_git_path(self):
46+
path = load(
47+
pathlib.Path(pathlib.Path(__file__).parent.resolve(), "__gitpath.txt")
48+
)
49+
print(f"git info from {path}")
50+
return path
51+
52+
def export(self):
53+
print("In export")
54+
# save the original source path to the directory used to build the package
55+
save(
56+
pathlib.Path(self.export_folder, "__gitpath.txt"),
57+
str(pathlib.Path(__file__).parent.resolve()),
58+
)
59+
60+
def set_version(self):
61+
# Assign a version from the branch name
62+
branch_info = PluginBranchInfo(self.recipe_folder)
63+
self.version = branch_info.version
64+
# print(f"Got version: {self.version}")
65+
66+
def requirements(self):
67+
branch_info = PluginBranchInfo(self.__get_git_path())
68+
print(f"Core requirement {branch_info.core_requirement}")
69+
self.requires(branch_info.core_requirement)
70+
71+
def configure(self):
72+
pass
73+
74+
def system_requirements(self):
75+
# May be needed for macOS or Linux
76+
pass
77+
78+
def config_options(self):
79+
if self.settings.os == "Windows":
80+
del self.options.fPIC
81+
82+
def generate(self):
83+
generator = None
84+
if self.settings.os == "Macos":
85+
generator = "Xcode"
86+
if self.settings.os == "Linux":
87+
generator = "Ninja Multi-Config"
88+
89+
tc = CMakeToolchain(self, generator=generator)
90+
91+
tc.variables["CMAKE_CXX_STANDARD_REQUIRED"] = "ON"
92+
93+
# Use the Qt provided .cmake files
94+
qt_path = pathlib.Path(self.deps_cpp_info["qt"].rootpath)
95+
qt_cfg = list(qt_path.glob("**/Qt6Config.cmake"))[0]
96+
qt_dir = qt_cfg.parents[0].as_posix()
97+
98+
tc.variables["Qt6_DIR"] = qt_dir
99+
100+
# Use the ManiVault .cmake file to find ManiVault with find_package
101+
mv_core_root = self.deps_cpp_info["hdps-core"].rootpath
102+
manivault_dir = pathlib.Path(mv_core_root, "cmake", "mv").as_posix()
103+
print("ManiVault_DIR: ", manivault_dir)
104+
tc.variables["ManiVault_DIR"] = manivault_dir
105+
106+
# Give the installation directory to CMake
107+
MV_CMD_PATH = pathlib.Path(self.deps_cpp_info["CellMorphologyData"].rootpath).as_posix()
108+
tc.variables["MV_CMD_INSTALL_DIR"] = MV_CMD_PATH
109+
110+
MV_EPD_PATH = pathlib.Path(self.deps_cpp_info["EphysData"].rootpath).as_posix()
111+
tc.variables["MV_EPD_INSTALL_DIR"] = MV_EPD_PATH
112+
113+
# Set some build options
114+
tc.variables["MV_UNITY_BUILD"] = "ON"
115+
116+
tc.generate()
117+
118+
def _configure_cmake(self):
119+
cmake = CMake(self)
120+
cmake.configure(build_script_folder="hdps/MEView")
121+
cmake.verbose = True
122+
return cmake
123+
124+
def build(self):
125+
print("Build OS is: ", self.settings.os)
126+
127+
cmake = self._configure_cmake()
128+
cmake.build(build_type="RelWithDebInfo")
129+
cmake.build(build_type="Release")
130+
131+
def package(self):
132+
package_dir = pathlib.Path(self.build_folder, "package")
133+
relWithDebInfo_dir = package_dir / "RelWithDebInfo"
134+
release_dir = package_dir / "Release"
135+
print("Packaging install dir: ", package_dir)
136+
subprocess.run(
137+
[
138+
"cmake",
139+
"--install",
140+
self.build_folder,
141+
"--config",
142+
"RelWithDebInfo",
143+
"--prefix",
144+
relWithDebInfo_dir,
145+
]
146+
)
147+
subprocess.run(
148+
[
149+
"cmake",
150+
"--install",
151+
self.build_folder,
152+
"--config",
153+
"Release",
154+
"--prefix",
155+
release_dir,
156+
]
157+
)
158+
self.copy(pattern="*", src=package_dir)
159+
160+
def package_info(self):
161+
self.cpp_info.relwithdebinfo.libdirs = ["RelWithDebInfo/lib"]
162+
self.cpp_info.relwithdebinfo.bindirs = ["RelWithDebInfo/Plugins", "RelWithDebInfo"]
163+
self.cpp_info.relwithdebinfo.includedirs = ["RelWithDebInfo/include", "RelWithDebInfo"]
164+
self.cpp_info.release.libdirs = ["Release/lib"]
165+
self.cpp_info.release.bindirs = ["Release/Plugins", "Release"]
166+
self.cpp_info.release.includedirs = ["Release/include", "Release"]

0 commit comments

Comments
 (0)