/[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 3851 by capela, Mon Jan 18 12:04:37 2021 UTC revision 4050 by capela, Wed Nov 9 18:16:03 2022 UTC
# Line 1  Line 1 
1  cmake_minimum_required(VERSION 3.10)  cmake_minimum_required (VERSION 3.13)
2    
3  project(qsampler)  project (qsampler
4      VERSION 0.9.8
5      DESCRIPTION "A LinuxSampler Qt GUI Interface"
6      LANGUAGES C CXX)
7    
8  set (VERSION "0.9.1")  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 "^[^0-9]+" "" VERSION "${VERSION}")    string (REGEX REPLACE "^[^0-9]+" "" VERSION "${VERSION}")
18      string (REGEX REPLACE "^1_"      "" VERSION "${VERSION}")
19      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 33  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 (CONFIG_DEBUG)
44    set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE})    set (CMAKE_BUILD_TYPE "Debug")
 else ()  
   set (CONFIG_BUILD_TYPE "release")  
45  endif ()  endif ()
46    if (CMAKE_BUILD_TYPE MATCHES "Debug")
 set (CONFIG_DEBUG 0)  
 if (CONFIG_BUILD_TYPE MATCHES "debug")  
47    set (CONFIG_DEBUG 1)    set (CONFIG_DEBUG 1)
48  endif ()  endif ()
49    if (CONFIG_DEBUG)
50      set (CONFIG_BUILD_TYPE "debug")
51    else ()
52      set (CONFIG_BUILD_TYPE "release")
53    endif ()
54    
55  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
56    
# Line 62  option (CONFIG_XUNIQUE "Enable unique/si Line 70  option (CONFIG_XUNIQUE "Enable unique/si
70  # Enable debugger stack-trace option (assumes --enable-debug).  # Enable debugger stack-trace option (assumes --enable-debug).
71  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
72    
73    # Enable Wayland support option.
74    option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0)
75    
76    # Enable Qt6 build preference.
77    option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
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 (QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)  if (CONFIG_QT6)
87  find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)    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 Svg)
100    
101  if (CONFIG_XUNIQUE)  if (CONFIG_XUNIQUE)
102    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
# Line 105  endif () Line 131  endif ()
131    
132    
133  # Find package modules  # Find package modules
134  find_package (PkgConfig REQUIRED)  include (FindPkgConfig)
135    
136  # Check for LSCP libraries.  # Check for LSCP libraries.
137  pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)  pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
138  if (LSCP_FOUND)  if (LSCP_FOUND)
139      find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR})
140    endif ()
141    if (LSCP_LIBRARY)
142    set (CONFIG_LIBLSCP 1)    set (CONFIG_LIBLSCP 1)
143    include_directories (${LSCP_INCLUDE_DIRS})    set (CMAKE_REQUIRED_LIBRARIES "${LSCP_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
   link_directories (${LSCP_LIBRARY_DIRS})  
 # link_libraries (${LSCP_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 HAVE_LSCP_CLIENT_H)    check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
146    if (NOT HAVE_LSCP_CLIENT_H)    if (NOT HAVE_LSCP_CLIENT_H)
# Line 184  endif () Line 210  endif ()
210  if (CONFIG_LIBGIG)  if (CONFIG_LIBGIG)
211    pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)    pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
212    if (GIG_FOUND)    if (GIG_FOUND)
213      include_directories (${GIG_INCLUDE_DIRS})      find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR})
214      link_directories (${GIG_LIBRARY_DIRS})    endif ()
215      link_libraries (${GIG_LIBRARIES})    if (GIG_LIBRARY)
216  #   set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")      set (CONFIG_LIBGIG 1)
217       #set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
218      # liggig supports fast information retrieval.      # liggig supports fast information retrieval.
219      set (CONFIG_LIBGIG_SETAUTOLOAD 1)      set (CONFIG_LIBGIG_SETAUTOLOAD 1)
220      # Check if libgig/SF.h is available.      # Check if libgig/SF.h is available.
# Line 206  endif () Line 233  endif ()
233    
234  add_subdirectory (src)  add_subdirectory (src)
235    
 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)  
236    
237  # Configuration status  # Configuration status
238  macro (SHOW_OPTION text value)  macro (SHOW_OPTION text value)
# Line 221  macro (SHOW_OPTION text value) Line 244  macro (SHOW_OPTION text value)
244  endmacro ()  endmacro ()
245    
246    
247  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION}")  message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION} (Qt ${QT_VERSION})")
248  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
249  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
250  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)  show_option ("  LSCP mute/solo support . . . . . . . . . . . . . ." CONFIG_MUTE_SOLO)
# Line 243  show_option ("  LSCP runtime max. voices Line 266  show_option ("  LSCP runtime max. voices
266  message     ("")  message     ("")
267  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
268  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
269  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.3851  
changed lines
  Added in v.4050

  ViewVC Help
Powered by ViewVC