1 /******************************************************************************
2  *
3  * Project:  OpenCPN
4  * Purpose:  Global Build Options
5  * Author:   David Register
6  *
7  ***************************************************************************
8  *   Copyright (C) 2010 by David S. Register   *
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  *   This program is distributed in the hope that it will be useful,       *
16  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
17  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
18  *   GNU General Public License for more details.                          *
19  *                                                                         *
20  *   You should have received a copy of the GNU General Public License     *
21  *   along with this program; if not, write to the                         *
22  *   Free Software Foundation, Inc.,                                       *
23  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,  USA.         *
24  ***************************************************************************
25  *
26  */
27 
28 //----------------------------------------------------------------------------------
29 //          Global Build options for opencpn
30 //----------------------------------------------------------------------------------
31 #ifndef _DYCHART_H_
32 #define _DYCHART_H_
33 
34 #include "config.h"
35 
36 #include <cmath>
37 #include <algorithm>
38 
39 
40 //    Profiling support
41 
42 //#include "/usr/include/valgrind/callgrind.h"
43 
44 //  Chart cacheing policy defaults
45 
46 #define CACHE_N_LIMIT_DEFAULT 20          // Cache no more than n charts
47 
48 #define CACHE_MEM_LIMIT_DEFAULT 0       // Application memory useage target, kBytes
49 
50 
51 
52 //          If defined, update the system time using GPS receiver data.
53 //          Time update is applied if the system time and GPS time differ
54 //          by more than one minute, and only once per session.
55 //          On Linux, this option requires root privileges, obtained by sudo.
56 //          Thus, the following line is required in etc/sudoers:
57 //
58 //              nav ALL=NOPASSWD:/bin/date -s *
59 //
60 //          Where "nav" is the user's user name.
61 //
62 //          Also, the opencpn configuration file must contain the key
63 //          [Settings]
64 //              SetSystemTime=1
65 //          For security, this option is not available on the "Options" dialog
66 #define ocpnUPDATE_SYSTEM_TIME
67 
68 
69 //------------------------------------------------------------------------------
70 //          Some private, app global type definitions
71 //------------------------------------------------------------------------------
72 
73 //------------------------------------------------------------------------------
74 //          Various compile time options
75 //------------------------------------------------------------------------------
76 
77 #ifdef __MSVC__
78 #pragma warning(disable:4114)
79 #pragma warning(disable:4284)             // This one is to do with "reverse iterator UDT..." Huh?
80 #endif
81 
82 //    Following definition required by GDAL
83 #define notdef 1
84 
85 #ifdef __MSVC__
86 //    __MSVC__ randomly does not link snprintf, or _snprintf
87 //    Replace it with a local version, code is in cutil.c
88 #undef snprintf
89 #define snprintf mysnprintf
90 #endif
91 
92 //------------------------------------------------------------------------------
93 //          Some Build constants
94 //------------------------------------------------------------------------------
95 
96 //    Home Base, used if the config file lat/lon seems bogus or missing
97 
98 //#define START_LAT   35.1025              // New Bern (Ver 1.0)
99 //#define START_LON  -77.0342
100 
101 //#define START_LAT   26.783               // Green Turtle Key  (Ver 1.2)
102 //#define START_LON  -77.333
103 
104 //#define START_LAT   25.786               //  Miami Beach (Ver 1.2.2)
105 //#define START_LON  -80.148
106 
107 #define START_LAT   33.358               //  Georgetown, SC (Ver 1.2.4)
108 #define START_LON  -79.282
109 
110 //------------------------------------------------------------------------------
111 //          Some MSW and MSVCRT Specific Includes
112 //------------------------------------------------------------------------------
113 #ifdef __WXMSW__
114     #include "wx/msw/private.h"
115 #endif
116 
117 //------------------------------------------------------------------------------
118 //          Some Memory Leak Detection Code
119 //------------------------------------------------------------------------------
120 
121 
122 
123 #ifdef __MSVC__
124         #ifdef _DEBUG
125             #define _CRTDBG_MAP_ALLOC
126             #include <crtdbg.h>
127             #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__ )
128             #define new DEBUG_NEW
129         #endif
130 #endif
131 
132 
133 //----------------------------------------------------------------------------
134 //          Environment Access functions
135 //----------------------------------------------------------------------------
136 #ifdef __MSVC__
137 #define _putenv _putenv       // This is for MSVC
138 #else
139 #define _putenv putenv        // This is for other Windows compiler
140 #endif
141 
142 //----------------------------------------------------------------------------
143 //              Use the CPL Portability library only if S57 is enabled
144 //----------------------------------------------------------------------------
145 
146 #define USE_CPL
147 #include "gdal/cpl_port.h"
148 
149 #ifndef NULL
150 #define NULL 0
151 #endif
152 
153 
154 
155 /***********************************************************************
156  * Define __POSIX__ to imply posix thread model compatibility
157  * Especially used for communication port multithreading.
158  *
159  * Posix thread model is available on selected platforms, see code.
160  */
161 
162 #ifdef __POSIX__
163 #undef __POSIX__
164 #endif
165 
166 #ifdef  __WXOSX__
167 #define __POSIX__
168 #endif
169 
170 #ifdef  __WXGTK__
171 #define __POSIX__
172 #endif
173 
174 #ifndef OCPN_GL_INCLUDES
175 #define OCPN_GL_INCLUDES 1
176 
177 
178 #ifdef __WXMSW__
179     #include "GL/gl.h"            // local copy for Windows
180     #include "GL/glu.h"
181 #else
182     #ifndef __OCPN__ANDROID__
183         #include <GL/gl.h>
184         #include <GL/glu.h>
185         #include <GL/glext.h>
186     #else
187         #include <qopengl.h>
188         #include <GL/gl_private.h>              // this is a cut-down version of gl.h
189                                                 // which allows use of gl functions with gles2 headers
190                                                 // to be included as well, and avoids colisions.
191     #endif
192 
193 #endif
194 
195 #endif      //OCPN_GL_INCLUDES
196 
197 #ifdef __OCPN__ANDROID__
198 #include "qdebug.h"
199 #endif
200 
201 #endif      // __FILE__
202