/[svn]/qsampler/trunk/CMakeLists.txt
ViewVC logotype

Diff of /qsampler/trunk/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3589 by capela, Sun Sep 1 20:01:03 2019 UTC revision 3873 by capela, Thu Apr 15 13:28:01 2021 UTC
# Line 1  Line 1 
1  project(QSAMPLER)  cmake_minimum_required(VERSION 3.10)
2    
3  cmake_minimum_required(VERSION 3.1)  project(qsampler
4      VERSION 0.9.3
5      DESCRIPTION "A LinuxSampler Qt GUI Interface"
6      LANGUAGES C CXX)
7    
8  set (VERSION "0.5.7")  set (CONFIG_VERSION ${PROJECT_VERSION})
   
 set (CONFIG_VERSION ${VERSION})  
9  execute_process (  execute_process (
10    COMMAND git describe --tags --dirty --abbrev=6    COMMAND git describe --tags --dirty --abbrev=6
11      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
12    OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT    OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
13    RESULT_VARIABLE GIT_DESCRIBE_RESULT    RESULT_VARIABLE GIT_DESCRIBE_RESULT
14    OUTPUT_STRIP_TRAILING_WHITESPACE)    OUTPUT_STRIP_TRAILING_WHITESPACE)
15  if (GIT_DESCRIBE_RESULT EQUAL 0)  if (GIT_DESCRIBE_RESULT EQUAL 0)
16    set (VERSION "${GIT_DESCRIBE_OUTPUT}")    set (VERSION "${GIT_DESCRIBE_OUTPUT}")
17    string (REGEX REPLACE "^[^_]+"   "" VERSION "${VERSION}")    string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
18      string (REGEX REPLACE "^1_"      "" VERSION "${VERSION}")
19    string (REGEX REPLACE "^[_vV]+"  "" VERSION "${VERSION}")    string (REGEX REPLACE "^[_vV]+"  "" VERSION "${VERSION}")
20    string (REGEX REPLACE "-g"   "git." VERSION "${VERSION}")    string (REGEX REPLACE "-g"   "git." VERSION "${VERSION}")
21    string (REGEX REPLACE "[_|-]+"  "." VERSION "${VERSION}")    string (REGEX REPLACE "[_|-]"   "." VERSION "${VERSION}")
22    execute_process (    execute_process (
23      COMMAND git rev-parse --abbrev-ref HEAD      COMMAND git rev-parse --abbrev-ref HEAD
24        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
25      OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT      OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
26      RESULT_VARIABLE GIT_REVPARSE_RESULT      RESULT_VARIABLE GIT_REVPARSE_RESULT
27      OUTPUT_STRIP_TRAILING_WHITESPACE)      OUTPUT_STRIP_TRAILING_WHITESPACE)
28    if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master")    if (GIT_REVPARSE_RESULT EQUAL 0 AND NOT GIT_REVPARSE_OUTPUT STREQUAL "master")
29      set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")      set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")
30    endif ()    endif ()
31    else ()
32      set (VERSION "${PROJECT_VERSION}")
33  endif ()  endif ()
34    
35  set (PACKAGE_NAME "Qsampler")  set (PACKAGE_NAME "Qsampler")
# Line 32  set (PACKAGE_BUGREPORT "rncbc@rncbc.org" Line 38  set (PACKAGE_BUGREPORT "rncbc@rncbc.org"
38  set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")  set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
39  set (PACKAGE_TARNAME "qsampler")  set (PACKAGE_TARNAME "qsampler")
40    
41    set (ac_version "${PROJECT_VERSION}")
42    set (ac_prefix "${CMAKE_INSTALL_PREFIX}")
43    
44  set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")  set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
45    
46  if (CMAKE_BUILD_TYPE)  if (CMAKE_BUILD_TYPE)
# Line 64  option (CONFIG_XUNIQUE "Enable unique/si Line 73  option (CONFIG_XUNIQUE "Enable unique/si
73  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
74    
75    
76    # Enable Qt6 build preference.
77    option (CONFIG_QT6 "Enable Qt6 build (default=no)" 0)
78    
79    
80  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
81  if (POLICY CMP0075)  if (POLICY CMP0075)
82    cmake_policy (SET CMP0075 NEW)    cmake_policy (SET CMP0075 NEW)
83  endif ()  endif ()
84    
85  # Check for Qt  # Check for Qt...
86  find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets)  if (CONFIG_QT6)
87      find_package (Qt6 QUIET)
88      if (NOT Qt6_FOUND)
89        set (CONFIG_QT6 0)
90      endif ()
91    endif ()
92    
93    if (CONFIG_QT6)
94      find_package (QT QUIET NAMES Qt6)
95    else ()
96      find_package (QT QUIET NAMES Qt5)
97    endif ()
98    
99    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
100    
101  if (CONFIG_XUNIQUE)  if (CONFIG_XUNIQUE)
102    find_package (Qt5 REQUIRED COMPONENTS Network)    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
103  endif ()  endif ()
104    
105  find_package (Qt5LinguistTools)  find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
106    
107  include (CheckIncludeFile)  include (CheckIncludeFile)
108  include (CheckIncludeFiles)  include (CheckIncludeFiles)
# Line 108  endif () Line 134  endif ()
134  find_package (PkgConfig REQUIRED)  find_package (PkgConfig REQUIRED)
135    
136  # Check for LSCP libraries.  # Check for LSCP libraries.
137  pkg_check_modules (LSCP REQUIRED lscp)  pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
138  set (CONFIG_LIBLSCP ${LSCP_FOUND})  if (LSCP_FOUND)
139  if (CONFIG_LIBLSCP)    set (CONFIG_LIBLSCP 1)
140    include_directories (${LSCP_INCLUDE_DIRS})    include_directories (${LSCP_INCLUDE_DIRS})
141    link_directories (${LSCP_LIBRARY_DIRS})    link_directories (${LSCP_LIBRARY_DIRS})
142  # link_libraries (${LSCP_LIBRARIES})  # link_libraries (${LSCP_LIBRARIES})
143    set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")    set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")
144    # Check for for instrument_name in lscp_channel_info_t.    # Check for for instrument_name in lscp_channel_info_t.
145    check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME)    check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
146      if (NOT HAVE_LSCP_CLIENT_H)
147        set (CONFIG_INSTRUMENT_NAME 0)
148      else ()
149        set (CONFIG_INSTRUMENT_NAME 1)    
150      endif ()
151    # Check for mute/solo in lscp_channel_info_t.    # Check for mute/solo in lscp_channel_info_t.
152    check_include_file (lscp/client.h CONFIG_MUTE_SOLO)    if (NOT HAVE_LSCP_CLIENT_H)
153        set (CONFIG_MUTE_SOLO 0)
154      else ()
155        set (CONFIG_MUTE_SOLO 1)    
156      endif ()
157    if (CONFIG_MUTE_SOLO)    if (CONFIG_MUTE_SOLO)
158      check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)      check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
159    endif ()    endif ()
# Line 131  if (CONFIG_LIBLSCP) Line 166  if (CONFIG_LIBLSCP)
166    check_function_exists (lscp_create_fxsend CONFIG_FXSEND)    check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
167    # Check for FX send level in lscp_fxsend_info_t    # Check for FX send level in lscp_fxsend_info_t
168    if (CONFIG_FXSEND)    if (CONFIG_FXSEND)
169      check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL)      if (NOT HAVE_LSCP_CLIENT_H)
170          set (CONFIG_FXSEND_LEVEL 0)
171        else ()
172          set (CONFIG_FXSEND_LEVEL 1)    
173        endif ()
174    endif ()    endif ()
175    # Check if FX send rename is available.    # Check if FX send rename is available.
176    if (CONFIG_FXSEND)    if (CONFIG_FXSEND)
177      check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)      check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
178    endif ()    endif ()
179    # Check for audio_routing array type    # Check for audio_routing array type
180    check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING)    if (NOT HAVE_LSCP_CLIENT_H)
181        set (CONFIG_AUDIO_ROUTING 0)
182      else ()
183        set (CONFIG_AUDIO_ROUTING 1)    
184      endif ()
185    # Check if global volume is available.    # Check if global volume is available.
186    check_function_exists (lscp_set_volume CONFIG_VOLUME)    check_function_exists (lscp_set_volume CONFIG_VOLUME)
187    # Check if instrument editing is available.    # Check if instrument editing is available.
188    check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)    check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
189    # Check for CHANNEL_MIDI LSCP event support in liblscp],    # Check for CHANNEL_MIDI LSCP event support in liblscp],
190    check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI)    check_include_file (lscp/event.h HAVE_LSCP_EVENT_H)
191      if (NOT HAVE_LSCP_EVENT_H)
192        set (CONFIG_EVENT_CHANNEL_MIDI 0)
193      else ()
194        set (CONFIG_EVENT_CHANNEL_MIDI 1)    
195      endif ()
196    # Check for DEVICE_MIDI LSCP event support in liblscp],    # Check for DEVICE_MIDI LSCP event support in liblscp],
197    check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI)    if (NOT HAVE_LSCP_EVENT_H)
198        set (CONFIG_EVENT_DEVICE_MIDI 0)
199      else ()
200        set (CONFIG_EVENT_DEVICE_MIDI 1)    
201      endif ()
202    # Check if max. voices / streams is available.    # Check if max. voices / streams is available.
203    check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)    check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
204  else ()  else ()
205    message (FATAL_ERROR "*** LSCP library not found.")    message (FATAL_ERROR "*** LSCP library not found.")
206      set (CONFIG_LIBLSCP 0)
207  endif ()  endif ()
208    
209  # Check for GIG libraries.  # Check for GIG libraries.
210  if (CONFIG_LIBGIG)  if (CONFIG_LIBGIG)
211    pkg_check_modules (GIG gig>=3.3.0)    pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
212    set (CONFIG_LIBGIG ${GIG_FOUND})    if (GIG_FOUND)
   if (CONFIG_LIBGIG)  
213      include_directories (${GIG_INCLUDE_DIRS})      include_directories (${GIG_INCLUDE_DIRS})
214      link_directories (${GIG_LIBRARY_DIRS})      link_directories (${GIG_LIBRARY_DIRS})
215      link_libraries (${GIG_LIBRARIES})      link_libraries (${GIG_LIBRARIES})
# Line 165  if (CONFIG_LIBGIG) Line 217  if (CONFIG_LIBGIG)
217      # liggig supports fast information retrieval.      # liggig supports fast information retrieval.
218      set (CONFIG_LIBGIG_SETAUTOLOAD 1)      set (CONFIG_LIBGIG_SETAUTOLOAD 1)
219      # Check if libgig/SF.h is available.      # Check if libgig/SF.h is available.
220      check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2)      check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H)
221        if (NOT HAVE_LIBGIG_SF_H)
222          set (CONFIG_LIBGIG_SF2 0)
223        else ()
224          set (CONFIG_LIBGIG_SF2 1)    
225        endif ()
226    else ()    else ()
227      message (WARNING "*** GIG library not found.")      message (WARNING "*** GIG library not found.")
228        set (CONFIG_LIBGIG 0)
229    endif ()    endif ()
230  endif ()  endif ()
231    
# Line 189  macro (SHOW_OPTION text value) Line 247  macro (SHOW_OPTION text value)
247  endmacro ()  endmacro ()
248    
249    
250  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION}")  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
251  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
252  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
253  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)

Legend:
Removed from v.3589  
changed lines
  Added in v.3873

  ViewVC Help
Powered by ViewVC