blob: d6d050286922a79d99e74a2f6df917c6fde3de5f [file] [log] [blame]
Alexandre Lision10e86dd2015-01-19 16:11:14 -05001CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2
3IF(POLICY CMP0022)
4 CMAKE_POLICY(SET CMP0022 NEW)
5ENDIF(POLICY CMP0022)
6
Alexandre Lisionb47b4c82015-01-20 11:29:03 -05007SET(PROJ_NAME Ring)
8SET(RING_VERSION 1.0)
9
Alexandre Lision5855b6a2015-02-03 11:31:05 -050010ADD_DEFINITIONS("-std=c++11")
11
Alexandre Lisionb47b4c82015-01-20 11:29:03 -050012PROJECT(${PROJ_NAME})
Alexandre Lision10e86dd2015-01-19 16:11:14 -050013
Alexandre Lision10e86dd2015-01-19 16:11:14 -050014FIND_PACKAGE(Qt5Core REQUIRED)
Alexandre Lision10e86dd2015-01-19 16:11:14 -050015FIND_PACKAGE(Qt5Widgets REQUIRED)
16FIND_PACKAGE(LibRingClient REQUIRED)
17
Alexandre Lision10e86dd2015-01-19 16:11:14 -050018INCLUDE_DIRECTORIES(SYSTEM ${Qt5Core_INCLUDE_DIRS})
Alexandre Lision10e86dd2015-01-19 16:11:14 -050019INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
20INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR})
21INCLUDE_DIRECTORIES(${LIB_RING_CLIENT_INCLUDE_DIR})
22
23MESSAGE("LibRingClient is here:" ${LIB_RING_CLIENT_INCLUDE_DIR})
24SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
25
26#Files to compile
27SET(ringclient_SRCS
Alexandre Lision5855b6a2015-02-03 11:31:05 -050028 main.mm
29 AppDelegate.mm
30 RingWindowController.mm
31 ConversationsViewController.mm
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050032 PreferencesViewController.mm
Alexandre Lision5855b6a2015-02-03 11:31:05 -050033 QNSTreeController.mm
Alexandre Lisionf5fc4792015-03-17 09:15:43 -040034 AccGeneralVC.mm
35 AccAudioVC.mm
36 AccVideoVC.mm
37 AccRingVC.mm
38 AccAdvancedVC.mm
39 AccSecurityVC.mm
40 AccountsVC.mm
Alexandre Lisionc5148052015-03-04 15:10:35 -050041 CurrentCallVC.mm
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050042 AudioPrefsVC.mm
43 VideoPrefsVC.mm
44 GeneralPrefsVC.mm
Alexandre Lision745e4d62015-03-22 20:03:10 -040045 RingWizardWC.mm
Alexandre Lision5855b6a2015-02-03 11:31:05 -050046 HistoryViewController.mm
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050047 MinimalHistoryBackend.mm)
Alexandre Lision10e86dd2015-01-19 16:11:14 -050048
Alexandre Lisionf241c6a2015-03-24 14:53:47 -040049SET(ringclient_XIBS
50 MainMenu
51 RingWindow
52 CurrentCall
53 GeneralPrefs
54 Accounts
55 AccGeneral
56 AccAudio
57 AccVideo
58 AccRing
59 AccAdvanced
60 AccSecurity
61 AudioPrefs
62 VideoPrefs
63 PreferencesScreen
64 RingWizard)
Alexandre Lision10e86dd2015-01-19 16:11:14 -050065
66SET(ringclient_HDRS
Alexandre Lision5855b6a2015-02-03 11:31:05 -050067 AppDelegate.h
68 RingWindowController.h
Alexandre Lisionc5148052015-03-04 15:10:35 -050069 CurrentCallVC.h
Alexandre Lision5855b6a2015-02-03 11:31:05 -050070 ConversationsViewController.h
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050071 PreferencesViewController.h
Alexandre Lisionf5fc4792015-03-17 09:15:43 -040072 AccGeneralVC.h
73 AccVideoVC.h
74 AccAudioVC.h
75 AccRingVC.h
76 AccAdvancedVC.h
77 AccSecurityVC.h
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050078 AudioPrefsVC.h
Alexandre Lisionf5fc4792015-03-17 09:15:43 -040079 AccountsVC.h
Alexandre Lision4a7b95e2015-02-20 10:06:43 -050080 VideoPrefsVC.h
81 GeneralPrefsVC.h
Alexandre Lision5855b6a2015-02-03 11:31:05 -050082 HistoryViewController.h
Alexandre Lision745e4d62015-03-22 20:03:10 -040083 RingWizardWC.h
Alexandre Lision5855b6a2015-02-03 11:31:05 -050084 QNSTreeController.h
85 MinimalHistoryBackend.h)
Alexandre Lision10e86dd2015-01-19 16:11:14 -050086
Alexandre Lision10e86dd2015-01-19 16:11:14 -050087# Icons
88
Alexandre Lision5db3e4e2015-03-24 17:25:55 -040089# This part tells CMake where to find and install the file itself
Alexandre Lision10e86dd2015-01-19 16:11:14 -050090SET(myApp_ICON ${CMAKE_CURRENT_SOURCE_DIR}/data/appicon.icns)
91SET_SOURCE_FILES_PROPERTIES(${myApp_ICON} PROPERTIES
92 MACOSX_PACKAGE_LOCATION "Resources")
93
Alexandre Lision392ee722015-01-23 16:27:10 -050094SET(ring_ICONS ${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_accept.png
95${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_call.png
96${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_cancel.png
97${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_email.png
98${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_new_email.png
99${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_search.png
Alexandre Lision4a7b95e2015-02-20 10:06:43 -0500100${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ancrage.png
101${CMAKE_CURRENT_SOURCE_DIR}/data/dark/audio.png
102${CMAKE_CURRENT_SOURCE_DIR}/data/dark/general.png
103${CMAKE_CURRENT_SOURCE_DIR}/data/dark/video.png
Alexandre Lision392ee722015-01-23 16:27:10 -0500104${CMAKE_CURRENT_SOURCE_DIR}/data/dark/ic_action_video.png)
Alexandre Lision5db3e4e2015-03-24 17:25:55 -0400105
Alexandre Lision392ee722015-01-23 16:27:10 -0500106SET_SOURCE_FILES_PROPERTIES(${ring_ICONS} PROPERTIES
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500107 MACOSX_PACKAGE_LOCATION Resources)
Alexandre Lision392ee722015-01-23 16:27:10 -0500108
Alexandre Lision5db3e4e2015-03-24 17:25:55 -0400109# append '.xib' extension before linking xib files in executable
110FOREACH(xib ${ringclient_XIBS})
111 SET(ringclient_XIBS_FOR_EXECUTABLE ${ringclient_XIBS_FOR_EXECUTABLE} ${xib}.xib)
112ENDFOREACH()
113
Alexandre Lisionb47b4c82015-01-20 11:29:03 -0500114ADD_EXECUTABLE(${PROJ_NAME} MACOSX_BUNDLE
Alexandre Lision10e86dd2015-01-19 16:11:14 -0500115 ${ringclient_SRCS}
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500116 ${ringclient_HDRS}
Alexandre Lision5db3e4e2015-03-24 17:25:55 -0400117 ${ringclient_XIBS_FOR_EXECUTABLE}
Alexandre Lision392ee722015-01-23 16:27:10 -0500118 ${myApp_ICON}
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500119 ${ring_ICONS})
120
Alexandre Lisionb47b4c82015-01-20 11:29:03 -0500121TARGET_LINK_LIBRARIES( ${PROJ_NAME}
Alexandre Lision10e86dd2015-01-19 16:11:14 -0500122 ${LIB_RING_CLIENT_LIBRARY}
Alexandre Lision5855b6a2015-02-03 11:31:05 -0500123 ${Qt5Core_LIBRARIES}
Alexandre Lision10e86dd2015-01-19 16:11:14 -0500124 ${Qt5Widgets_LIBRARIES}
Alexandre Lision10e86dd2015-01-19 16:11:14 -0500125)
126
Alexandre Lisionf241c6a2015-03-24 14:53:47 -0400127SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AppKit")
128SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Cocoa")
129SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Quartz")
130SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AVFoundation")
131SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework AddressBook")
132
133# These variables are specific to our plist and are NOT standard CMake variables
134set(MACOSX_BUNDLE_NSMAIN_NIB_FILE "MainMenu")
135set(MACOSX_BUNDLE_NSPRINCIPAL_CLASS "NSApplication")
Alexandre Lision392ee722015-01-23 16:27:10 -0500136
Alexandre Lisionb47b4c82015-01-20 11:29:03 -0500137SET_TARGET_PROPERTIES(${PROJ_NAME} PROPERTIES
138 MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/cmake/MacOSXBundleInfo.plist.in
139 MACOSX_BUNDLE_GUI_IDENTIFIER "cx.ring"
140 MACOSX_BUNDLE_SHORT_VERSION_STRING ${RING_VERSION}
141 MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJ_NAME} ${RING_VERSION} Nightly"
142 MACOSX_BUNDLE_BUNDLE_VERSION ${RING_VERSION}
143 MACOSX_BUNDLE_COPYRIGHT "${PROJ_NAME}"
144 MACOSX_BUNDLE_INFO_STRING "Nightly build of ${PROJ_NAME} ${RING_VERSION} for testing and development"
145 MACOSX_BUNDLE_BUNDLE_NAME ${PROJ_NAME}
146 MACOSX_BUNDLE_ICON_FILE "appicon.icns"
147 )
Alexandre Lisionf241c6a2015-03-24 14:53:47 -0400148
149# Make sure we can find the 'ibtool' program. If we can NOT find it we
150# skip generation of this project
151FIND_PROGRAM(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin")
152IF(${IBTOOL} STREQUAL "IBTOOL-NOTFOUND")
153 MESSAGE(SEND_ERROR "ibtool can not be found and is needed to compile the .xib files. It should have been installed with
154 the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin")
155endif()
156
157# Make sure the 'Resources' Directory is correctly created before we build
158ADD_CUSTOM_COMMAND(TARGET ${PROJ_NAME} PRE_BUILD
159 COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/\${CONFIGURATION}/${PROJ_NAME}.app/Contents/Resources)
160
161# Compile the .xib files using the 'ibtool' program with the destination being the app package
162FOREACH(xib ${ringclient_XIBS})
163 ADD_CUSTOM_COMMAND(TARGET ${PROJ_NAME} POST_BUILD
164 COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text
165 --compile ${CMAKE_CURRENT_BINARY_DIR}/\${CONFIGURATION}/${PROJ_NAME}.app/Contents/Resources/${xib}.nib
166 ${CMAKE_CURRENT_SOURCE_DIR}/${xib}.xib
167 COMMENT "Compiling ${CMAKE_CURRENT_SOURCE_DIR}/${xib}.xib")
168
169ENDFOREACH()