aboutsummaryrefslogtreecommitdiff
path: root/ports/mathgl/fix_cmakelists_and_cpp.patch
blob: a929f1ebe8f05924ee118fa6e9f2382c7fefbaf8 (plain)
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
diff --git a/mgllab/CMakeLists.txt b/mgllab/CMakeLists.txt
index 1649104..eeec1c1 100644
--- a/mgllab/CMakeLists.txt
+++ b/mgllab/CMakeLists.txt
@@ -38,7 +38,11 @@ if(MGL_HAVE_FLTK)
 		set(mgllab_src ${mgllab_src} mgllab.rc)
 	endif(WIN32)
 	add_executable(mgllab ${mgllab_src} ${mgllab_hdr})
-	target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+	if(WIN32)
+		target_link_libraries(mgllab mgl mgl-fltk mgl-fltk-static mgl-static getopt-static ${FLTK_LIBRARIES})
+	else(WIN32)
+		target_link_libraries(mgllab mgl mgl-fltk ${FLTK_LIBRARIES})
+	endif(WIN32)	
 	install(
 		TARGETS mgllab
 		RUNTIME DESTINATION bin	)
diff --git a/mgllab/table.cpp b/mgllab/table.cpp
index 5243549..23eebe5 100644
--- a/mgllab/table.cpp
+++ b/mgllab/table.cpp
@@ -559,8 +559,13 @@ public:
 		o->tooltip(_("Change data values and close this window"));
 		w->set_modal();	w->end();
 	}
-	double min()	{	return wmin->value();	}
-	double max()	{	return wmax->value();	}
+	#if WIN32
+		double _min()	{	return wmin->value();	}
+		double _max()	{	return wmax->value();	}
+	#else
+		double min()	{	return wmin->value();	}
+		double max()	{	return wmax->value();	}	
+	#endif			
 	int sym()		{	return wsym->value();	}
 	bool ok()		{	return !result.empty();	}
 	void cb_ok()
@@ -581,8 +586,14 @@ void fill_cb(Fl_Widget*, void*v)
 		HMDT d = dynamic_cast<HMDT>(e->var);
 		HADT c = dynamic_cast<HADT>(e->var);
 		char ch = nrm_dlg.result[0];
-		if(d)	{	d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
-		if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+		#if WIN32
+			if(d)	{	d->Fill(nrm_dlg._min(),nrm_dlg._max(),ch);	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg._min(),nrm_dlg._max(),ch);	e->refresh();	}
+		#else
+			if(d)	{	d->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),ch);	e->refresh();	}
+		#endif		
+					
 	}
 }
 //-----------------------------------------------------------------------------
@@ -594,8 +605,13 @@ void normal_cb(Fl_Widget*, void*v)
 	{
 		HMDT d = dynamic_cast<HMDT>(e->var);
 		HADT c = dynamic_cast<HADT>(e->var);
-		if(d)	{	d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
-		if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+		#if WIN32
+			if(d)	{	d->Norm(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym());	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg._min(),nrm_dlg._max(),nrm_dlg.sym());	e->refresh();	}
+		#else
+			if(d)	{	d->Norm(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+			if(c)	{	c->Fill(nrm_dlg.min(),nrm_dlg.max(),nrm_dlg.sym());	e->refresh();	}
+		#endif				
 	}
 }
 //-----------------------------------------------------------------------------
diff --git a/src/parser.cpp b/src/parser.cpp
index 577191d..e6909a1 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -58,7 +58,10 @@ void mglParser::FillBaseCmd()
 HMDT MGL_NO_EXPORT mglFormulaCalc(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
 HADT MGL_NO_EXPORT mglFormulaCalcC(std::wstring string, mglParser *arg, const std::vector<mglDataA*> &head);
 //-----------------------------------------------------------------------------
+#ifndef MGL_ASK_FUNC
+#define MGL_ASK_FUNC
 MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
+#endif
 void MGL_EXPORT mgl_ask_gets(const wchar_t *quest, wchar_t *res)
 {	printf("%ls\n",quest);	if(!fgetws(res,1024,stdin))	*res=0;	}
 //-----------------------------------------------------------------------------
@@ -69,7 +72,10 @@ void MGL_EXPORT mgl_progress_txt(int value, int maximal, HMGL)
 	else	for(int i=prev;i<value;i++)	printf("#");
 	prev = value;	fflush(stdout);
 }
+#ifndef MGL_PROGRESS_FUNC
+#define MGL_PROGRESS_FUNC
 MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=mgl_progress_txt;
+#endif
 void MGL_EXPORT mgl_progress(int value, int maximal, HMGL gr)
 {	mgl_progress_func(value, maximal, gr);	}
 //-----------------------------------------------------------------------------
diff --git a/utils/mglview.cpp b/utils/mglview.cpp
index d360df3..7e2634b 100644
--- a/utils/mglview.cpp
+++ b/utils/mglview.cpp
@@ -29,6 +29,18 @@
 	#include "mgl2/qt.h"
 #endif
 //-----------------------------------------------------------------------------
+#ifdef WIN32
+#ifndef MGL_ASK_FUNC
+#define MGL_ASK_FUNC
+MGL_EXPORT void (*mgl_ask_func)(const wchar_t *, wchar_t *)=0;
+#endif
+#ifndef MGL_PROGRESS_FUNC
+#define MGL_PROGRESS_FUNC
+MGL_EXPORT void (*mgl_progress_func)(int value, int maximal, HMGL)=0;
+#endif
+MGL_EXPORT std::string mglGlobalMess;	///< Buffer for receiving global messages
+#endif
+//-----------------------------------------------------------------------------
 std::wstring str, opt;
 std::vector<std::string> anim;
 mglParse p(true);
diff --git a/include/mgl2/datac.h b/include/mgl2/datac.h
index f2c0251..0e69de7 100644
--- a/include/mgl2/datac.h
+++ b/include/mgl2/datac.h
@@ -474,7 +474,7 @@ using mglDataA::Momentum;
 	void set_v(mreal val, long i,long j=0,long k=0)	{	a[i+nx*(j+ny*k)]=val;	}
 #else
 	/// Get the value in given cell of the data with border checking
-	mreal v(long i,long j=0,long k=0) const	{	return mgl_abs(mgl_datac_get_value(this,i,j,k));	}
+	mreal v(long i,long j=0,long k=0) const	{	return abs(a[i+nx*(j+ny*k)]);	}
 	/// Set the value in given cell of the data
 	void set_v(mreal val, long i,long j=0,long k=0)	{	mgl_datac_set_value(this,val,i,j,k);	}
 #endif
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0c779d..acd9d7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -579,10 +579,15 @@ if(enable-glut)
 	if(NOT MGL_HAVE_OPENGL)
 		message(SEND_ERROR "You have to enable OpenGL if you plan to use GLUT.")
 	endif(NOT MGL_HAVE_OPENGL)
-	include(FindGLUT)
+    find_path(GLUT_INCLUDE_DIR freeglut.h PATH_SUFFIXES GL)
+    include(SelectLibraryConfigurations)
+    find_library(GLUT_LIBRARY_RELEASE NAMES freeglut)
+    find_library(GLUT_LIBRARY_DEBUG NAMES freeglutd)
+    select_library_configurations(GLUT)
 	if(NOT GLUT_FOUND)
 		message(SEND_ERROR "Couldn't find GLUT library.")
 	endif(NOT GLUT_FOUND)
+    include_directories(${GLUT_INCLUDE_DIR}/GL)
 else(enable-glut)
 	set(MGL_HAVE_GLUT 0)
 endif(enable-glut)