|
| 1 | +#============================================================================ |
| 2 | +# |
| 3 | +# Copyright (c) Kitware, Inc. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0.txt |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | +#============================================================================ |
| 18 | + |
| 19 | +set(APPLICATION_NAME ${Slicer_MAIN_PROJECT_APPLICATION_NAME}) |
| 20 | + |
| 21 | +project(${APPLICATION_NAME}App) |
| 22 | + |
| 23 | +include(SlicerMacroBuildApplication) |
| 24 | + |
| 25 | +# -------------------------------------------------------------------------- |
| 26 | +# Slicer supports more than one application (i.e. an application |
| 27 | +# "OtherApp" in addition to "APPLICATION_NAMEApp"). |
| 28 | +# |
| 29 | +# In that specific case, it is required to differentiate the two applications |
| 30 | +# and specify which one should be considered as the *Main* one. |
| 31 | +# |
| 32 | +# This is usually done within the top level CMakeLists.txt file by setting the variable |
| 33 | +# Slicer_MAIN_PROJECT. |
| 34 | +# |
| 35 | +# Within the Applications/OtherApp/CMakeLists.txt of the secondary application, |
| 36 | +# the project name should be updated, the variable 'SlicerApp_APPLICATION_NAME' |
| 37 | +# could also be optionnally set to a custom value. |
| 38 | +# |
| 39 | + |
| 40 | +if(${PROJECT_NAME} STREQUAL ${Slicer_MAIN_PROJECT}) |
| 41 | + set(SlicerApp_APPLICATION_NAME ${APPLICATION_NAME}) |
| 42 | +endif() |
| 43 | + |
| 44 | +# -------------------------------------------------------------------------- |
| 45 | +# Project dependencies |
| 46 | +# -------------------------------------------------------------------------- |
| 47 | +find_package(${APPLICATION_NAME} REQUIRED) |
| 48 | +include(${${APPLICATION_NAME}_USE_FILE}) |
| 49 | + |
| 50 | +set(${PROJECT_NAME}_VERSION_MAJOR ${${APPLICATION_NAME}_VERSION_MAJOR}) |
| 51 | +set(${PROJECT_NAME}_VERSION_MINOR ${${APPLICATION_NAME}_VERSION_MINOR}) |
| 52 | +set(${PROJECT_NAME}_VERSION_PATCH ${${APPLICATION_NAME}_VERSION_PATCH}) |
| 53 | +if(DEFINED ${APPLICATION_NAME}_VERSION_TWEAK) |
| 54 | + set(${PROJECT_NAME}_VERSION_TWEAK ${${APPLICATION_NAME}_VERSION_TWEAK}) |
| 55 | +endif() |
| 56 | +if(DEFINED ${APPLICATION_NAME}_VERSION_RC) |
| 57 | + set(${PROJECT_NAME}_VERSION_RC ${${APPLICATION_NAME}_VERSION_RC}) |
| 58 | +endif() |
| 59 | +set(${PROJECT_NAME}_VERSION_FULL ${${APPLICATION_NAME}_VERSION}) |
| 60 | + |
| 61 | +# -------------------------------------------------------------------------- |
| 62 | +# Folder |
| 63 | +# -------------------------------------------------------------------------- |
| 64 | +set(${PROJECT_NAME}_FOLDER "App-${PROJECT_NAME}") |
| 65 | + |
| 66 | +# -------------------------------------------------------------------------- |
| 67 | +# Application library |
| 68 | +# -------------------------------------------------------------------------- |
| 69 | + |
| 70 | +set(APPLIB_NAME "q${PROJECT_NAME}") |
| 71 | + |
| 72 | +set(APPLIB_DESCRIPTION_SUMMARY |
| 73 | + "Customized version of slicer for Ninja" |
| 74 | + ) |
| 75 | + |
| 76 | +set(APPLIB_SRCS |
| 77 | + qAppAboutDialog.cxx |
| 78 | + qAppAboutDialog.h |
| 79 | + qAppMainWindow.cxx |
| 80 | + qAppMainWindow.h |
| 81 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppAboutDialog.cxx |
| 82 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppAboutDialog.h |
| 83 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppErrorReportDialog.cxx |
| 84 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppErrorReportDialog.h |
| 85 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppMainWindow.cxx |
| 86 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppMainWindow.h |
| 87 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppMainWindow_p.h |
| 88 | + Widgets/qAppStyle.cxx |
| 89 | + Widgets/qAppStyle.h |
| 90 | + ) |
| 91 | + |
| 92 | +set(APPLIB_MOC_SRCS |
| 93 | + qAppAboutDialog.h |
| 94 | + qAppMainWindow.h |
| 95 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppAboutDialog.h |
| 96 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppErrorReportDialog.h |
| 97 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/qSlicerAppMainWindow.h |
| 98 | + Widgets/qAppStyle.h |
| 99 | + ) |
| 100 | + |
| 101 | +set(APPLIB_UI_SRCS |
| 102 | + Resources/UI/qAppAboutDialog.ui |
| 103 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/Resources/UI/qSlicerAppAboutDialog.ui |
| 104 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/Resources/UI/qSlicerAppErrorReportDialog.ui |
| 105 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/Resources/UI/qSlicerAppMainWindow.ui |
| 106 | + ) |
| 107 | + |
| 108 | +set(APPLIB_RESOURCES |
| 109 | + Resources/App.qrc |
| 110 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp/Resources/SlicerApp.qrc |
| 111 | + ${qSlicerBaseQTGUI_SOURCE_DIR}/Resources/qSlicerBaseQTGUI.qrc |
| 112 | + ${${APPLICATION_NAME}_SOURCE_DIR}/Utilities/Qt/Resources.qrc |
| 113 | + ) |
| 114 | + |
| 115 | +set(APPLIB_INCLUDE_DIRECTORIES |
| 116 | + ${Slicer_SOURCE_DIR}/Applications/SlicerApp |
| 117 | + ${Slicer_BINARY_DIR}/Applications/SlicerApp |
| 118 | + ) |
| 119 | + |
| 120 | +configure_file( |
| 121 | + qSlicerAppExport.h.in |
| 122 | + ${CMAKE_CURRENT_BINARY_DIR}/qSlicerAppExport.h |
| 123 | + ) |
| 124 | + |
| 125 | +slicerMacroBuildAppLibrary( |
| 126 | + NAME ${APPLIB_NAME} |
| 127 | + DESCRIPTION_SUMMARY ${APPLIB_DESCRIPTION_SUMMARY} |
| 128 | + DESCRIPTION_FILE ${Slicer_SOURCE_DIR}/README.txt |
| 129 | + APPLICATION_NAME ${SlicerApp_APPLICATION_NAME} |
| 130 | + EXPORT_DIRECTIVE "Q_SLICER_APP_EXPORT" |
| 131 | + FOLDER ${${PROJECT_NAME}_FOLDER} |
| 132 | + SRCS ${APPLIB_SRCS} |
| 133 | + MOC_SRCS ${APPLIB_MOC_SRCS} |
| 134 | + UI_SRCS ${APPLIB_UI_SRCS} |
| 135 | + INCLUDE_DIRECTORIES ${APPLIB_INCLUDE_DIRECTORIES} |
| 136 | + RESOURCES ${APPLIB_RESOURCES} |
| 137 | + ) |
| 138 | + |
| 139 | +# -------------------------------------------------------------------------- |
| 140 | +# Application executable |
| 141 | +# -------------------------------------------------------------------------- |
| 142 | + |
| 143 | +# Configure launcher only for the main application |
| 144 | +set(extra_args) |
| 145 | +if(${PROJECT_NAME} STREQUAL ${Slicer_MAIN_PROJECT}) |
| 146 | + set(extra_args CONFIGURE_LAUNCHER) |
| 147 | +endif() |
| 148 | + |
| 149 | +set(APP_SRCS |
| 150 | + Main.cxx |
| 151 | + ) |
| 152 | + |
| 153 | +slicerMacroBuildApplication( |
| 154 | + NAME ${PROJECT_NAME} |
| 155 | + APPLICATION_NAME ${${PROJECT_NAME}_APPLICATION_NAME} |
| 156 | + FOLDER ${${PROJECT_NAME}_FOLDER} |
| 157 | + APPLE_ICON_FILE "Resources/Icons/XLarge/DesktopIcon.icns" |
| 158 | + LAUNCHER_SPLASHSCREEN_FILE "Resources/Images/SplashScreen.png" |
| 159 | + WIN_ICON_FILE "Resources/App.ico" |
| 160 | + SRCS ${APP_SRCS} |
| 161 | + TARGET_LIBRARIES ${APPLIB_NAME} |
| 162 | + TARGET_NAME_VAR "APP_TARGET_NAME" |
| 163 | + ${extra_args} |
| 164 | + ) |
| 165 | + |
0 commit comments