Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Static build on Mac building but not running #149

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
43 changes: 42 additions & 1 deletion editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 ()
Expand Down Expand Up @@ -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)

Expand Down
21 changes: 11 additions & 10 deletions editor/widgets/node/SyntaxHighlighter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand Down