MinGW support

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@471 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2011-11-28 13:31:31 +00:00
parent a95789f417
commit 214bc1f278
8 changed files with 47 additions and 22 deletions

View File

@@ -28,7 +28,7 @@ if ( NOT DEFINED BUILD_APPS )
endif() endif()
if (WIN32) if (WIN32)
if ( BUILD_APPS ) if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" AND BUILD_APPS )
add_custom_target (fixbundle ALL add_custom_target (fixbundle ALL
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" ) COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" )
endif() endif()
@@ -59,8 +59,10 @@ if (WIN32 AND BUILD_APPS )
configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.win.in" configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.win.in"
"${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE) "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE)
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
# let bundle generation depend on all targets # let bundle generation depend on all targets
add_dependencies (fixbundle QtViewer DecimaterGui) add_dependencies (fixbundle QtViewer DecimaterGui)
endif()
endif() endif()

View File

@@ -468,11 +468,16 @@ function (acg_add_library _target _libtype)
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/${fullname}.dll) ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/${fullname}.dll)
endif () endif ()
if (${_type} STREQUAL SHARED OR ${_type} STREQUAL STATIC) if (${_type} STREQUAL SHARED OR ${_type} STREQUAL STATIC)
if("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")
SET(OUTPUTNAME "lib${fullname}.a")
else()
SET(OUTPUTNAME "${fullname}.lib")
endif()
add_custom_command (TARGET ${_target} POST_BUILD add_custom_command (TARGET ${_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E COMMAND ${CMAKE_COMMAND} -E
copy_if_different copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${fullname}.lib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${OUTPUTNAME}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/${fullname}.lib) ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/${OUTPUTNAME})
endif () endif ()
elseif (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE) elseif (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)
if (${_type} STREQUAL SHARED) if (${_type} STREQUAL SHARED)

View File

@@ -16,7 +16,15 @@ add_subdirectory (VDProgMesh/mkbalancedpm)
add_subdirectory (VDProgMesh/Analyzer) add_subdirectory (VDProgMesh/Analyzer)
# Add non ui apps as dependency before fixbundle # Add non ui apps as dependency before fixbundle
if ( WIN32 OR APPLE) if ( WIN32 )
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
# let bundle generation depend on all targets
add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer )
endif()
endif()
# Add non ui apps as dependency before fixbundle
if ( APPLE)
# let bundle generation depend on all targets # let bundle generation depend on all targets
add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer ) add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer )
endif() endif()

View File

@@ -42,13 +42,14 @@ endif ()
# Add core as dependency before fixbundle # Add core as dependency before fixbundle
if ( ${PROJECT_NAME} MATCHES "OpenMesh") if ( ${PROJECT_NAME} MATCHES "OpenMesh")
# Add core as dependency before fixbundle
if ( WIN32 AND BUILD_APPS ) if ( WIN32 AND BUILD_APPS)
# let bundle generation depend on targets if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
add_dependencies (fixbundle OpenMeshCore) add_dependencies (fixbundle OpenMeshCore)
endif() endif()
endif()
# Add core as dependency before fixbundle
if ( APPLE) if ( APPLE)
# let bundle generation depend on targets # let bundle generation depend on targets
add_dependencies (fixbundle OpenMeshCore) add_dependencies (fixbundle OpenMeshCore)

View File

@@ -49,22 +49,21 @@ ENDIF(NOT WIN32)
if ( ${PROJECT_NAME} MATCHES "OpenMesh") if ( ${PROJECT_NAME} MATCHES "OpenMesh")
if ( WIN32 AND BUILD_APPS ) if ( WIN32 AND BUILD_APPS)
if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
# let bundle generation depend on target # let bundle generation depend on target
add_dependencies (fixbundle OpenMeshTools) add_dependencies (fixbundle OpenMeshTools)
endif() endif()
endif()
# Add tools as dependency before fixbundle # Add tools as dependency before fixbundle
if (APPLE) if (APPLE)
# let bundle generation depend on target # let bundle generation depend on target
add_dependencies (fixbundle OpenMeshTools) add_dependencies (fixbundle OpenMeshTools)
endif()
if ( APPLE)
# let bundle generation depend on target
add_dependencies (fixbundle OpenMeshToolsStatic) add_dependencies (fixbundle OpenMeshToolsStatic)
endif() endif()
endif() endif()

View File

@@ -45,8 +45,13 @@
#endif #endif
#ifndef WIN32 #ifndef WIN32
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#else
#ifdef __MINGW32__
#include <stdlib.h>
#include <string.h>
#endif
#endif #endif
using namespace std; using namespace std;

View File

@@ -181,7 +181,7 @@ protected:
}; };
// ----------------------------------------------------------- gettimeofday ---- // ----------------------------------------------------------- gettimeofday ----
#elif defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32)) #elif (defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32))) && !defined(__MINGW32__)
# include <sys/time.h> # include <sys/time.h>
# include <sys/resource.h> # include <sys/resource.h>
@@ -268,7 +268,7 @@ Timer::Timer(void)
# else # else
impl_ = new TimerImplPosix<CLOCK_REALTIME>; impl_ = new TimerImplPosix<CLOCK_REALTIME>;
# endif # endif
#elif defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32)) #elif (defined(__GNUC__) || (defined(__INTEL_COMPILER) && !defined(WIN32)) ) && !defined(__MINGW32__)
impl_ = new TimerImplGToD; impl_ = new TimerImplGToD;
#else #else
impl_ = new TimerImplStd; impl_ = new TimerImplStd;

View File

@@ -53,6 +53,11 @@
#ifndef WIN32 #ifndef WIN32
#include <string.h> #include <string.h>
#include <cstdlib> #include <cstdlib>
#else
#if defined(__MINGW32__)
#include <stdlib.h>
#include <string.h>
#endif
#endif #endif
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================