-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
245 lines (202 loc) · 7.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
##---------------------------------------------------------------------------
## Author: bdbcat aka. dsr (Dave Register)
## Copyright:
## License: wxWidgets License
##---------------------------------------------------------------------------
# define minimum cmake version
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2)
# This should be 2.8.0 to have FindGTK2 module
IF (COMMAND cmake_policy)
CMAKE_POLICY(SET CMP0003 OLD)
CMAKE_POLICY(SET CMP0005 OLD)
CMAKE_POLICY(SET CMP0011 OLD)
ENDIF (COMMAND cmake_policy)
PROJECT(logbookkonni_pi)
SET(PACKAGE_NAME logbookkonni_pi)
SET(PLUGIN_SOURCE_DIR .)
MESSAGE (STATUS "*** Building ${PACKAGE_NAME} ***")
#SET(CMAKE_BUILD_TYPE Debug)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
# require proper c++
#ADD_DEFINITIONS( "-Wall -ansi -pedantic -Wno-variadic-macros" )
#TODO: Should we use -fno-stack-protector
# IF NOT DEBUGGING CFLAGS="-O2 -march=native"
IF(NOT WIN32)
ADD_DEFINITIONS( "-Wall -O3 -fexceptions -fvisibility=hidden" )
IF(NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,-Bsymbolic")
ELSE(NOT APPLE)
SET(CMAKE_SHARED_LINKER_FLAGS "-Wl -undefined dynamic_lookup")
ENDIF(NOT APPLE)
ENDIF(NOT WIN32)
# Add some definitions to satisfy MS
IF(WIN32)
ADD_DEFINITIONS(-D__MSVC__)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_DEPRECATE)
ENDIF(WIN32)
INCLUDE(${wxWidgets_USE_FILE})
FIND_PACKAGE(Gettext REQUIRED)
# For convenience we define the sources as a variable. You can add
# header files and cpp/c files and CMake will sort them out
SET(SRC_LOGBOOKKONNI
src/logbook_pi.h
src/logbook_pi.cpp
src/Options.h
src/Options.cpp
src/icons.h
src/icons.cpp
src/Logbook.h
src/Logbook.cpp
src/LogbookDialog.h
src/LogbookDialog.cpp
src/LogbookOptions.h
src/LogbookOptions.cpp
src/LogbookHTML.h
src/LogbookHTML.cpp
src/CrewList.h
src/CrewList.cpp
src/boat.h
src/boat.cpp
src/Maintenance.h
src/Maintenance.cpp
src/OverView.h
src/OverView.cpp
src/Export.h
src/Export.cpp
src/FastComboEditor.h
src/FastComboEditor.cpp
src/EzGrid.h
src/EzGrid.cpp
src/GridCellChoiceRenderer.h
src/GridCellChoiceRenderer.cpp
)
SET(SRC_NMEA0183
src/nmea0183/LatLong.hpp
src/nmea0183/latlong.cpp
src/nmea0183/long.cpp
src/nmea0183/nmea0183.cpp
src/nmea0183/nmea0183.hpp
src/nmea0183/Response.hpp
src/nmea0183/response.cpp
src/nmea0183/RMB.hpp
src/nmea0183/rmb.cpp
src/nmea0183/Sentence.hpp
src/nmea0183/sentence.cpp
src/nmea0183/talkerid.cpp
src/nmea0183/RMC.HPP
src/nmea0183/rmc.cpp
src/nmea0183/hexvalue.cpp
src/nmea0183/lat.cpp
src/nmea0183/expid.cpp
src/nmea0183/wpl.hpp
src/nmea0183/wpl.cpp
src/nmea0183/rte.hpp
src/nmea0183/rte.cpp
src/nmea0183/hdt.hpp
src/nmea0183/hdt.cpp
src/nmea0183/hdg.hpp
src/nmea0183/hdg.cpp
src/nmea0183/hdm.hpp
src/nmea0183/hdm.cpp
src/nmea0183/gll.hpp
src/nmea0183/gll.cpp
src/nmea0183/vtg.hpp
src/nmea0183/vtg.cpp
src/nmea0183/gga.hpp
src/nmea0183/gga.cpp
src/nmea0183/gsv.hpp
src/nmea0183/gsv.cpp
src/nmea0183/dbt.cpp
src/nmea0183/dbt.hpp
src/nmea0183/dpt.cpp
src/nmea0183/dpt.hpp
src/nmea0183/mtw.cpp
src/nmea0183/mtw.hpp
src/nmea0183/mwv.cpp
src/nmea0183/mwv.hpp
src/nmea0183/vhw.hpp
src/nmea0183/vhw.cpp
src/nmea0183/vwr.cpp
src/nmea0183/vwr.hpp
src/nmea0183/zda.cpp
src/nmea0183/zda.hpp
src/nmea0183/rsa.hpp
src/nmea0183/rsa.cpp
src/nmea0183/SatInfo.h
)
INCLUDE_DIRECTORIES(src/nmea0183)
ADD_LIBRARY(${PACKAGE_NAME} SHARED ${SRC_LOGBOOKKONNI} ${SRC_NMEA0183} )
IF(WIN32)
SET(OPENCPN_IMPORT_LIB "../../${CMAKE_CFG_INTDIR}/${PARENT}")
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${OPENCPN_IMPORT_LIB} )
ADD_DEPENDENCIES(${PACKAGE_NAME} ${PARENT})
ENDIF(WIN32)
TARGET_LINK_LIBRARIES( ${PACKAGE_NAME} ${wxWidgets_LIBRARIES} )
IF(APPLE)
INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME LIBRARY DESTINATION ${CMAKE_BINARY_DIR}/OpenCPN.app/Contents/PlugIns)
ENDIF(APPLE)
IF(UNIX AND NOT APPLE)
INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME LIBRARY DESTINATION ${PREFIX_PLUGINS})
ENDIF(UNIX AND NOT APPLE)
IF(WIN32)
INSTALL(TARGETS ${PACKAGE_NAME} RUNTIME DESTINATION "plugins")
ENDIF(WIN32)
# find src/ -name \*.cpp -or -name \*.c -or -name \*.h -or -name \*.hpp >po/POTFILES.in
FIND_PROGRAM(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
IF (GETTEXT_XGETTEXT_EXECUTABLE)
ADD_CUSTOM_COMMAND(
OUTPUT po/${PACKAGE_NAME}.pot.dummy
COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} --force-po --package-name=${PACKAGE_NAME} --package-version="${PACKAGE_VERSION}" --output=po/${PACKAGE_NAME}.pot --keyword=_ --width=80 --files-from=${CMAKE_CURRENT_SOURCE_DIR}/po/POTFILES.in
DEPENDS po/POTFILES.in po/${PACKAGE_NAME}.pot
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "logbookkonni-pot-update [${PACKAGE_NAME}]: Generated pot file."
)
ADD_CUSTOM_TARGET(logbookkonni-pot-update COMMENT "logbookkonni-pot-update: Done." DEPENDS po/${PACKAGE_NAME}.pot.dummy)
ENDIF(GETTEXT_XGETTEXT_EXECUTABLE )
MACRO(GETTEXT_UPDATE_PO _potFile)
SET(_poFiles ${_potFile})
GET_FILENAME_COMPONENT(_absPotFile ${_potFile} ABSOLUTE)
FOREACH (_currentPoFile ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_currentPoFile} ABSOLUTE)
GET_FILENAME_COMPONENT(_poBasename ${_absFile} NAME_WE)
ADD_CUSTOM_COMMAND(
OUTPUT ${_absFile}.dummy
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --width=80 --strict --quiet --update --backup=none --no-location -s ${_absFile} ${_absPotFile}
DEPENDS ${_absPotFile} ${_absFile}
COMMENT "logbookkonni-po-update [${_poBasename}]: Updated po file."
)
SET(_poFiles ${_poFiles} ${_absFile}.dummy)
ENDFOREACH (_currentPoFile )
ADD_CUSTOM_TARGET(logbookkonni-po-update COMMENT "logbookkonni-po-update: Done." DEPENDS ${_poFiles})
ENDMACRO(GETTEXT_UPDATE_PO)
IF (GETTEXT_MSGMERGE_EXECUTABLE)
FILE(GLOB PACKAGE_PO_FILES po/*.po)
GETTEXT_UPDATE_PO(po/${PACKAGE_NAME}.pot ${PACKAGE_PO_FILES})
ENDIF(GETTEXT_MSGMERGE_EXECUTABLE)
SET(_gmoFiles)
MACRO(GETTEXT_BUILD_MO)
FOREACH (_poFile ${ARGN})
GET_FILENAME_COMPONENT(_absFile ${_poFile} ABSOLUTE)
GET_FILENAME_COMPONENT(_poBasename ${_absFile} NAME_WE)
SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_poBasename}.mo)
ADD_CUSTOM_COMMAND(
OUTPUT ${_gmoFile}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${_gmoFile} ${_absFile}
DEPENDS ${_absFile}
COMMENT "logbookkonni-i18n [${_poBasename}]: Created mo file."
)
IF(APPLE)
INSTALL(FILES ${_gmoFile} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/OpenCPN.app/Contents/Resources/${_poBasename}.lproj RENAME opencpn-${PACKAGE_NAME}.mo )
ELSE(APPLE)
INSTALL(FILES ${_gmoFile} DESTINATION ${PREFIX_DATA}/locale/${_poBasename}/LC_MESSAGES RENAME opencpn-${PACKAGE_NAME}.mo )
ENDIF(APPLE)
SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
ENDFOREACH (_poFile )
ENDMACRO(GETTEXT_BUILD_MO)
if(GETTEXT_MSGFMT_EXECUTABLE)
FILE(GLOB PACKAGE_PO_FILES po/*.po)
GETTEXT_BUILD_MO(${PACKAGE_PO_FILES})
ADD_CUSTOM_TARGET(logbookkonni-i18n COMMENT "logbookkonni-i18n: Done." DEPENDS ${_gmoFiles})
#ADD_DEPENDENCIES(logbookkonni-i18n ${PACKAGE_PO_FILES})
ADD_DEPENDENCIES(${PACKAGE_NAME} logbookkonni-i18n)
ENDIF(GETTEXT_MSGFMT_EXECUTABLE)