From 621d29416d8b4dd4b67ac11649b3835685336c69 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 11 Mar 2010 07:48:55 +0000
Subject: [PATCH] fix mingw build

---
 CMakeLists.txt                      | 22 ++++++++++++----------
 Fltk/extraDialogs.cpp               |  2 +-
 Solver/TESTCASES/RayleighTaylor.lua |  2 +-
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 535bb6112f..5d8d3218c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,10 @@ else(APPLE)
   set(GMSH_OS "${CMAKE_SYSTEM_NAME}")
 endif(APPLE)
 
+include(CheckTypeSize)
+include(CheckFunctionExists)
+include(CheckIncludeFile)
+
 if(MSVC)
   # remove really annoying (and stupid, and wrong) warning about
   # bool/int cast performance in Visual C++
@@ -162,7 +166,6 @@ endmacro(find_all_libraries)
 # check if the machine is 64 bits (this is more reliable than using
 # CMAKE_SIZEOF_VOID_P, which does not seem to work e.g. on some Suse
 # machines)
-include(CheckTypeSize)
 check_type_size("void*" SIZEOF_VOID_P)
 if(SIZEOF_VOID_P EQUAL 8)
   set(HAVE_64BIT_SIZE_T TRUE)
@@ -709,19 +712,17 @@ if(HAVE_LUA AND ENABLE_READLINE)
   endif(READLINE_LIB)
 endif(HAVE_LUA AND ENABLE_READLINE)
 
-include(CheckFunctionExists)
 check_function_exists(vsnprintf HAVE_VSNPRINTF)
 if(NOT HAVE_VSNPRINTF)
   set(HAVE_NO_VSNPRINTF TRUE)
   list(APPEND CONFIG_OPTIONS "NoVsnprintf")
 endif(NOT HAVE_VSNPRINTF)
 
-include(CheckIncludeFile)
 check_include_file(sys/socket.h HAVE_SYS_SOCKET_H)
 if(HAVE_SYS_SOCKET_H)
   set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h)
 endif(HAVE_SYS_SOCKET_H)
-include(CheckTypeSize)
+
 check_type_size(socklen_t SOCKLEN_T_SIZE)
 if(NOT SOCKLEN_T_SIZE)
   set(HAVE_NO_SOCKLEN_T TRUE)
@@ -729,6 +730,13 @@ if(NOT SOCKLEN_T_SIZE)
 endif(NOT SOCKLEN_T_SIZE)
 set(CMAKE_EXTRA_INCLUDE_FILES)
 
+check_include_file(dlfcn.h DLFCN_H)
+if(DLFCN_H)
+  set(HAVE_DLOPEN true)
+  list(APPEND CONFIG_OPTIONS "Dlopen")
+  list(APPEND EXTERNAL_LIBRARIES ${CMAKE_DL_LIB})
+endif(DLFCN_H)
+
 if(UNIX)
   # do not optimize some files on Unix
   file(GLOB_RECURSE NON_OPTIMIZED_SRC Common/GmshPredicates.cpp Mesh/BDS.cpp
@@ -736,12 +744,6 @@ if(UNIX)
   set_source_files_properties(${NON_OPTIMIZED_SRC} COMPILE_FLAGS "-O0")
 endif(UNIX)
 
-if(UNIX)
-  #DLOpen
-  set(HAVE_DLOPEN true)
-  list(APPEND EXTERNAL_LIBRARIES ${CMAKE_DL_LIB})
-endif(UNIX)
-
 if(MSVC)
   add_definitions(-D_USE_MATH_DEFINES -DNOMINMAX 
                   -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
diff --git a/Fltk/extraDialogs.cpp b/Fltk/extraDialogs.cpp
index 753b8b8a4c..a505d62a51 100644
--- a/Fltk/extraDialogs.cpp
+++ b/Fltk/extraDialogs.cpp
@@ -243,7 +243,7 @@ class historyChooser{
     : _prefix(prefix), _label(label), _commandLabel(commandLabel), 
       _defaultCommand(defaultCommand), _okLabel(okLabel)
   {
-    int x = 100, y = 100, h = 4 * WB + 10 * BH, w = 3 * BB + 2 * WB;
+    int h = 4 * WB + 10 * BH, w = 3 * BB + 2 * WB;
     window = new Fl_Double_Window(w, h);
     window->set_modal();
     window->label(_label.c_str());
diff --git a/Solver/TESTCASES/RayleighTaylor.lua b/Solver/TESTCASES/RayleighTaylor.lua
index 04c9f18298..3090f0c2d5 100644
--- a/Solver/TESTCASES/RayleighTaylor.lua
+++ b/Solver/TESTCASES/RayleighTaylor.lua
@@ -64,7 +64,7 @@ g:set(1,0,0)
 g:set(2,0,-1.)
 g:set(3,0,0)
 
-law:setSource(functionConstant(g):getName())
+--law:setSource(functionConstant(g):getName())
 law:addBoundaryCondition('Walls',law:newSlipWallBoundary())
 FS = functionLua(4, 'initial_condition', {'XYZ'}):getName()
 law:addBoundaryCondition('Top',law:newOutsideValueBoundary(FS))
-- 
GitLab