Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for compilation on Windows using mingw32 #287

Merged
merged 1 commit into from
Jul 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ SET(CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH}")

IF (NOT MSVC)
IF (MINGW)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=format")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration -Werror=format")
ENDIF(MINGW)
ENDIF(NOT MSVC)


# Flags
# When using MSVC
IF(MSVC)
Expand Down
4 changes: 2 additions & 2 deletions Timer.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "general.h"

#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))
#include <time.h>
#else
#include <sys/time.h>
Expand All @@ -19,7 +19,7 @@ typedef struct _Timer
double startusertime;
double startsystime;

#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))
time_t base_time;
#endif

Expand Down
2 changes: 1 addition & 1 deletion general.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "luaT.h"
#include "TH.h"

#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))

#define snprintf _snprintf
#define popen _popen
Expand Down
2 changes: 1 addition & 1 deletion lib/TH/THGeneral.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void THFree(void *ptr)

double THLog1p(const double x)
{
#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))
volatile double y = 1 + x;
return log(y) - ((y-1)-x)/y ; /* cancels errors with IEEE arithmetic */
#else
Expand Down
2 changes: 1 addition & 1 deletion lib/TH/THGeneral.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ do { \
#define THMin(X, Y) ((X) < (Y) ? (X) : (Y))
#define THMax(X, Y) ((X) > (Y) ? (X) : (Y))

#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))
# define log1p(x) THLog1p(x)
#define snprintf _snprintf
#define popen _popen
Expand Down
4 changes: 2 additions & 2 deletions lib/luaT/luaT.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extern "C" {
# endif
#endif

#ifdef _MSC_VER
#if (defined(_MSC_VER) || defined(__MINGW32__))
# define DLL_EXPORT __declspec(dllexport)
# define DLL_IMPORT __declspec(dllimport)
# ifdef luaT_EXPORTS
Expand Down Expand Up @@ -108,7 +108,7 @@ LUAT_API int luaT_lua_pushudata(lua_State *L);
/* comments show what function (that you should use) they call now */
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
#define LUAT_DEPRECATED __attribute__((__deprecated__))
#elif defined(_MSC_VER)
#elif (defined(_MSC_VER) || defined(__MINGW32__))
#define LUAT_DEPRECATED __declspec(deprecated)
#else
#define LUAT_DEPRECATED
Expand Down