Skip to content

Commit dc7e4d4

Browse files
jcelerierclaude
andcommitted
fix: addon-scope static CRT (Windows/Max) + complete ui in the class header
- Set CMAKE_MSVC_RUNTIME_LIBRARY at the top of the addon so the object library and every back-end external share the /MT runtime the Max external needs (mixing /MT and /MD trips MSVC LNK2038). - Include UI.hpp from the class header so <Class>::ui is a complete type for the score plugin generator (it includes the class header, not the MAIN_FILE, and needs the full ui to build the process layer). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 3797e79 commit dc7e4d4

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
22

33
project(MyProcessor CXX)
44

5+
# Max/MSP externals link the static CRT (/MT) on Windows, as the official
6+
# max-sdk-base requires. Set it for the whole addon -- before Avendish and the
7+
# object library are created -- so every target shares one runtime; mixing /MT
8+
# and /MD trips MSVC with LNK2038. (CMP0091 is NEW via cmake_minimum_required.)
9+
if(MSVC)
10+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
11+
endif()
12+
513
# Use the Avendish the host already provides (e.g. ossia score); otherwise fetch it.
614
# The same CMakeLists builds this as an ossia/score add-on or as a standalone object.
715
find_package(Avendish QUIET)

src/Model.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ inline void MyProcessor::operator()(int N)
5454
}
5555
}
5656
}
57+
58+
// Pull in the UI so MyProcessor::ui is complete wherever this class header is
59+
// included -- the score plugin generator includes the class header, not the
60+
// MAIN_FILE, and needs the full ui type to build the process's layer.
61+
#include "UI.hpp"

0 commit comments

Comments
 (0)