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

View File

@@ -468,11 +468,16 @@ function (acg_add_library _target _libtype)
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/${fullname}.dll)
endif ()
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
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${fullname}.lib
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/${fullname}.lib)
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${OUTPUTNAME}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/${OUTPUTNAME})
endif ()
elseif (APPLE AND NOT ACG_PROJECT_MACOS_BUNDLE)
if (${_type} STREQUAL SHARED)

View File

@@ -16,7 +16,15 @@ add_subdirectory (VDProgMesh/mkbalancedpm)
add_subdirectory (VDProgMesh/Analyzer)
# 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
add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer )
endif()

View File

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

View File

@@ -49,22 +49,21 @@ ENDIF(NOT WIN32)
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
add_dependencies (fixbundle OpenMeshTools)
endif()
endif()
# Add tools as dependency before fixbundle
if (APPLE)
# let bundle generation depend on target
add_dependencies (fixbundle OpenMeshTools)
endif()
if ( APPLE)
# let bundle generation depend on target
add_dependencies (fixbundle OpenMeshToolsStatic)
endif()
endif()

View File

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

View File

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

View File

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