/[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 3815 by capela, Sun Aug 16 11:48:49 2020 UTC revision 4074 by capela, Wed Jan 24 17:14:18 2024 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.12
5      DESCRIPTION "A LinuxSampler Qt GUI Interface"
6      HOMEPAGE_URL "https://qsampler.sourceforge.io"
7      LANGUAGES C CXX)
8    
9    set (PROJECT_TITLE "${PROJECT_NAME}")
10    string (TOLOWER "${PROJECT_TITLE}" PROJECT_NAME)
11    
12    set (PROJECT_COPYRIGHT  "Copyright (C) 2004-2024, rncbc aka Rui Nuno Capela. All rights reserved.")
13    set (PROJECT_COPYRIGHT2 "Copyright (C) 2007-2019, Christian Schoenebeck")
14    set (PROJECT_DOMAIN     "linuxsampler.org")
15    
 set (VERSION "0.9.0")  
   
 set (CONFIG_VERSION ${VERSION})  
16  execute_process (  execute_process (
17    COMMAND git describe --tags --dirty --abbrev=6    COMMAND git describe --tags --dirty --abbrev=6
18      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
19    OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT    OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT
20    RESULT_VARIABLE GIT_DESCRIBE_RESULT    RESULT_VARIABLE GIT_DESCRIBE_RESULT
21    OUTPUT_STRIP_TRAILING_WHITESPACE)    OUTPUT_STRIP_TRAILING_WHITESPACE)
22  if (GIT_DESCRIBE_RESULT EQUAL 0)  if (GIT_DESCRIBE_RESULT EQUAL 0)
23    set (VERSION "${GIT_DESCRIBE_OUTPUT}")    set (GIT_VERSION "${GIT_DESCRIBE_OUTPUT}")
24    string (REGEX REPLACE "^[^_]+"   "" VERSION "${VERSION}")    string (REGEX REPLACE "^[^0-9]+" "" GIT_VERSION "${GIT_VERSION}")
25    string (REGEX REPLACE "^[_vV]+"  "" VERSION "${VERSION}")    string (REGEX REPLACE "^1_"      "" GIT_VERSION "${GIT_VERSION}")
26    string (REGEX REPLACE "-g"   "git." VERSION "${VERSION}")    string (REGEX REPLACE "^[_vV]+"  "" GIT_VERSION "${GIT_VERSION}")
27    string (REGEX REPLACE "[_|-]+"  "." VERSION "${VERSION}")    string (REGEX REPLACE "-g"   "git." GIT_VERSION "${GIT_VERSION}")
28      string (REGEX REPLACE "[_|-]"   "." GIT_VERSION "${GIT_VERSION}")
29    execute_process (    execute_process (
30      COMMAND git rev-parse --abbrev-ref HEAD      COMMAND git rev-parse --abbrev-ref HEAD
31        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
32      OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT      OUTPUT_VARIABLE GIT_REVPARSE_OUTPUT
33      RESULT_VARIABLE GIT_REVPARSE_RESULT      RESULT_VARIABLE GIT_REVPARSE_RESULT
34      OUTPUT_STRIP_TRAILING_WHITESPACE)      OUTPUT_STRIP_TRAILING_WHITESPACE)
35    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 "main")
36      set (VERSION "${VERSION} [${GIT_REVPARSE_OUTPUT}]")      set (GIT_VERSION "${GIT_VERSION} [${GIT_REVPARSE_OUTPUT}]")
37    endif ()    endif ()
38      set (PROJECT_VERSION "${GIT_VERSION}")
39  endif ()  endif ()
40    
 set (PACKAGE_NAME "Qsampler")  
 set (PACKAGE_VERSION "${VERSION}")  
 set (PACKAGE_BUGREPORT "rncbc@rncbc.org")  
 set (PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")  
 set (PACKAGE_TARNAME "qsampler")  
   
 set (CONFIG_BUILD_VERSION "${PACKAGE_VERSION}")  
41    
42  if (CMAKE_BUILD_TYPE)  if (CMAKE_BUILD_TYPE MATCHES "Debug")
43    set (CONFIG_BUILD_TYPE ${CMAKE_BUILD_TYPE})    set (CONFIG_DEBUG 1)
44      set (CONFIG_BUILD_TYPE "debug")
45  else ()  else ()
46      set (CONFIG_DEBUG 0)
47    set (CONFIG_BUILD_TYPE "release")    set (CONFIG_BUILD_TYPE "release")
48  endif ()    set (CMAKE_BUILD_TYPE "Release")
   
 set (CONFIG_DEBUG 0)  
 if (CONFIG_BUILD_TYPE MATCHES "debug")  
   set (CONFIG_DEBUG 1)  
49  endif ()  endif ()
50    
51  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")  set (CONFIG_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Line 63  option (CONFIG_XUNIQUE "Enable unique/si Line 66  option (CONFIG_XUNIQUE "Enable unique/si
66  # Enable debugger stack-trace option (assumes --enable-debug).  # Enable debugger stack-trace option (assumes --enable-debug).
67  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)  option (CONFIG_STACKTRACE "Enable debugger stack-trace (default=no)" 0)
68    
69    # Enable Wayland support option.
70    option (CONFIG_WAYLAND "Enable Wayland support (EXPERIMENTAL) (default=no)" 0)
71    
72    # Enable Qt6 build preference.
73    option (CONFIG_QT6 "Enable Qt6 build (default=yes)" 1)
74    
75    
76  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.  # Fix for new CMAKE_REQUIRED_LIBRARIES policy.
77  if (POLICY CMP0075)  if (POLICY CMP0075)
78    cmake_policy (SET CMP0075 NEW)    cmake_policy (SET CMP0075 NEW)
79  endif ()  endif ()
80    
81  # Check for Qt  # Check for Qt...
82  find_package (Qt5 REQUIRED COMPONENTS Core Gui Widgets)  if (CONFIG_QT6)
83      find_package (Qt6 QUIET)
84      if (NOT Qt6_FOUND)
85        set (CONFIG_QT6 0)
86      endif ()
87    endif ()
88    
89    if (CONFIG_QT6)
90      find_package (QT QUIET NAMES Qt6)
91    else ()
92      find_package (QT QUIET NAMES Qt5)
93    endif ()
94    
95    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets Svg)
96    
97  if (CONFIG_XUNIQUE)  if (CONFIG_XUNIQUE)
98    find_package (Qt5 REQUIRED COMPONENTS Network)    find_package (Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Network)
99  endif ()  endif ()
100    
101  find_package (Qt5LinguistTools)  find_package (Qt${QT_VERSION_MAJOR}LinguistTools)
102    
103  include (CheckIncludeFile)  include (CheckIncludeFile)
104  include (CheckIncludeFiles)  include (CheckIncludeFiles)
# Line 105  endif () Line 127  endif ()
127    
128    
129  # Find package modules  # Find package modules
130  find_package (PkgConfig REQUIRED)  include (FindPkgConfig)
131    
132  # Check for LSCP libraries.  # Check for LSCP libraries.
133  pkg_check_modules (LSCP REQUIRED lscp)  pkg_check_modules (LSCP REQUIRED IMPORTED_TARGET lscp)
134  if (LSCP_FOUND)  if (LSCP_FOUND)
135      find_library(LSCP_LIBRARY NAMES ${LSCP_LIBRARIES} HINTS ${LSCP_LIBDIR})
136    endif ()
137    if (LSCP_LIBRARY)
138    set (CONFIG_LIBLSCP 1)    set (CONFIG_LIBLSCP 1)
139    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}")  
140    # Check for for instrument_name in lscp_channel_info_t.    # Check for for instrument_name in lscp_channel_info_t.
141    check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)    check_include_file (lscp/client.h HAVE_LSCP_CLIENT_H)
142    if (NOT HAVE_LSCP_CLIENT_H)    if (NOT HAVE_LSCP_CLIENT_H)
# Line 182  endif () Line 204  endif ()
204    
205  # Check for GIG libraries.  # Check for GIG libraries.
206  if (CONFIG_LIBGIG)  if (CONFIG_LIBGIG)
207    pkg_check_modules (GIG gig>=3.3.0)    pkg_check_modules (GIG IMPORTED_TARGET gig>=3.3.0)
208    if (GIG_FOUND)    if (GIG_FOUND)
209      include_directories (${GIG_INCLUDE_DIRS})      find_library(GIG_LIBRARY NAMES ${GIG_LIBRARIES} HINTS ${GIG_LIBDIR})
210      link_directories (${GIG_LIBRARY_DIRS})    endif ()
211      link_libraries (${GIG_LIBRARIES})    if (GIG_LIBRARY)
212  #   set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARIES};${CMAKE_REQUIRED_LIBRARIES}")      set (CONFIG_LIBGIG 1)
213       #set (CMAKE_REQUIRED_LIBRARIES "${GIG_LIBRARY};${CMAKE_REQUIRED_LIBRARIES}")
214      # liggig supports fast information retrieval.      # liggig supports fast information retrieval.
215      set (CONFIG_LIBGIG_SETAUTOLOAD 1)      set (CONFIG_LIBGIG_SETAUTOLOAD 1)
216      # Check if libgig/SF.h is available.      # Check if libgig/SF.h is available.
# Line 206  endif () Line 229  endif ()
229    
230  add_subdirectory (src)  add_subdirectory (src)
231    
 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)  
232    
233  # Configuration status  # Configuration status
234  macro (SHOW_OPTION text value)  macro (SHOW_OPTION text value)
# Line 220  macro (SHOW_OPTION text value) Line 239  macro (SHOW_OPTION text value)
239    endif ()    endif ()
240  endmacro ()  endmacro ()
241    
242    message   ("\n  ${PROJECT_TITLE} ${PROJECT_VERSION} (Qt ${QT_VERSION})")
 message   ("\n  ${PACKAGE_NAME} ${PACKAGE_VERSION}")  
243  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")  message   ("\n  Build target . . . . . . . . . . . . . . . . . . .: ${CONFIG_BUILD_TYPE}\n")
244  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)  show_option ("  LSCP instrument name support . . . . . . . . . . ." CONFIG_INSTRUMENT_NAME)
245  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 261  show_option ("  LSCP runtime max. voices
261  message     ("")  message     ("")
262  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)  show_option ("  Unique/Single instance support . . . . . . . . . ." CONFIG_XUNIQUE)
263  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)  show_option ("  Debugger stack-trace (gdb) . . . . . . . . . . . ." CONFIG_STACKTRACE)
264  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.3815  
changed lines
  Added in v.4074

  ViewVC Help
Powered by ViewVC