Transforms a JUCE jucer file (XML) into a CMakeLists.txt file.
If the JUCE paths are missing from the filesystem, it will add external JUCE project with targeted version.
Usage
joel@hammer:~/git/jucer2cmake/build$ ./jucer2cmake -i ~/git/cabbage/CabbageIDE.jucer
Opening "/home/joel/git/cabbage/CabbageIDE.jucer"
Path not present: /home/joel/git/cabbage/../JUCE/modules
Configured to download JUCE
Using Linux Config
Using VS2019 Config
Created "/home/joel/git/cabbage/CMakeLists.txt"
Output
################################################
#
# This file was auto-generated by jucer2cmake:
# https://github.com/jwinarske/jucer2cmake
#
################################################
cmake_minimum_required(VERSION 3.11)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug, Release, or MinSizeRel." FORCE)
message(STATUS "CMAKE_BUILD_TYPE not set, defaulting to Release.")
endif()
project(Cabbage LANGUAGES CXX C)
message(STATUS "Generator .............. ${CMAKE_GENERATOR}")
message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}")
message(STATUS "AppVersion ............. 2.3.0")
if(NOT JUCE_ROOT)
set(JUCE_ROOT ${CMAKE_CURRENT_BINARY_DIR}/juce)
include(ExternalProject)
ExternalProject_Add(juce
GIT_REPOSITORY https://github.com/WeAreROLI/JUCE.git
GIT_TAG 5.4.4
GIT_SHALLOW 1
BUILD_IN_SOURCE 0
SOURCE_DIR ${JUCE_ROOT}
PATCH_COMMAND ""
UPDATE_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
endif()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_definitions(
JUCE_APP_VERSION=2.3.0
JUCE_APP_VERSION_HEX=0x020300
JucePlugin_Build_VST=0
JucePlugin_Build_VST3=0
JucePlugin_Build_AU=0
JucePlugin_Build_AUv3=0
JucePlugin_Build_RTAS=0
JucePlugin_Build_AAX=0
JucePlugin_Build_Standalone=0
JucePlugin_Build_Unity=0
)
include_directories(
JuceLibraryCode
${JUCE_ROOT}/modules
)
file(GLOB JUCE_LIBRARY_CODE_CPP RELATIVE ${CMAKE_SOURCE_DIR} CONFIGURE_DEPENDS JuceLibraryCode/*.cpp)
set(SRC_FILES
Source/Cabbage.cpp
Source/Application/FileTab.cpp
Source/Application/CabbageMainComponent.cpp
Source/Application/CabbageDocumentWindow.cpp
Source/Application/CabbageToolbarFactory.cpp
Source/BinaryData/CabbageBinaryData.cpp
Source/CodeEditor/CabbageCodeEditor.cpp
Source/CodeEditor/CabbageEditorContainer.cpp
Source/CodeEditor/JavascriptCodeTokeniser.cpp
Source/GUIEditor/CabbagePropertiesPanel.cpp
Source/GUIEditor/ComponentLayoutEditor.cpp
Source/GUIEditor/ComponentOverlay.cpp
Source/LookAndFeel/CabbageGenericPluginLookAndFeel.cpp
Source/LookAndFeel/CabbageIDELookAndFeel.cpp
Source/LookAndFeel/CabbageLookAndFeel2.cpp
Source/LookAndFeel/FlatButtonLookAndFeel.cpp
Source/LookAndFeel/PropertyPanelLookAndFeel.cpp
Source/Settings/CabbageSettings.cpp
Source/Settings/CabbageSettingsWindow.cpp
Source/Utilities/CabbagePluginList.cpp
Source/Utilities/CabbageExportPlugin.cpp
Source/Utilities/CabbageColourProperty.cpp
Source/Utilities/CabbageNewProjectWindow.cpp
Source/Utilities/CabbageSSHFileBrowser.cpp
Source/Widgets/CabbageRackWidgets.cpp
Source/Widgets/CabbageKeyboardDisplay.cpp
Source/Widgets/CabbageListBox.cpp
Source/Widgets/CabbageButton.cpp
Source/Widgets/CabbageNumberSlider.cpp
Source/Widgets/CabbageCheckbox.cpp
Source/Widgets/CabbageComboBox.cpp
Source/Widgets/CabbageCsoundConsole.cpp
Source/Widgets/CabbageCustomWidgets.cpp
Source/Widgets/CabbageEncoder.cpp
Source/Widgets/CabbageFileButton.cpp
Source/Widgets/CabbageGenTable.cpp
Source/Widgets/CabbageGroupBox.cpp
Source/Widgets/CabbageImage.cpp
Source/Widgets/CabbageInfoButton.cpp
Source/Widgets/CabbageKeyboard.cpp
Source/Widgets/CabbageLabel.cpp
Source/Widgets/CabbageRangeSlider.cpp
Source/Widgets/CabbageSignalDisplay.cpp
Source/Widgets/CabbageSlider.cpp
Source/Widgets/CabbageSoundfiler.cpp
Source/Widgets/CabbageEventSequencer.cpp
Source/Widgets/CabbageTextBox.cpp
Source/Widgets/CabbageTextEditor.cpp
Source/Widgets/CabbageWidgetBase.cpp
Source/Widgets/CabbageWidgetData.cpp
Source/Widgets/CabbageWidgetDataInitMethods.cpp
Source/Widgets/CabbageWidgetDataTextMethods.cpp
Source/Widgets/CabbageXYPad.cpp
Source/Audio/Filters/FilterGraph.cpp
Source/Audio/Filters/FilterIOConfiguration.cpp
Source/Audio/Filters/InternalFilters.cpp
Source/Audio/Plugins/CabbageInternalPluginFormat.cpp
Source/Audio/Plugins/CabbagePluginEditor.cpp
Source/Audio/Plugins/CabbagePluginProcessor.cpp
Source/Audio/Plugins/CsoundPluginEditor.cpp
Source/Audio/Plugins/CsoundPluginProcessor.cpp
Source/Audio/Plugins/GenericCabbageEditor.cpp
Source/Audio/Plugins/GenericCabbagePluginProcessor.cpp
Source/Audio/UI/GraphEditorPanel.cpp
Source/Widgets/Legacy/Soundfiler.cpp
Source/Widgets/Legacy/TableManager.cpp
)
add_executable(Cabbage ${SRC_FILES} ${JUCE_LIBRARY_CODE_CPP})
add_dependencies(Cabbage juce)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
target_compile_options(Cabbage PUBLIC -flto)
target_link_options(Cabbage PUBLIC -flto)
elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(Cabbage PUBLIC -fsanitize=address -fno-omit-frame-pointer)
target_link_options(Cabbage PUBLIC -fsanitize=address)
endif()
endif()
if(UNIX)
if(CYGWIN)
elseif(APPLE)
elseif(ANDROID)
else()
include(FindPkgConfig)
pkg_check_modules(JUCE_LIBS REQUIRED alsa x11 xinerama xext freetype2 webkit2gtk-4.0 gtk+-x11-3.0 libcurl)
target_include_directories(Cabbage PUBLIC
${JUCE_LIBS_INCLUDE_DIRS}
"/usr/local/include/csound"
"/usr/include/csound"
"~/SDKs/VST_SDK/VST3_SDK"
)
target_link_directories(Cabbage BEFORE PUBLIC
"/usr/local/lib"
)
target_link_libraries(Cabbage
csound64
sndfile
${JUCE_LIBS_LIBRARIES}
rt dl pthread GL
)
endif()
elseif(MSVC)
target_include_directories(Cabbage PUBLIC
"C:\Program Files\Csound6_x64\include\csound"
"C:\SDKs\ASIOSDK2.3.2\common"
)
target_compile_options(Cabbage PUBLIC
Cabbage_IDE_Build=1
MSVC=1
CABBAGE=1
)
target_link_directories(Cabbage BEFORE PUBLIC
"C:\Program Files\Csound6_x64\lib"
)
target_link_libraries(Cabbage
csound64.lib
)
endif()