Add Linux build support (development)#1
Conversation
Make the CMake build cross-platform so ScopeOne builds and runs on Linux (demo camera), while leaving the Windows build path unchanged. All platform-specific logic is guarded behind if(WIN32)/else(). - ScopeOneCore/CMakeLists.txt: Linux branch uses system Qt6, OpenCV (core+imgproc only, avoiding the viz/VTK chain), TIFF and ZLIB via find_package, and links MMCore as an imported static library built from mmCoreAndDevices. - CMakeLists.txt: guard the hardcoded Windows Qt prefix path. - RecordingManager.cpp: give TiffOptions an explicit constructor instead of default member initializers (GCC rejects the brace-default argument). - ScopeOneLocalApiServer.cpp: guard the Win32 CreateFileMapping/ MapViewOfFile frame export behind _WIN32; the local API socket still works on Linux (zero-copy frame export is a follow-up).
|
Hi! Thank you for this PR. This is very helpful, and the direction makes sense to me. I tested the current code on Windows, and the Windows build still compiles successfully on my side. Linux build support for the demo camera and future CI would be very valuable. For the The follow-ups you listed all make sense. For local API frame export, I would prefer moving toward I appreciate the contribution. Thank you very much! |
Motivation
I came across ScopeOne, and out of curiosity tried building it on Linux. Beyond
the curiosity, cross-platform builds make a project meaningfully easier to
develop on and contribute to — even if production stays on Windows. The
encouraging part is that the hard work is already done: the multi-process core is
built on Qt's cross-platform primitives (
QProcess,QSharedMemory,QLocalServer), so very little of the runtime is actually Windows-specific. Thegap was mostly the build system plus a couple of small spots.
This PR makes ScopeOne build and run on Linux with the demo camera, while
leaving the Windows build path untouched.
What's in this PR (4 files, +74/−39)
Everything platform-specific is guarded behind
if(WIN32)/else()so the Windowsbuild is unchanged:
ScopeOneCore/CMakeLists.txt— Linux branch resolves deps viafind_package(system Qt6, OpenCV [core+imgproconly, to avoid theviz→VTK chain], TIFF, ZLIB) and links MMCore as an imported static librarybuilt from
mmCoreAndDevices.CMakeLists.txt— guard the hardcodedC:/Qt/...prefix so it'sWindows-only.
ScopeOneCore/src/RecordingManager.cpp— giveSaveBackend::TiffOptionsan explicit constructor instead of default member initializers; GCC rejects
= {}as a default argument for the nested aggregate (MSVC accepts it).Behavior unchanged.
src/ScopeOneLocalApiServer.cpp— guard the Win32CreateFileMapping/MapViewOfFileframe export behind#if defined(_WIN32).The local API socket server still runs on Linux; only the zero-copy shared-frame
export is disabled for now (see follow-ups).
Building the Micro-Manager dependency
I built only the minimal pieces from
mmCoreAndDevices(no vendor adapters) viathe standard autotools path:
This yields
libMMCore.a,libMMDevice.a, andlibmmgr_dal_DemoCamera.so.0(no boost or swig required). Then the usual ScopeOne build, pointing the core
CMake at that checkout via
external/mmCoreAndDevices.Verification
config/MMConfig_demo.cfgandsnapImage()returns a 512×512 16-bit frame.
preserve it, but someone with a Windows setup should confirm.
Scope / non-goals
expected for Micro-Manager.
Known follow-ups (happy to do these if useful)
AgentProtocol.hhardcodesScopeOne_Agent.exe; needs a platform-aware name on Linux. The single-camerademo uses the native path and is unaffected.
shm_open/mmap(orQSharedMemory) so external clients get zero-copy frameson Linux too.
.sonext to the binary inCMake instead of copying it manually.
Questions for maintainers
now?
mmCoreAndDevicesdependency wired on Linux(find-or-fetch in CMake, documented manual build, submodule)? I followed the
existing
external/layout but kept it flexible.Thanks for open-sourcing this — it's a clean codebase to work in.