commit 0e92655f0124a8dda83c8f11f7c406356f1c6925
parent 6c127c360a86633fdc5d8b4ea340bb1157112cb0
Author: Harald Hvaal <[email protected]>
Date: Wed, 24 Jun 2009 22:24:16 +0900
Cherrypick from experimental, general cleanup of cmake code. rename zynaddsubfxgui -> zynaddsubfx, separate qt/fltk build
Conflicts:
src/CMakeLists.txt
src/NewUI/masterui.C
src/NewUI/masterui.h
Diffstat:
15 files changed, 135 insertions(+), 132 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -2,6 +2,4 @@
cmake_minimum_required(VERSION 2.6)
project(zynaddsubfx)
-#set(lib_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib)
-
add_subdirectory(src)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -1,13 +1,23 @@
-FIND_PACKAGE(Qt4)
-INCLUDE(${QT_USE_FILE})
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
-
-#settings. These cache variables can be changed before compile
-#in CMakeCache.txt
+######### Settings ###########
+# NOTE: These cache variables should normallly not be changed in this
+# file, but either in in CMakeCache.txt before compile, or by passing
+# parameters directly into cmake using the -D flag.
SET (FFTW_VERSION 3 CACHE STRING "Version number of FFTW")
SET (OutputModule jack CACHE STRING "Output module, either alsa, jack or portaudio")
-set (WANT_FLTK ON)
-
+SET (GuiModule fltk CACHE STRING "GUI module, either fltk, qt or off")
+
+# Now, handle the incoming settings and set define flags/variables based
+# on this
+
+if (GuiModule STREQUAL qt)
+ set (QtGui TRUE)
+elseif(GuiModule STREQUAL fltk)
+ set (FltkGui TRUE)
+elseif(GuiModule STREQUAL off)
+ add_definitions(-DDISABLE_GUI)
+else ()
+ message(FATAL_ERROR "GUI module must be either fltk, qt or off")
+endif()
if (OutputModule STREQUAL alsa)
set(AlsaMidiOutput TRUE)
@@ -19,9 +29,12 @@ else ()
message(FATAL_ERROR "OutputModule must be either alsa, jack or portaudio")
endif()
-message(STATUS "OutputModule set to ${OutputModule}")
+########### Settings dependant code ###########
+# From here on, the setting variables have been prepared so concentrate
+# on the actual compiling.
+
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
-# setting dependent stuff
if(AlsaMidiOutput)
FIND_PACKAGE(Alsa)
add_definitions(-DOSSAUDIOOUT)
@@ -46,7 +59,7 @@ add_definitions(-DFFTW_VERSION_${FFTW_VERSION}
)
- if(WANT_FLTK) # Check for FLTK
+if(FltkGui) # Check for FLTK
find_package(FLTK REQUIRED)
# message(STATUS "FLTK_LIBRARIES: ${FLTK_LIBRARIES}")
# message("FLTK_MATH_LIBRARY: ${FLTK_MATH_LIBRARY}")
@@ -62,26 +75,33 @@ add_definitions(-DFFTW_VERSION_${FFTW_VERSION}
mark_as_advanced(FORCE FLTK_INCLUDE_DIR)
mark_as_advanced(FORCE FLTK_MATH_LIBRARY)
- set(FLTK_LIBRARIES
+
+ set(GUI_LIBRARIES
${FLTK_BASE_LIBRARY} ${FLTK_MATH_LIBRARY} ${FLTK_FORMS_LIBRARY}
${FLTK_IMAGES_LIBRARY} ${FLTK_GL_LIBRARY}
- )
- add_definitions(-DWANT_GUI)
- message(STATUS "will build gui")
+ zynaddsubfx_gui
+ )
+ add_definitions(-DFLTK_GUI)
+
+ message(STATUS "Will build fltk gui")
+
+ add_subdirectory(UI)
endif()
+########### General section ##############
+# Following this should be only general compilation code, and no mention
+# of module-specific variables
+
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/NewUI
- ${CMAKE_CURRENT_SOURCE_DIR}/NewUI)
+ )
add_subdirectory(Misc)
add_subdirectory(Input)
add_subdirectory(Output)
add_subdirectory(Controls)
-#add_subdirectory(NewUI)
add_subdirectory(Synth)
add_subdirectory(Seq)
add_subdirectory(Effects)
@@ -90,26 +110,25 @@ add_subdirectory(DSP)
add_subdirectory(UI)
add_subdirectory(Samples)
-set(zynaddsubfxgui_SRCS
- #main.cpp
+set(zynaddsubfx_SRCS
main.C
)
-add_executable(zynaddsubfxgui
- ${zynaddsubfxgui_SRCS}
+add_executable(zynaddsubfx
+ ${zynaddsubfx_SRCS}
)
-target_link_libraries(zynaddsubfxgui
- zynaddsubfxgui_input
- zynaddsubfxgui_output
- zynaddsubfxgui_misc
- zynaddsubfxgui_synth
- zynaddsubfxgui_seq
- zynaddsubfxgui_effect
- zynaddsubfxgui_params
- zynaddsubfxgui_dsp
- zynaddsubfxgui_samples
- zynaddsubfxgui_controls
- ${FLTK_LIBRARIES}
- zynaddsubfxguilib)
+target_link_libraries(zynaddsubfx
+ zynaddsubfx_input
+ zynaddsubfx_output
+ zynaddsubfx_misc
+ zynaddsubfx_synth
+ zynaddsubfx_seq
+ zynaddsubfx_effect
+ zynaddsubfx_params
+ zynaddsubfx_dsp
+ zynaddsubfx_samples
+ zynaddsubfx_controls
+ ${GUI_LIBRARIES}
+ )
diff --git a/src/Controls/CMakeLists.txt b/src/Controls/CMakeLists.txt
@@ -1,8 +1,8 @@
-set(zynaddsubfxgui_controls_SRCS
+set(zynaddsubfx_controls_SRCS
Control.C
DelayCtl.C
)
-add_library(zynaddsubfxgui_controls STATIC
- ${zynaddsubfxgui_controls_SRCS}
+add_library(zynaddsubfx_controls STATIC
+ ${zynaddsubfx_controls_SRCS}
)
diff --git a/src/DSP/CMakeLists.txt b/src/DSP/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(zynaddsubfxgui_dsp_SRCS
+set(zynaddsubfx_dsp_SRCS
AnalogFilter.C
FFTwrapper.C
Filter.C
@@ -6,8 +6,8 @@ set(zynaddsubfxgui_dsp_SRCS
SVFilter.C
)
-add_library(zynaddsubfxgui_dsp STATIC
- ${zynaddsubfxgui_dsp_SRCS}
+add_library(zynaddsubfx_dsp STATIC
+ ${zynaddsubfx_dsp_SRCS}
)
-target_link_libraries(zynaddsubfxgui_dsp ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_dsp ${ASOUND_LIBRARY})
diff --git a/src/Effects/CMakeLists.txt b/src/Effects/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(zynaddsubfxgui_effect_SRCS
+set(zynaddsubfx_effect_SRCS
Alienwah.C
Chorus.C
Distorsion.C
@@ -12,8 +12,8 @@ set(zynaddsubfxgui_effect_SRCS
Reverb.C
)
-add_library(zynaddsubfxgui_effect STATIC
- ${zynaddsubfxgui_effect_SRCS}
+add_library(zynaddsubfx_effect STATIC
+ ${zynaddsubfx_effect_SRCS}
)
-target_link_libraries(zynaddsubfxgui_effect ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_effect ${ASOUND_LIBRARY})
diff --git a/src/Input/CMakeLists.txt b/src/Input/CMakeLists.txt
@@ -1,5 +1,5 @@
SET (AlsaMidiInput On CACHE BOOL "Include ALSA Midi input")
-set(zynaddsubfxgui_input_SRCS
+set(zynaddsubfx_input_SRCS
MidiIn.C
NULLMidiIn.C
#OSSMidiIn.C
@@ -8,15 +8,15 @@ set(zynaddsubfxgui_input_SRCS
FIND_PACKAGE(Alsa)
if(AlsaMidiInput)
- set(zynaddsubfxgui_input_SRCS
- ${zynaddsubfxgui_input_SRCS}
+ set(zynaddsubfx_input_SRCS
+ ${zynaddsubfx_input_SRCS}
ALSAMidiIn.C
)
message("Alsa midi input enabled")
endif(AlsaMidiInput)
-add_library(zynaddsubfxgui_input STATIC
- ${zynaddsubfxgui_input_SRCS}
+add_library(zynaddsubfx_input STATIC
+ ${zynaddsubfx_input_SRCS}
)
-target_link_libraries(zynaddsubfxgui_input ${QT_LIBRARIES} ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_input ${QT_LIBRARIES} ${ASOUND_LIBRARY})
diff --git a/src/Misc/CMakeLists.txt b/src/Misc/CMakeLists.txt
@@ -3,7 +3,7 @@ find_package(fftw3)
include_directories(${MXML_INCLUDE_DIR})
-set(zynaddsubfxgui_misc_SRCS
+set(zynaddsubfx_misc_SRCS
Bank.C
Config.C
Dump.C
@@ -14,12 +14,12 @@ set(zynaddsubfxgui_misc_SRCS
XMLwrapper.C
)
-add_library(zynaddsubfxgui_misc STATIC
- ${zynaddsubfxgui_misc_SRCS}
+add_library(zynaddsubfx_misc STATIC
+ ${zynaddsubfx_misc_SRCS}
)
-target_link_libraries(zynaddsubfxgui_misc
- zynaddsubfxgui_output
+target_link_libraries(zynaddsubfx_misc
+ zynaddsubfx_output
${MXML_LIBRARIES}
${fftw3_LIBRARIES}
)
diff --git a/src/NewUI/CMakeLists.txt b/src/NewUI/CMakeLists.txt
@@ -1,36 +0,0 @@
-
-set(zynaddsubfxguilib_SRCS
- dial.cpp
- bankui.C
- masterui.C
- addnoteui.C
- unitbox.C
- lfobox.C
- envelopebox.C
- )
-
-SET( zynaddsubfxguilib_MOC_HDRS
- masterui.h
- bankui.h
- addnoteui.h
- unitbox.h
- lfobox.h
- envelopebox.h
-)
-
-SET( zynaddsubfxguilib_UIS
- masterUI.ui
- addnoteui.ui
- lfobox.ui
- envelopebox.ui
-)
-
-qt4_wrap_ui(zynaddsubfxguilib_UIS_HDRS ${zynaddsubfxguilib_UIS} )
-qt4_automoc(${zynaddsubfxguilib_SRCS})
-
-include_directories(${CMAKE_CURRENT_BINARY_DIR})
-add_library(zynaddsubfxguilib STATIC
- ${zynaddsubfxguilib_SRCS}
- ${zynaddsubfxguilib_UIS}
- )
-target_link_libraries(zynaddsubfxguilib)
diff --git a/src/Output/CMakeLists.txt b/src/Output/CMakeLists.txt
@@ -1,33 +1,33 @@
-set(zynaddsubfxgui_output_SRCS
+set(zynaddsubfx_output_SRCS
Recorder.C
WAVaudiooutput.C
)
if(AlsaMidiOutput)
- set(zynaddsubfxgui_output_SRCS
- ${zynaddsubfxgui_output_SRCS}
+ set(zynaddsubfx_output_SRCS
+ ${zynaddsubfx_output_SRCS}
OSSaudiooutput.C)
- set(zynaddsubfxgui_output_lib ${ASOUND_LIBRARY})
+ set(zynaddsubfx_output_lib ${ASOUND_LIBRARY})
endif(AlsaMidiOutput)
if(JackOutput)
include_directories(${JACK_INCLUDE_DIR})
- set(zynaddsubfxgui_output_SRCS
- ${zynaddsubfxgui_output_SRCS}
+ set(zynaddsubfx_output_SRCS
+ ${zynaddsubfx_output_SRCS}
JACKaudiooutput.C)
- set(zynaddsubfxgui_output_lib ${JACK_LIBRARIES})
+ set(zynaddsubfx_output_lib ${JACK_LIBRARIES})
endif(JackOutput)
if(PortAudioOutput)
include_directories(${PORTAUDIO_INCLUDE_DIR})
- set(zynaddsubfxgui_output_SRCS
- ${zynaddsubfxgui_output_SRCS}
+ set(zynaddsubfx_output_SRCS
+ ${zynaddsubfx_output_SRCS}
PAaudiooutput.C)
- set(zynaddsubfxgui_output_lib ${PORTAUDIO_LIBRARIES})
+ set(zynaddsubfx_output_lib ${PORTAUDIO_LIBRARIES})
endif(PortAudioOutput)
-add_library(zynaddsubfxgui_output STATIC
- ${zynaddsubfxgui_output_SRCS}
+add_library(zynaddsubfx_output STATIC
+ ${zynaddsubfx_output_SRCS}
)
-target_link_libraries(zynaddsubfxgui_output ${zynaddsubfxgui_output_lib})
+target_link_libraries(zynaddsubfx_output ${zynaddsubfx_output_lib})
diff --git a/src/Params/CMakeLists.txt b/src/Params/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(zynaddsubfxgui_params_SRCS
+set(zynaddsubfx_params_SRCS
ADnoteParameters.C
Controller.C
EnvelopeParams.C
@@ -11,8 +11,8 @@ set(zynaddsubfxgui_params_SRCS
)
-add_library(zynaddsubfxgui_params STATIC
- ${zynaddsubfxgui_params_SRCS}
+add_library(zynaddsubfx_params STATIC
+ ${zynaddsubfx_params_SRCS}
)
-target_link_libraries(zynaddsubfxgui_params ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_params ${ASOUND_LIBRARY})
diff --git a/src/Samples/CMakeLists.txt b/src/Samples/CMakeLists.txt
@@ -1,14 +1,14 @@
-set(zynaddsubfxgui_samples_SRCS
+set(zynaddsubfx_samples_SRCS
AuSample.C
FqSample.C
Sample.C
#StereoSample.C
)
-add_library(zynaddsubfxgui_samples STATIC
- ${zynaddsubfxgui_samples_SRCS}
+add_library(zynaddsubfx_samples STATIC
+ ${zynaddsubfx_samples_SRCS}
)
-target_link_libraries(zynaddsubfxgui_samples
- zynaddsubfxgui_samples
+target_link_libraries(zynaddsubfx_samples
+ zynaddsubfx_samples
)
diff --git a/src/Seq/CMakeLists.txt b/src/Seq/CMakeLists.txt
@@ -1,11 +1,11 @@
-set(zynaddsubfxgui_seq_SRCS
+set(zynaddsubfx_seq_SRCS
MIDIEvents.C
MIDIFile.C
Sequencer.C
)
-add_library(zynaddsubfxgui_seq STATIC
- ${zynaddsubfxgui_seq_SRCS}
+add_library(zynaddsubfx_seq STATIC
+ ${zynaddsubfx_seq_SRCS}
)
-target_link_libraries(zynaddsubfxgui_seq ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_seq ${ASOUND_LIBRARY})
diff --git a/src/Synth/CMakeLists.txt b/src/Synth/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(zynaddsubfxgui_synth_SRCS
+set(zynaddsubfx_synth_SRCS
ADnote.C
Envelope.C
LFO.C
@@ -8,8 +8,8 @@ set(zynaddsubfxgui_synth_SRCS
SUBnote.C
)
-add_library(zynaddsubfxgui_synth STATIC
- ${zynaddsubfxgui_synth_SRCS}
+add_library(zynaddsubfx_synth STATIC
+ ${zynaddsubfx_synth_SRCS}
)
-target_link_libraries(zynaddsubfxgui_synth ${ASOUND_LIBRARY})
+target_link_libraries(zynaddsubfx_synth ${ASOUND_LIBRARY})
diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt
@@ -25,10 +25,10 @@ set(UI_fl_files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set_source_files_properties(UI/MasterUI.h PROPERTIES GENERATED 1)
-fltk_wrap_ui(zynaddsubfxguilib ${UI_fl_files})
+fltk_wrap_ui(zynaddsubfx_gui ${UI_fl_files})
-add_library(zynaddsubfxguilib STATIC
+add_library(zynaddsubfx_gui STATIC
${UI_objs}
- ${zynaddsubfxguilib_FLTK_UI_SRCS}
+ ${zynaddsubfx_gui_FLTK_UI_SRCS}
)
-target_link_libraries(zynaddsubfxguilib)
+target_link_libraries(zynaddsubfx_gui)
diff --git a/src/main.C b/src/main.C
@@ -55,9 +55,20 @@ extern Dump dump;
#endif
#ifndef DISABLE_GUI
+#ifdef QT_GUI
+
+#include <QApplication>
+#include "masterui.h"
+QApplication *app;
+
+#elif defined FLTK_GUI
+
#include "UI/MasterUI.h"
+#endif // FLTK_GUI
+
MasterUI *ui;
-#endif
+
+#endif //DISABLE_GUI
using namespace std;
@@ -190,7 +201,10 @@ void *thread2(void *arg)
void *thread3(void *arg)
{
#ifndef DISABLE_GUI
+
+#ifdef FLTK_GUI
ui->showUI();
+
while (Pexitprogram==0) {
#ifdef USE_LASH
string filename;
@@ -208,10 +222,18 @@ void *thread3(void *arg)
default:
break;
}
-#endif
+#endif //USE_LASH
Fl::wait();
}
-#endif
+
+#elif defined QT_GUI
+ app = new QApplication(0, 0);
+ ui=new MasterUI(master, 0);
+ ui->show();
+ app->exec();
+#endif //defined QT_GUI
+
+#endif //DISABLE_GUI
return(0);
};