Skip to content
Merged
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
144 changes: 50 additions & 94 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,75 @@ cmake_minimum_required(VERSION 3.22)

project(kAmp VERSION 0.0.1)

# To get started on a new GUI app, copy this entire folder (containing this file and C++ sources) to
# a convenient location, and then start making modifications. For other examples of CMakeLists for
# GUI apps, check `extras/Projucer` and `examples/DemoRunner` in the JUCE repo.

# If you've installed JUCE somehow (via a package manager, or directly using the CMake install
# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
# include that subdirectory as part of the build.

# find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
# or
add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE

# If your app depends the VST2 SDK, perhaps to host VST2 plugins, CMake needs to be told where
# to find the SDK on your system. This setup should be done before calling `juce_add_gui_app`.

# juce_set_vst2_sdk_path(...)

# `juce_add_gui_app` adds an executable target with the name passed as the first argument
# (GuiAppExample here). This target is a normal CMake target, but has a lot of extra properties set
# up by default. This function accepts many optional arguments. Check the readme at
# `docs/CMake API.md` in the JUCE repo for the full list.
# If you've installed JUCE to your system
# find_package(JUCE CONFIG REQUIRED)
# or if JUCE is a subdirectory
add_subdirectory(JUCE)

juce_add_gui_app(kAmp
# ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon
# ICON_SMALL ...
# DOCUMENT_EXTENSIONS ... # Specify file extensions that should be associated with this app
BUNDLE_ID = "eu.k-147.kAmp"
COMPANY_NAME "K-147"
PRODUCT_NAME "kAmp"
ICON_BIG "resources/images/kamp_logo_with_background.png"
ICON_SMALL "resources/images/kamp_logo_with_background.png")
BUNDLE_ID "eu.k-147.kAmp"
COMPANY_NAME "K-147"
PRODUCT_NAME "kAmp"
ICON_BIG "resources/images/kamp_logo_with_background.png"
ICON_SMALL "resources/images/kamp_logo_with_background.png"
)

juce_generate_juce_header(kAmp)

# `target_sources` adds source files to a target. We pass the target that needs the sources as the
# first argument, then a visibility parameter for the sources which should normally be PRIVATE.
# Finally, we supply a list of source files that will be built into the target. This is a standard
# CMake command.

file(
GLOB_RECURSE
SOURCES
CONFIGURE_DEPENDS
src/*.cpp
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)

juce_add_binary_data(ResourcesBinary
SOURCES
resources/images/background.png
resources/images/kamp_logo_with_background.png
resources/icons/account.png
resources/icons/export.png
resources/icons/mute.png
resources/icons/power.png
resources/icons/settings.png
resources/icons/sync.png
resources/icons/unmute.png
resources/icons/xmark.png
resources/icons/tuner.png
)

if(APPLE)
# Sur macOS, copie dans le bundle app (Contents/Resources)
add_custom_command(TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
$<TARGET_FILE_DIR:kAmp>/../Resources/resources
)
else()
# Sur Linux/Windows, copie dans le dossier de build à côté de l'exe
add_custom_command(TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/resources
$<TARGET_FILE_DIR:kAmp>/resources
)
endif()

target_include_directories(kAmp PRIVATE "${CMAKE_BINARY_DIR}/juce_binarydata_ResourcesBinary/JuceLibraryCode")

file(GLOB_RECURSE RESOURCE_FILES "${CMAKE_SOURCE_DIR}/resources/*.*")

foreach(RESOURCE_FILE IN LISTS RESOURCE_FILES)
file(RELATIVE_PATH REL_PATH "${CMAKE_SOURCE_DIR}/resources" "${RESOURCE_FILE}")
set(DEST_PATH "${CMAKE_BINARY_DIR}/resources/${REL_PATH}")
add_custom_command(
TARGET kAmp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${RESOURCE_FILE}" "${DEST_PATH}"
)
endforeach()

target_sources(kAmp
PRIVATE
${SOURCES})

target_include_directories(kAmp
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_sources(kAmp PRIVATE ${SOURCES})

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
# of compile definitions to switch certain features on/off, so if there's a particular feature you
# need that's not on by default, check the module header for the correct flag to set here. These
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.
target_include_directories(kAmp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_compile_definitions(kAmp
PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_gui_app` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call
# JUCE_IOS=1
PRIVATE
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
#JUCE_IOS=1
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:kAmp,JUCE_PRODUCT_NAME>"
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:kAmp,JUCE_VERSION>")

# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
# `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
# the SOURCES argument should be followed by a list of source files that should be built into the
# static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
# Conversion to binary-data will happen when your target is built.

# juce_add_binary_data(GuiAppData SOURCES ...)

# `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
# we're linking our executable target to the `juce::juce_gui_extra` module. Inter-module
# dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:kAmp,JUCE_VERSION>"
)

target_link_libraries(kAmp
PRIVATE
# GuiAppData # If we'd created a binary data target, we'd link to it here
PRIVATE
juce::juce_audio_basics
juce::juce_audio_utils
juce::juce_gui_extra
juce::juce_dsp
PUBLIC
ResourcesBinary
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
juce::juce_recommended_warning_flags
)


2 changes: 1 addition & 1 deletion JUCE
Submodule JUCE updated 1450 files
75 changes: 70 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,85 @@
- `CMake` version 3.21 or higher
- `C++` compiler with at least support for C++17 (C++20 is recommended)

### Generators
### Steps

#### Clone the repository

>Our project includes the JUCE framwework as a git submodule. You will have to use some submodule commands.

```bash
git clone https://github.com/k147-studio/kAmp.git
git submodule init
git submodule update
```

#### Install dependencies

JUCE requires a few packages that are not always installed by default on all platforms.

__Linux__

>You can find the below commands on JUCE repository via this [link](https://github.com/juce-framework/JUCE/blob/master/docs/Linux%20Dependencies.md).

```bash
# Install a C++ compiler
sudo apt update
sudo apt install g++
# Or
sudo apt install clang

# Package dependencies
sudo apt update
sudo apt install libasound2-dev libjack-jackd2-dev ladspa-sdk libcurl4-openssl-dev libfreetype-dev libfontconfig1-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev libwebkit2gtk-4.1-dev libglu1-mesa-dev mesa-common-dev
```

__MacOS and Windows__

>Please refer to JUCE documentation and forum if you're missing dependencies.

#### Compile the project

>On every platform, we recommand to use CLion IDE which is very easy to use when it comes to CMake.

__Configure CMake on CLion__

Depending on your platform, you can use different generators. Here are some examples:
CLion basically handles CMake pretty good natively. It will advise you about the parameters needed so there shouldn't be any problem.

![CMake settings](documentation/images/cmake_settings.png)

On __Linux__, the defaults settings should make the job.

On __MacOS__ and __Windows__, you'll have to choose the generator that will be used to compile C++. You can relate to the list below :
- `Xcode` on macOS
- `Unix Makefiles` on Linux
- `Visual Studio 17 2022` on Windows

### Steps

__Create CMake Build Profile__

On the top-right toolbar in CLion, clik on the build menu then select "Edit Configurations".

![Build menu](documentation/images/build_menu.png)

Then click on "+" and select "CMake Application".

![Build choice](documentation/images/select_build_type.png)

You should have this window :

![Build settings](documentation/images/build_settings.png)

After that, as __Target__, select "All targets".

On __Linux__, this should be enough; if it is not the case, try to set the __CMakeLists.txt__ file at the repository root as the __Executable__.

If it still doesn't work or you are using another platform than linux, please refer to JetBrains official [CMake documentation](https://www.jetbrains.com/help/clion/quick-cmake-tutorial.html).

Here is an example of how to build the project using `Xcode` on macOS:

``bash
```bash
mkdir build
cd build
cmake .. -G "Xcode"
cmake --build .
``
```
Binary file added documentation/images/build_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/images/build_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/images/cmake_settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added documentation/images/select_build_type.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions include/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MainComponent final : public AudioAppComponent {

private:


ImageComponent backgroundImage;

/**
Expand Down
14 changes: 6 additions & 8 deletions src/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ MainComponent::MainComponent(const Manager& manager):
topMenuBarComponent(this->deviceManager, &isSoundMuted, &tuningFunction), manager(manager) {
setAudioChannels(2, 2);

const Image background = ResourceManager::loadImage("resources/images/background.png");
if (background.isValid()) {
backgroundImage.setImage(background);
backgroundImage.setImagePlacement(RectanglePlacement::stretchToFit);
addAndMakeVisible(backgroundImage);
} else {
DBG("Error : resources/images/background.png not found.");
}

juce::Image img = juce::ImageFileFormat::loadFrom(BinaryData::background_png, BinaryData::background_pngSize);
backgroundImage.setImage(img);

pedalboardContainer.setViewedComponent(&pedalboardComponent, true);
pedalboardContainer.setScrollBarsShown(true, false);

addAndMakeVisible(backgroundImage);
addAndMakeVisible(pedalboardContainer);
addAndMakeVisible(topMenuBarComponent);
addAndMakeVisible(bottomMenuBarComponent);
Expand Down Expand Up @@ -69,3 +65,5 @@ void MainComponent::getNextAudioBlock(const AudioSourceChannelInfo &bufferToFill
}

void MainComponent::releaseResources() {}


Loading