Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CMakeLists.txt #2534

Closed
wants to merge 1 commit into from
Closed

Update CMakeLists.txt #2534

wants to merge 1 commit into from

Conversation

rbnpi
Copy link
Contributor

@rbnpi rbnpi commented Oct 31, 2020

Don't include ${PROJECT_SOURCE_DIR}/external_libs globally as it affects Linux builds. Instead add specifically for MSCV and APPLE only

Don't include ${PROJECT_SOURCE_DIR}/external_libs globally as it affects Linux builds. Instead add specifically for MSCV and APPLE only
Comment on lines 24 to +28
#set(oscpack_path ${PROJECT_SOURCE_DIR}/external_libs/oscpack_1_1_0)
#add_subdirectory(${oscpack_path})
include_directories( ${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts ${PROJECT_SOURCE_DIR}/external_libs)
#include_directories(${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts)
#don't include ${PROJECT_SOURCE_DIR}/external_libs globally as it affects linux builds where it is not wanted/ Add instead just for MSCV and APPLE builds
#include_directories( ${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts ${PROJECT_SOURCE_DIR}/external_libs)
include_directories(${PROJECT_SOURCE_DIR}/external_libs/spdlog-0.11.0/include JuceLibraryCode JuceLibraryCode/modules ${PROJECT_SOURCE_DIR}/external_libs/cxxopts)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rbnpi - any idea whether these commented lines were needed?
(The one explaining the omission of the external libs makes sense, but not sure the others are needed?) no idea 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left the commented stuff that was there already. I guess it could be removed. (look at the diff for my PR), There were two similar lines, one including ${PROJECT_SOURCE_DIR}/external_libs the other without it. I switches these lines around, and added the inclusion of ${PROJECT_SOURCE_DIR}/external_libs in existing if(MSCV) and if(APPLE) sections, where they were originally before it was tided up making this a global inclusion. However Linux builds with librtmidi-dev package installed didn't like this. The alternative would be to treat Linux the same, but to omit the package and the -dl rtmidi which links it in at the end of the CMakeList file. With thoughts of producing a .deb file (later), it is preferable to use the pakge than include it in the SP code.

Copy link
Contributor

@hfiguiere hfiguiere Nov 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without ${PROJECT_SOURCE_DIR}/external_libs it can't find the rtmidi headers. (on Linux - without rtmidi installed)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I will add that the CMakefile needs a few more changes:

diff --git a/app/gui/qt/external/sp_midi/CMakeLists.txt b/app/gui/qt/external/sp_midi/CMakeLists.txt
index 1b1bf6d4..860ded69 100644
--- a/app/gui/qt/external/sp_midi/CMakeLists.txt
+++ b/app/gui/qt/external/sp_midi/CMakeLists.txt
@@ -46,6 +47,11 @@ if(APPLE)
     add_definitions(-D__MACOSX_CORE__)
 endif(APPLE)
 
+if(UNIX)
+    list(APPEND sp_midi_sources ${PROJECT_SOURCE_DIR}/external_libs/rtmidi/RtMidi.cpp)
+    add_definitions(-D__LINUX_ALSA__)
+endif(UNIX)
+
 if(APPLE)
     set(juce_sources
         JuceLibraryCode/include_juce_core.mm
@@ -87,6 +93,6 @@ elseif(APPLE)
     target_link_libraries(libsp_midi "-framework CoreMIDI -framework CoreAudio -framework CoreFoundation -framework Accelerate -framework QuartzCore -framework AudioToolbox -framework IOKit -framework DiscRecording -framework Cocoa")
 elseif(UNIX)
     add_definitions(-DLINUX=1 -DNDEBUG=1 -DJUCER_LINUX_MAKE_6D53C8B4=1 -DJUCE_APP_VERSION=1.0.0 -DJUCE_APP_VERSION_HEX=0x10000)
-    target_link_libraries(libsp_midi pthread ${ALSA_LIBRARY} dl rtmidi)
+    target_link_libraries(libsp_midi pthread ${ALSA_LIBRARY} dl)
 endif(MSVC)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have submitted #2542 for that. I'm not sure why Linux should be an exception here.

@@ -38,11 +39,13 @@ set(sp_midi_sources

if(MSVC)
list(APPEND sp_midi_sources ${PROJECT_SOURCE_DIR}/external_libs/rtmidi/RtMidi.cpp)
include_directories(${PROJECT_SOURCE_DIR}/external_libs)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good

@samaaron samaaron deleted the branch sonic-pi-net:main October 18, 2021 10:58
@samaaron samaaron closed this Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants