/[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 3633 by capela, Thu Oct 17 14:09:09 2019 UTC revision 4058 by capela, Mon May 15 10:28:48 2023 UTC
# Line 1  Line 1 
1  project(QSAMPLER)  cmake_minimum_required (VERSION 3.13)
2    
3  cmake_minimum_required(VERSION 3.1)  project (qsampler
4      VERSION 0.9.10
5      DESCRIPTION "A LinuxSampler Qt GUI Interface"
6      LANGUAGES C CXX)
7    
8  set (VERSION "0.6.0")  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 34  set (PACKAGE_TARNAME "qsampler") Line 40  set (PACKAGE_TARNAME "qsampler")
40    
41  set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")  set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")
42    
43  if (CMAKE_BUILD_TYPE)  if (CMAKE_BUILD_TYPE MATCHES "Debug")
44    set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE})    set (CONFIG_DEBUG 1)
45      set (CONFIG_BUILD_TYPE "debug")
46  else ()  else ()
47      set (CONFIG_DEBUG 0)
48    set (CONFIG_BUILD_TYPE "release")    set (CONFIG_BUILD_TYPE "release")
49  endif ()    set (CMAKE_BUILD_TYPE "Release")
   
 set (CONFIG_DEBUG 0)  
 if (CONFIG_BUILD_TYPE MATCHES "debug")  
   set (CONFIG_DEBUG 1)  
50  endif ()  endif ()
51    
52  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Line 63  option (CONFIG_XUNIQUE "Enable unique/si Line 67  option (CONFIG_XUNIQUE "Enable unique/si
67  # Enable debugger stack-trace option (assumes --enable-debug).  # Enable debugger stack-trace option (assumes --enable-debug).
68  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
69    
70    # Enable Wayland support option.
71    option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0)
72    
73    # Enable Qt6 build preference.
74    option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
75    
76    
77  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
78  if (POLICY CMP0075)  if (POLICY CMP0075)
79    cmake_policy (SET CMP0075 NEW)    cmake_policy (SET CMP0075 NEW)
80  endif ()  endif ()
81    
82  # Check for Qt  # Check for Qt...
83  find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets)  if (CONFIG_QT6)
84      find_package (Qt6 QUIET)
85      if (NOT Qt6_FOUND)
86        set (CONFIG_QT6 0)
87      endif ()
88    endif ()
89    
90    if (CONFIG_QT6)
91      find_package (QT QUIET NAMES Qt6)
92    else ()
93      find_package (QT QUIET NAMES Qt5)
94    endif ()
95    
96    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Svg)
97    
98  if (CONFIG_XUNIQUE)  if (CONFIG_XUNIQUE)
99    find_package (Qt5 REQUIRED COMPONENTS Network)    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
100  endif ()  endif ()
101    
102  find_package (Qt5LinguistTools)  find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
103    
104  include (CheckIncludeFile)  include (CheckIncludeFile)
105  include (CheckIncludeFiles)  include (CheckIncludeFiles)
# Line 105  endif () Line 128  endif ()
128    
129    
130  # Find package modules  # Find package modules
131  find_package (PkgConfig REQUIRED)  include (FindPkgConfig)
132    
133  # Check for LSCP libraries.  # Check for LSCP libraries.
134  pkg_check_modules (LSCP REQUIRED lscp)  pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
135  set (CONFIG_LIBLSCP ${LSCP_FOUND})  if (LSCP_FOUND)
136  if (CONFIG_LIBLSCP)    find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR})
137    include_directories (${LSCP_INCLUDE_DIRS})  endif ()
138    link_directories (${LSCP_LIBRARY_DIRS})  if (LSCP_LIBRARY)
139  # link_libraries (${LSCP_LIBRARIES})    set (CONFIG_LIBLSCP 1)
140    set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")    set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
141    # Check for for instrument_name in lscp_channel_info_t.    # Check for for instrument_name in lscp_channel_info_t.
142    check_include_file (lscp/client.h CONFIG_INSTRUMENT_NAME)    check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
143      if (NOT HAVE_LSCP_CLIENT_H)
144        set (CONFIG_INSTRUMENT_NAME 0)
145      else ()
146        set (CONFIG_INSTRUMENT_NAME 1)    
147      endif ()
148    # Check for mute/solo in lscp_channel_info_t.    # Check for mute/solo in lscp_channel_info_t.
149    check_include_file (lscp/client.h CONFIG_MUTE_SOLO)    if (NOT HAVE_LSCP_CLIENT_H)
150        set (CONFIG_MUTE_SOLO 0)
151      else ()
152        set (CONFIG_MUTE_SOLO 1)    
153      endif ()
154    if (CONFIG_MUTE_SOLO)    if (CONFIG_MUTE_SOLO)
155      check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)      check_function_exists (lscp_set_channel_mute CONFIG_MUTE_SOLO)
156    endif ()    endif ()
# Line 131  if (CONFIG_LIBLSCP) Line 163  if (CONFIG_LIBLSCP)
163    check_function_exists (lscp_create_fxsend CONFIG_FXSEND)    check_function_exists (lscp_create_fxsend CONFIG_FXSEND)
164    # Check for FX send level in lscp_fxsend_info_t    # Check for FX send level in lscp_fxsend_info_t
165    if (CONFIG_FXSEND)    if (CONFIG_FXSEND)
166      check_include_file (lscp/client.h CONFIG_FXSEND_LEVEL)      if (NOT HAVE_LSCP_CLIENT_H)
167          set (CONFIG_FXSEND_LEVEL 0)
168        else ()
169          set (CONFIG_FXSEND_LEVEL 1)    
170        endif ()
171    endif ()    endif ()
172    # Check if FX send rename is available.    # Check if FX send rename is available.
173    if (CONFIG_FXSEND)    if (CONFIG_FXSEND)
174      check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)      check_function_exists (lscp_set_fxsend_name CONFIG_FXSEND_RENAME)
175    endif ()    endif ()
176    # Check for audio_routing array type    # Check for audio_routing array type
177    check_include_file (lscp/client.h CONFIG_AUDIO_ROUTING)    if (NOT HAVE_LSCP_CLIENT_H)
178        set (CONFIG_AUDIO_ROUTING 0)
179      else ()
180        set (CONFIG_AUDIO_ROUTING 1)    
181      endif ()
182    # Check if global volume is available.    # Check if global volume is available.
183    check_function_exists (lscp_set_volume CONFIG_VOLUME)    check_function_exists (lscp_set_volume CONFIG_VOLUME)
184    # Check if instrument editing is available.    # Check if instrument editing is available.
185    check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)    check_function_exists (lscp_edit_channel_instrument CONFIG_EDIT_INSTRUMENT)
186    # Check for CHANNEL_MIDI LSCP event support in liblscp],    # Check for CHANNEL_MIDI LSCP event support in liblscp],
187    check_include_file (lscp/event.h CONFIG_EVENT_CHANNEL_MIDI)    check_include_file (lscp/event.h HAVE_LSCP_EVENT_H)
188      if (NOT HAVE_LSCP_EVENT_H)
189        set (CONFIG_EVENT_CHANNEL_MIDI 0)
190      else ()
191        set (CONFIG_EVENT_CHANNEL_MIDI 1)    
192      endif ()
193    # Check for DEVICE_MIDI LSCP event support in liblscp],    # Check for DEVICE_MIDI LSCP event support in liblscp],
194    check_include_file (lscp/event.h CONFIG_EVENT_DEVICE_MIDI)    if (NOT HAVE_LSCP_EVENT_H)
195        set (CONFIG_EVENT_DEVICE_MIDI 0)
196      else ()
197        set (CONFIG_EVENT_DEVICE_MIDI 1)    
198      endif ()
199    # Check if max. voices / streams is available.    # Check if max. voices / streams is available.
200    check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)    check_function_exists (lscp_get_voices CONFIG_MAX_VOICES)
201  else ()  else ()
202    message (FATAL_ERROR "*** LSCP library not found.")    message (FATAL_ERROR "*** LSCP library not found.")
203      set (CONFIG_LIBLSCP 0)
204  endif ()  endif ()
205    
206  # Check for GIG libraries.  # Check for GIG libraries.
207  if (CONFIG_LIBGIG)  if (CONFIG_LIBGIG)
208    pkg_check_modules (GIG gig>=3.3.0)    pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
209    set (CONFIG_LIBGIG ${GIG_FOUND})    if (GIG_FOUND)
210    if (CONFIG_LIBGIG)      find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR})
211      include_directories (${GIG_INCLUDE_DIRS})    endif ()
212      link_directories (${GIG_LIBRARY_DIRS})    if (GIG_LIBRARY)
213      link_libraries (${GIG_LIBRARIES})      set (CONFIG_LIBGIG 1)
214  #   set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")     #set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
215      # liggig supports fast information retrieval.      # liggig supports fast information retrieval.
216      set (CONFIG_LIBGIG_SETAUTOLOAD 1)      set (CONFIG_LIBGIG_SETAUTOLOAD 1)
217      # Check if libgig/SF.h is available.      # Check if libgig/SF.h is available.
218      check_include_file_cxx (libgig/SF.h CONFIG_LIBGIG_SF2)      check_include_file_cxx (libgig/SF.h HAVE_LIBGIG_SF_H)
219        if (NOT HAVE_LIBGIG_SF_H)
220          set (CONFIG_LIBGIG_SF2 0)
221        else ()
222          set (CONFIG_LIBGIG_SF2 1)    
223        endif ()
224    else ()    else ()
225      message (WARNING "*** GIG library not found.")      message (WARNING "*** GIG library not found.")
226        set (CONFIG_LIBGIG 0)
227    endif ()    endif ()
228  endif ()  endif ()
229    
230    
231  add_subdirectory (src)  add_subdirectory (src)
232    
 configure_file (qsampler.spec.in qsampler.spec IMMEDIATE @ONLY)  
   
 install (FILES qsampler.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)  
 install (FILES qsampler.fr.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/fr/man1 RENAME qsampler.1)  
233    
234  # Configuration status  # Configuration status
235  macro (SHOW_OPTION text value)  macro (SHOW_OPTION text value)
# Line 189  macro (SHOW_OPTION text value) Line 241  macro (SHOW_OPTION text value)
241  endmacro ()  endmacro ()
242    
243    
244  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION}")  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
245  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
246  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
247  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
# Line 211  show_option ("  LSCP runtime max. voices Line 263  show_option ("  LSCP runtime max. voices
263  message     ("")  message     ("")
264  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
265  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
266  message   ("\n  Install prefix . . . . . . . . . . . . . . . . . .: ${CMAKE_INSTALL_PREFIX}")  message   ("\n  Install prefix . . . . . . . . . . . . . . . . . .: ${CONFIG_PREFIX}\n")
 message   ("\nNow type 'make', followed by 'make install' as root.\n")  

Legend:
Removed from v.3633  
changed lines
  Added in v.4058

  ViewVC Help
Powered by ViewVC