diff --git a/README.md b/README.md index 33619b9a..24dd8485 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ If you want to build it statically-linked, pass the `AXIOM_STATIC_LINK` flag: ``` cmake ../path/to/source -DAXIOM_STATIC_LINK=ON -DVST2_SDK_ROOT=/path/to/vst/sdk ``` +For static linking on macOS [compile Qt statically](http://doc.qt.io/qt-5/osx-deployment.html) and install HarfBuzz, libpng and PCRE2: +``` +brew install harfbuzz libpng pcre2 +``` CMake will setup files necessary for building. If this fails, make sure you've got Cargo, Qt, LLVM, and the VST SDK installed correctly. Once complete, you can choose which backend to build: diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 99b8716e..5396eb23 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -4,7 +4,16 @@ if (AXIOM_STATIC_LINK) set(Qt5_USE_STATIC_LIBS ON) set(Qt5_USE_STATIC_RUNTIME ON) add_definitions(-DAXIOM_STATIC_BUILD=1) - set(AXIOM_LINK_FLAGS -static -static-libgcc -static-libstdc++) + + find_library(OpenGL_LIBRARY OpenGL) + set(STATIC_LIBS ${OpenGL_LIBRARY}) + + if (APPLE) + set(AXIOM_LINK_FLAGS "") + else () + set(AXIOM_LINK_FLAGS -static -static-libgcc -static-libstdc++) + endif () + else () set(AXIOM_LINK_FLAGS "") endif () @@ -36,6 +45,38 @@ add_library(axiom_editor backend/AudioConfiguration.h backend/AudioConfiguration.cpp backend/PersistentParameters.h) target_link_libraries(axiom_editor axiom_widgets axiom_model axiom_common maxim_compiler Qt5::Widgets) +if (AXIOM_STATIC_LINK) + if (APPLE) + FIND_PACKAGE(PNG REQUIRED) + list(APPEND STATIC_LIBS PNG::PNG) + + FIND_PACKAGE(harfbuzz REQUIRED) + list(APPEND STATIC_LIBS harfbuzz::harfbuzz) + + list(APPEND STATIC_LIBS /usr/local/Cellar/pcre2/10.32/lib/libpcre2-16.a) + + find_library(QTFREETYPE NAMES qtfreetype) + set_target_properties(Qt5::Core PROPERTIES INTERFACE_LINK_LIBRARIES "${QTFREETYPE}") + + list(APPEND STATIC_LIBS /usr/local/Qt-5.11.2/lib/libQt5AccessibilitySupport.a + /usr/local/Qt-5.11.2/lib/libQt5ClipboardSupport.a + /usr/local/Qt-5.11.2/lib/libQt5FontDatabaseSupport.a + /usr/local/Qt-5.11.2/lib/libQt5GraphicsSupport.a + /usr/local/Qt-5.11.2/lib/libQt5ThemeSupport.a) + + find_package(Qt5Svg REQUIRED) + find_package(Qt5PrintSupport REQUIRED) + list(APPEND AXIOM_LINK_FLAGS -lcups) # CUPS printer interface + find_package(Qt5OpenGL REQUIRED) + qt5_use_modules(axiom_editor PrintSupport) + list(APPEND STATIC_LIBS Qt5::Core Qt5::QCocoaIntegrationPlugin + Qt5::QCocoaPrinterSupportPlugin Qt5::OpenGL Qt5::Svg) + target_link_libraries(axiom_editor "-framework Carbon" "-framework CoreFoundation" "-framework CoreServices" "-framework CoreText" "-framework Cocoa" "-framework QuartzCore" "-framework IOKit" "-framework Security") + + target_link_libraries(axiom_editor ${STATIC_LIBS}) + + endif () +endif () add_subdirectory(backend) diff --git a/editor/widgets/node/SyntaxHighlighter.cpp b/editor/widgets/node/SyntaxHighlighter.cpp index ae607c81..c01a7933 100644 --- a/editor/widgets/node/SyntaxHighlighter.cpp +++ b/editor/widgets/node/SyntaxHighlighter.cpp @@ -23,8 +23,9 @@ class CachedHighlightRules { // control formatting HighlightRule controlRule; controlRule.pattern = QRegExp(R"(:(num|num\[\]|midi|midi\[\]|graph|roll|scope)\b)"); - controlRule.format.setForeground(QColor(234, 106, 89)); // red - controlRule.format.setFontWeight(QFont::Bold); + // TODO Uncomment all the *Rule.format.set* . They do not work with static linking on macOS + //controlRule.format.setForeground(QColor(234, 106, 89)); // red + //controlRule.format.setFontWeight(QFont::Bold); highlightRules.push_back(std::move(controlRule)); // function formatting @@ -36,27 +37,27 @@ class CachedHighlightRules { } HighlightRule functionRule; functionRule.pattern = QRegExp(R"(\b()" % list.join('|') % R"()\b)"); - functionRule.format.setForeground(QColor(123, 181, 247)); // blue - functionRule.format.setFontWeight(QFont::Bold); + //functionRule.format.setForeground(QColor(123, 181, 247)); // blue + //functionRule.format.setFontWeight(QFont::Bold); highlightRules.push_back(std::move(functionRule)); // number formatting HighlightRule numberRule; numberRule.pattern = QRegExp(R"(\b([0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?)\s*[kmgt]?\s*(hz|db|q|s|b)?\b)", Qt::CaseInsensitive); - numberRule.format.setForeground(QColor(193, 127, 226)); // purple - numberRule.format.setFontWeight(QFont::Bold); + //numberRule.format.setForeground(QColor(193, 127, 226)); // purple + //numberRule.format.setFontWeight(QFont::Bold); highlightRules.push_back(std::move(numberRule)); // form formatting HighlightRule formRule; formRule.pattern = QRegExp(R"(\b(none|control|osc|note|freq|beats|secs|samples|db|amp|q)\b)"); - formRule.format.setForeground(QColor(101, 216, 105)); // green - formRule.format.setFontWeight(QFont::Bold); + //formRule.format.setForeground(QColor(101, 216, 105)); // green + //formRule.format.setFontWeight(QFont::Bold); highlightRules.push_back(std::move(formRule)); - commentFormat.setForeground(QColor(121, 121, 121)); // grey - commentFormat.setFontWeight(QFont::StyleItalic); + //commentFormat.setForeground(QColor(121, 121, 121)); // grey + //commentFormat.setFontWeight(QFont::StyleItalic); // comment (single line) formatting HighlightRule commentRule;