Birch-san / juicysfplugin

Audio plugin (e.g. VST, AU) to play soundfonts on macOS, Windows, Linux
GNU General Public License v3.0
209 stars 27 forks source link

Mac build from source: No global header file was included #46

Open kmturley opened 1 year ago

kmturley commented 1 year ago

Following instructions from the README:

git clone https://github.com/Birch-san/juicysfplugin.git
open juicysfplugin/Builds/MacOSX/juicysfplugin.xcodeproj

Then building in Xcode I get:

/Applications/JUCE/modules/juce_core/system/juce_TargetPlatform.h:56:3: "No global header file was included!"
Screen Shot 2022-09-09 at 4 20 19 PM

Searching the code this option appears to be there: https://github.com/Birch-san/juicysfplugin/blob/master/JuceLibraryCode/AppConfig.h#L64

What could be the issue?

Birch-san commented 1 year ago

oh, those instructions are out-of-date now. as of https://github.com/Birch-san/juicysfplugin/pull/32, I stopped using the xcodeproj and build it with CMake instead.

to develop it, I open the juicysfplugin folder with Visual Studio Code, and the C/C++ extension installed.

my c_cpp_properties.json looks like this:

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                // "${workspaceFolder}/Source",
                "/Users/birch/git/juicysfplugin/build/JuicySFPlugin_artefacts/JuceLibraryCode",
                "/Users/birch/juicydeps/include/JUCE-6.1.4/modules",
                "/Users/birch/juicydeps/include",
                "/opt/homebrew/Cellar/glib/2.70.2/include",
                "/opt/homebrew/Cellar/glib/2.70.2/include/glib-2.0",
                "/opt/homebrew/Cellar/glib/2.70.2/lib/glib-2.0/include",
                "/opt/homebrew/opt/gettext/include",
                "/opt/homebrew/Cellar/pcre/8.45/include",
                "/opt/homebrew/Cellar/libsndfile/1.0.31/include",
                "/opt/homebrew/Cellar/flac/1.3.3/include",
                "/opt/homebrew/Cellar/libvorbis/1.3.7/include",
                "/opt/homebrew/Cellar/libogg/1.3.5/include",
                "/opt/homebrew/Cellar/opus/1.3.1/include/opus"
                // "/Users/birch/git/JUCE/modules"
            ],
            "defines": [
                "DEBUG=1",
                // "JUCE_CORE_INCLUDE_OBJC_HELPERS=1",
                "DONT_SET_USING_JUCE_NAMESPACE=1",
                "JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_basics=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_devices=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_formats=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_plugin_client=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_processors=1",
                "JUCE_MODULE_AVAILABLE_juce_audio_utils=1",
                "JUCE_MODULE_AVAILABLE_juce_core=1",
                "JUCE_MODULE_AVAILABLE_juce_data_structures=1",
                "JUCE_MODULE_AVAILABLE_juce_events=1",
                "JUCE_MODULE_AVAILABLE_juce_graphics=1",
                "JUCE_MODULE_AVAILABLE_juce_gui_basics=1",
                "JUCE_MODULE_AVAILABLE_juce_gui_extra=1",
                "JUCE_STANDALONE_APPLICATION=JucePlugin_Build_Standalone",
                "JUCE_USE_CURL=0",
                "JUCE_VST3_CAN_REPLACE_VST2=1",
                "JUCE_WEB_BROWSER=0",
                "JucePlugin_AAXCategory=2048",
                "JucePlugin_AAXDisableBypass=0",
                "JucePlugin_AAXDisableMultiMono=0",
                "JucePlugin_AAXIdentifier=com.Birchlabs.JuicySFPlugin",
                "JucePlugin_AAXManufacturerCode=JucePlugin_ManufacturerCode",
                "JucePlugin_AAXProductId=JucePlugin_PluginCode",
                "JucePlugin_AUExportPrefix=juicysfpluginAU",
                "JucePlugin_AUExportPrefixQuoted=\"juicysfpluginAU\"",
                "JucePlugin_AUMainType=\"'aumu'\"",
                "JucePlugin_AUManufacturerCode=JucePlugin_ManufacturerCode",
                "JucePlugin_AUSubType=JucePlugin_PluginCode",
                "JucePlugin_Build_AAX=0",
                "JucePlugin_Build_AU=0",
                "JucePlugin_Build_AUv3=0",
                "JucePlugin_Build_Standalone=0",
                "JucePlugin_Build_Unity=0",
                "JucePlugin_Build_VST3=1",
                "JucePlugin_Build_VST=0",
                "JucePlugin_CFBundleIdentifier=com.Birchlabs.JuicySFPlugin",
                "JucePlugin_Desc=\"Audio plugin to play soundfonts\"",
                "JucePlugin_EditorRequiresKeyboardFocus=1",
                "JucePlugin_IsMidiEffect=0",
                "JucePlugin_IsSynth=1",
                "JucePlugin_Manufacturer=\"Birchlabs\"",
                "JucePlugin_ManufacturerCode=0x426c6273",
                "JucePlugin_ManufacturerEmail=\"\"",
                "JucePlugin_ManufacturerWebsite=\"birchlabs.co.uk\"",
                "JucePlugin_Name=\"juicysfplugin\"",
                "JucePlugin_PluginCode=0x4a736670",
                "JucePlugin_ProducesMidiOutput=0",
                "JucePlugin_VSTCategory=kPlugCategSynth",
                "JucePlugin_VSTNumMidiInputs=16",
                "JucePlugin_VSTNumMidiOutputs=16",
                "JucePlugin_VSTUniqueID=JucePlugin_PluginCode",
                "JucePlugin_Version=3.0.0",
                "JucePlugin_VersionCode=0x30000",
                "JucePlugin_VersionString=\"3.0.0\"",
                "JucePlugin_Vst3Category=\"Instrument|Synth\"",
                "JucePlugin_WantsMidiInput=1",
                "JuicySFPlugin_VST3_EXPORTS",
                "_DEBUG=1"
            ],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

and I compile it using cmake, like so:
https://github.com/Birch-san/juicysfplugin/blob/master/building.macos.md

Apparently I have a launch.json to build the .app using CMake:

{
    "tasks": [
        {
            "type": "shell",
            "label": "CMake build juicysfplugin Standalone",
            "command": "cmake",
            "args": [
                "--build",
                "build",
                "--target",
                "JuicySFPlugin_Standalone"
            ],
            "options": {
                "cwd": "${workspaceFolder}"
            }
        }
    ],
    "version": "2.0.0"
}

But that looks like it just runs a shell command, so probably the CMake extension has an idiom that can build with a bit more IDE integration.

kmturley commented 1 year ago

Ah ok, should the Xcode files and instructions be removed then?

I created c_cpp_properties.json and launch.json files, updating the configuration to point to my versions of libraries. Then tried compiling using VSCode, but I get an error.

[cmake] CMake Error at CMakeLists.txt:28 (find_package):
[cmake]   Could not find a package configuration file provided by "JUCE" with any of
[cmake]   the following names:
[cmake] 
[cmake]     JUCEConfig.cmake
[cmake]     juce-config.cmake

I believe that's because in the command line version you are passing the DEPS path: PKG_CONFIG_PATH="$HOME/juicydeps/lib64/pkgconfig;$(brew --prefix)/lib/pkgconfig" cmake -B build -DCMAKE_PREFIX_PATH="$HOME/juicydeps;$(brew --prefix)" -DCMAKE_BUILD_TYPE=Release

My guess is that the launch.json would needed additional values such as:

{
  "tasks": [
      {
          "type": "shell",
          "label": "CMake build juicysfplugin Standalone",
          "command": "cmake",
          "args": [
              "--build",
              "build",
              "-DCMAKE_PREFIX_PATH='$HOME/juicydeps;$(brew --prefix)'",
              "-DCMAKE_BUILD_TYPE=Release",
              "--target",
              "JuicySFPlugin_Standalone"
          ],
          "options": {
              "cwd": "${workspaceFolder}"
          },
          "env": {
            "PKG_CONFIG_PATH": "$HOME/juicydeps/lib64/pkgconfig;$(brew --prefix)/lib/pkgconfig"
          }
      }
  ],
  "version": "2.0.0"
}

But I couldn't get it to work using a launch.json :( I don't think either the Xcode or VSCode build from source instructions are working!