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

Diff of /qsampler/trunk/src/CMakeLists.txt

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

revision 3568 by capela, Sun Aug 25 14:17:00 2019 UTC revision 4005 by capela, Sun Dec 5 12:42:31 2021 UTC
# Line 1  Line 1 
1    # project (qsampler)
2    
3  include_directories (  set (CMAKE_INCLUDE_CURRENT_DIR ON)
   ${CMAKE_CURRENT_BINARY_DIR}  
   ${CMAKE_CURRENT_SOURCE_DIR}  
   ${QT_INCLUDES}  
 )  
   
 link_directories (  
   ${CMAKE_CURRENT_BINARY_DIR}  
   ${QT_LIBRARY_DIR}  
 )  
4    
5  if (CONFIG_LIBLSCP)  set (CMAKE_AUTOUIC ON)
6    include_directories (${LSCP_INCLUDE_DIRS})  set (CMAKE_AUTOMOC ON)
7    link_directories (${LSCP_LIBRARY_DIRS})  set (CMAKE_AUTORCC ON)
 endif ()  
8    
9  if (CONFIG_LIBGIG)  if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
10    include_directories (${GIG_INCLUDE_DIRS})    file (REMOVE ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
   link_directories (${GIG_LIBRARY_DIRS})  
11  endif ()  endif ()
12    configure_file (config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 configure_file (cmake_config.h ${CMAKE_CURRENT_BINARY_DIR}/config.h)  
   
 set (ac_prefix ${CMAKE_INSTALL_PREFIX})  
   
 configure_file (qsampler.desktop ${CMAKE_CURRENT_BINARY_DIR}/qsampler.desktop)  
13    
14  set (HEADERS  set (HEADERS
15    qsampler.h    qsampler.h
# Line 46  set (HEADERS Line 31  set (HEADERS
31    qsamplerChannelForm.h    qsamplerChannelForm.h
32    qsamplerChannelFxForm.h    qsamplerChannelFxForm.h
33    qsamplerOptionsForm.h    qsamplerOptionsForm.h
34      qsamplerPaletteForm.h
35    qsamplerMainForm.h    qsamplerMainForm.h
36  )  )
37    
# Line 68  set (SOURCES Line 54  set (SOURCES
54    qsamplerChannelForm.cpp    qsamplerChannelForm.cpp
55    qsamplerChannelFxForm.cpp    qsamplerChannelFxForm.cpp
56    qsamplerOptionsForm.cpp    qsamplerOptionsForm.cpp
57      qsamplerPaletteForm.cpp
58    qsamplerMainForm.cpp    qsamplerMainForm.cpp
59  )  )
60    
# Line 79  set (FORMS Line 66  set (FORMS
66    qsamplerChannelForm.ui    qsamplerChannelForm.ui
67    qsamplerChannelFxForm.ui    qsamplerChannelFxForm.ui
68    qsamplerOptionsForm.ui    qsamplerOptionsForm.ui
69      qsamplerPaletteForm.ui
70    qsamplerMainForm.ui    qsamplerMainForm.ui
71  )  )
72    
# Line 92  set (TRANSLATIONS Line 80  set (TRANSLATIONS
80    translations/qsampler_ru.ts    translations/qsampler_ru.ts
81  )  )
82    
83  qt5_add_translation ( QM_FILES ${TRANSLATIONS} )  if (QT_VERSION VERSION_LESS 5.15.0)
84  add_custom_target( translations ALL DEPENDS ${QM_FILES} )    qt5_add_translation (QM_FILES ${TRANSLATIONS})
85    else ()
86      qt_add_translation (QM_FILES ${TRANSLATIONS})
87    endif ()
88    
89    add_custom_target (translations ALL DEPENDS ${QM_FILES})
90    
91    if (WIN32)
92      set (RC_FILE ${CMAKE_CURRENT_SOURCE_DIR}/win32/${PROJECT_NAME}.rc)
93      set (RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.res.obj)
94      find_program (WINDRES_EXECUTABLE NAMES windres mingw32-windres i686-mingw32-windres)
95      if (MINGW)
96        exec_program (${WINDRES_EXECUTABLE}
97          ARGS "-i ${RC_FILE} -o ${RES_FILE} --include-dir=${CMAKE_CURRENT_SOURCE_DIR}/images")
98        list (APPEND SOURCES ${RES_FILE})
99      else ()
100        list (APPEND SOURCES ${RC_FILE})
101      endif ()
102    endif ()
103    
104    if (APPLE)
105      set (ICON_FILE ${CMAKE_CURRENT_SOURCE_DIR}/images/${PROJECT_NAME}.icns)
106      list (APPEND SOURCES ${ICON_FILE})
107      set (MACOSX_BUNDLE_ICON_FILE ${PROJECT_NAME}.icns)
108      set_source_files_properties (${ICON_FILE} PROPERTIES
109        MACOSX_PACKAGE_LOCATION Resources)
110    endif ()
111    
112    
113  qt5_wrap_ui (UI_SOURCES ${FORMS})  add_executable (${PROJECT_NAME}
114  qt5_wrap_cpp (MOC_SOURCES ${HEADERS})    ${HEADERS}
 qt5_add_resources (QRC_SOURCES ${RESOURCES})  
   
 add_executable (qsampler  
   ${UI_SOURCES}  
   ${MOC_SOURCES}  
   ${QRC_SOURCES}  
115    ${SOURCES}    ${SOURCES}
116      ${FORMS}
117      ${RESOURCES}
118  )  )
119    
120  target_link_libraries (qsampler  # Add some debugger flags.
121    ${QT_LIBRARIES}  if (CONFIG_DEBUG AND UNIX AND NOT APPLE)
122    ${LSCP_LIBRARIES}    target_compile_options (${PROJECT_NAME} PRIVATE -g -fsanitize=address -fno-omit-frame-pointer)
123  )    target_link_libraries (${PROJECT_NAME} PRIVATE asan)
124    endif ()
125    
126    set_target_properties (${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)
127    
128    if (WIN32)
129      set_target_properties (${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE true)
130    endif ()
131    
132    if (APPLE)
133      set_target_properties (${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE true)
134    endif ()
135    
136    target_link_libraries (${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
137    
138    if (CONFIG_XUNIQUE)
139      target_link_libraries (${PROJECT_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Network)
140    endif ()
141    
142    if (CONFIG_LIBLSCP)
143      target_link_libraries (${PROJECT_NAME} PRIVATE PkgConfig::LSCP)
144    endif ()
145    
146  if (CONFIG_LIBGIG)  if (CONFIG_LIBGIG)
147    target_link_libraries (qsampler ${GIG_LIBRARIES})    target_link_libraries (${PROJECT_NAME} PRIVATE PkgConfig::GIG)
148  endif ()  endif ()
149    
 qt5_use_modules (qsampler Core Gui Widgets Network)  
150    
151  if (UNIX AND NOT APPLE)  if (UNIX AND NOT APPLE)
152    install (TARGETS qsampler    install (TARGETS ${PROJECT_NAME} RUNTIME
153       RUNTIME DESTINATION bin)       DESTINATION ${CMAKE_INSTALL_BINDIR})
154    install (FILES ${QM_FILES}    install (FILES ${QM_FILES}
155       DESTINATION share/qsampler/translations)       DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations)
156    install (FILES ${CMAKE_CURRENT_BINARY_DIR}/qsampler.desktop    install (FILES ${PROJECT_NAME}.desktop
157       DESTINATION share/applications)       DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
158    install (FILES images/qsampler.png    install (FILES images/${PROJECT_NAME}.png
159       DESTINATION share/pixmaps)       DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps)
160    install (FILES appdata/qsampler.appdata.xml    install (FILES images/${PROJECT_NAME}.svg
161       DESTINATION share/metainfo)       DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps)
162      install (FILES appdata/${PROJECT_NAME}.appdata.xml
163         DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
164      install (FILES mimetypes/${PROJECT_NAME}.xml
165         DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages)
166      install (FILES mimetypes/application-x-${PROJECT_NAME}-session.png
167         DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/mimetypes)
168      install (FILES mimetypes/application-x-${PROJECT_NAME}-session.svg
169         DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/mimetypes)
170    endif ()
171    
172    if (WIN32)
173       install (TARGETS ${PROJECT_NAME} RUNTIME
174         DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
175       install (FILES ${QM_FILES}
176         DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations)
177  endif ()  endif ()

Legend:
Removed from v.3568  
changed lines
  Added in v.4005

  ViewVC Help
Powered by ViewVC