Skip to content

Commit 5f73f53

Browse files
author
marton.perei
committed
Added support for mingw64 (i686 and x86_64).
Needs msys to work on windows. Supports cross compilation from linux. clang is not fully supported, but 32bit should compile fine. Some modules are not tested yet (tutorial-01 compiles and runs)
1 parent 95bdb73 commit 5f73f53

File tree

162 files changed

+28435
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+28435
-11
lines changed

framework/include/minko/Common.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SO
5353
#include <bitset>
5454
#include <regex>
5555

56+
#ifndef M_PI
57+
# define M_PI 3.14159265358979323846
58+
#endif
59+
5660
namespace minko
5761
{
5862
typedef unsigned int uint;

framework/include/minko/render/CompareMode.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace minko
4040
}
4141
}
4242

43-
#if MINKO_PLATFORM != MINKO_PLATFORM_WINDOWS
43+
#if !(MINKO_COMPILER & MINKO_COMPILER_VC)
4444
namespace std
4545
{
4646
// Hash function to allow CompareMode to be an index in a map.

framework/include/minko/render/DrawCallPool.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ namespace std
3131
size_t
3232
operator()(const std::pair< std::shared_ptr<minko::component::Surface>, std::shared_ptr<minko::scene::Node> >& x) const
3333
{
34-
size_t seed = std::hash<long>()(long(x.first.get()));
34+
size_t seed = std::hash<size_t>()(size_t(x.first.get()));
3535

36-
hash_combine(seed, std::hash<long>()(long(x.second.get())));
36+
hash_combine(seed, std::hash<size_t>()(size_t(x.second.get())));
3737

3838
return seed;
3939
}

framework/include/minko/render/StencilOperation.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace minko
4040
}
4141
}
4242

43-
#if MINKO_PLATFORM != MINKO_PLATFORM_WINDOWS
43+
#if !(MINKO_COMPILER & MINKO_COMPILER_VC)
4444
namespace std
4545
{
4646
// Hash function to allow StencilOperation to be an index in a map.
606 KB
Binary file not shown.
535 KB
Binary file not shown.

framework/premake5.lua

+6
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,9 @@ minko.project.library "minko-framework"
3737

3838
configuration { "windows64" }
3939
libdirs { "lib/glew/lib/windows64" }
40+
41+
configuration { "mingw32" }
42+
libdirs { "lib/glew/lib/mingw32" }
43+
44+
configuration { "mingw64" }
45+
libdirs { "lib/glew/lib/mingw64" }

module/clang/clang.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
table.inject(premake.tools.clang, 'cxxflags.system', {
2-
macosx = { "-MMD", "-MP", "-std=c++11", "-stdlib=libc++" }
2+
macosx = { "-MMD", "-MP", "-std=c++11", "-stdlib=libc++" },
3+
windows = { "-MMD", "-MP", "-std=c++11" }
34
})
45

56
table.inject(premake.tools.clang, 'ldflags.system', {

module/gcc/gcc.lua

+28
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ table.inject(premake.tools.gcc, 'cppflags.system.macosx', {
66
"-MMD", "-MP"
77
})
88

9+
table.inject(premake.tools.gcc, 'cppflags.system.windows', {
10+
"-MMD", "-MP"
11+
})
12+
913
table.inject(premake.tools.gcc, 'cxxflags.system.linux', {
1014
"-std=c++11"
1115
})
@@ -14,6 +18,15 @@ table.inject(premake.tools.gcc, 'cxxflags.system.macosx', {
1418
"-std=c++11"
1519
})
1620

21+
table.inject(premake.tools.gcc, 'cxxflags.system.windows', {
22+
"-std=c++11"
23+
})
24+
25+
-- TODO: these are sometimes left out by mingw32
26+
table.inject(premake.tools.gcc, 'ldflags.system.windows', {
27+
"-lstdc++", "-lwinpthread"
28+
})
29+
1730
table.inject(premake.tools.gcc, 'tools.linux', {
1831
cc = 'gcc',
1932
cxx = MINKO_HOME .. '/tool/lin/script/g++.sh g++',
@@ -23,3 +36,18 @@ table.inject(premake.tools.gcc, 'tools.macosx', {
2336
cc = 'gcc',
2437
cxx = 'g++',
2538
})
39+
40+
local hostOS = io.pathseparator == ";" and "windows" or "unix"
41+
42+
-- targeting windows, use the mingw32 toolchain
43+
if os.is("windows") then
44+
table.inject(premake.tools.gcc, 'tools.x64', {
45+
cc = 'x86_64-w64-mingw32-gcc',
46+
cxx = MINKO_HOME .. '/tool/lin/script/g++.sh x86_64-w64-mingw32-g++',
47+
})
48+
49+
table.inject(premake.tools.gcc, 'tools.x32', {
50+
cc = 'i686-w64-mingw32-gcc',
51+
cxx = MINKO_HOME .. '/tool/lin/script/g++.sh i686-w64-mingw32-g++',
52+
})
53+
end

module/minko/minko.action.lua

+8-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ minko.action.fail = function()
1515
end
1616

1717
minko.action.copy = function(sourcePath)
18-
if os.is('windows') then
18+
if os.is('windows') and not string.startswith(_ACTION, "gmake") then
1919
sourcePath = path.translate(sourcePath)
2020

2121
local targetDir = string.startswith(_ACTION, "gmake") and '$(subst /,\\,$(TARGETDIR))' or '$(TargetDir)'
@@ -27,6 +27,13 @@ minko.action.copy = function(sourcePath)
2727
local existenceTest = string.find(sourcePath, '*') and '' or ('if exist "' .. sourcePath .. '" ')
2828

2929
return existenceTest .. 'xcopy /y /i /e "' .. sourcePath .. '" "' .. targetDir .. '"'
30+
elseif os.is('windows') and string.startswith(_ACTION, "gmake") then
31+
local targetDir = '$(subst \\,/,$(TARGETDIR))'
32+
sourcePath = '$(subst \\,/, ' .. sourcePath .. ')'
33+
34+
local existenceTest = string.find(sourcePath, '*') and '' or ('test -e ' .. sourcePath .. ' && ')
35+
36+
return existenceTest .. 'cp -R ' .. sourcePath .. ' "' .. targetDir .. '" || :'
3037
elseif os.is("macosx") then
3138
local targetDir = '${TARGETDIR}'
3239

module/minko/minko.platform.lua

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ minko.platform.supports = function(targets)
2222
if os.is("linux") then
2323
return true
2424
end
25+
elseif target == "mingw32" or target == "mingw64" then
26+
if os.is("windows") and _ACTION == "gmake" then
27+
return true
28+
end
2529
elseif target == "windows32" or target == "windows64" or target == "windows" then
26-
if os.is("windows") then
30+
if os.is("windows") and _ACTION ~= "gmake" then
2731
return true
2832
end
2933
elseif target == "osx64" or target == "osx" then

module/minko/minko.project.lua

+64
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ minko.project.library = function(name)
1717
defines { "NDEBUG" }
1818
optimize "On"
1919

20+
configuration { "windows", "gmake" }
21+
targetextension ".a"
22+
23+
configuration { "mingw32 or mingw64" }
24+
includedirs { minko.sdk.path("/framework/lib/glew/include") }
25+
2026
configuration { "windows32 or windows64" }
2127
includedirs { minko.sdk.path("/framework/lib/glew/include") }
2228

@@ -47,6 +53,10 @@ minko.project.application = function(name)
4753
-- defines {
4854
-- "MINKO_APPLICATION_NAME=" .. name
4955
-- }
56+
57+
-- FIXME: workaround to replace .a library extensions
58+
configuration { "windows", "gmake" }
59+
targetextension ".exe"
5060

5161
configuration { "windows32" }
5262
libdirs {
@@ -99,6 +109,58 @@ minko.project.application = function(name)
99109
prelinkcommands {
100110
minko.action.copy("asset"),
101111
}
112+
113+
configuration { "mingw32" }
114+
libdirs {
115+
minko.sdk.path("/framework/lib/glew/lib/mingw32")
116+
}
117+
links {
118+
"minko-framework",
119+
"opengl32",
120+
"glew32"
121+
}
122+
prelinkcommands {
123+
minko.action.copy(minko.sdk.path("/framework/asset")),
124+
minko.action.copy(minko.sdk.path("/framework/lib/glew/lib/mingw32/*.dll"))
125+
}
126+
127+
configuration { "mingw32", "debug" }
128+
libdirs {
129+
minko.sdk.path("/framework/bin/mingw32/debug")
130+
}
131+
132+
configuration { "mingw32", "release" }
133+
libdirs {
134+
minko.sdk.path("/framework/bin/mingw32/release")
135+
}
136+
prelinkcommands {
137+
minko.action.copy("asset")
138+
}
139+
140+
configuration { "mingw64" }
141+
libdirs { minko.sdk.path("/framework/lib/glew/lib/mingw64") }
142+
links {
143+
"minko-framework",
144+
"opengl32",
145+
"glew32"
146+
}
147+
prelinkcommands {
148+
minko.action.copy(minko.sdk.path("/framework/asset")),
149+
minko.action.copy(minko.sdk.path("/framework/lib/glew/lib/mingw64/*.dll"))
150+
}
151+
152+
configuration { "mingw64", "debug" }
153+
libdirs {
154+
minko.sdk.path("/framework/bin/mingw64/debug")
155+
}
156+
157+
configuration { "mingw64", "release" }
158+
libdirs {
159+
minko.sdk.path("/framework/bin/mingw64/release")
160+
}
161+
prelinkcommands {
162+
minko.action.copy("asset"),
163+
}
102164

103165
configuration { "linux64" }
104166
linkoptions { "-Wl,--no-as-needed" }
@@ -361,6 +423,8 @@ minko.project.solution = function(name)
361423
"linux64",
362424
"windows32",
363425
"windows64",
426+
"mingw32",
427+
"mingw64",
364428
"osx64",
365429
"html5",
366430
"ios",
File renamed without changes.
+163
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
/*
2+
Simple DirectMedia Layer
3+
Copyright (C) 1997-2014 Sam Lantinga <[email protected]>
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
14+
claim that you wrote the original software. If you use this software
15+
in a product, an acknowledgment in the product documentation would be
16+
appreciated but is not required.
17+
2. Altered source versions must be plainly marked as such, and must not be
18+
misrepresented as being the original software.
19+
3. This notice may not be removed or altered from any source distribution.
20+
*/
21+
22+
/**
23+
* \file SDL.h
24+
*
25+
* Main include header for the SDL library
26+
*/
27+
28+
/**
29+
* \mainpage Simple DirectMedia Layer (SDL)
30+
*
31+
* http://www.libsdl.org/
32+
*
33+
* \section intro_sec Introduction
34+
*
35+
* Simple DirectMedia Layer is a cross-platform development library designed
36+
* to provide low level access to audio, keyboard, mouse, joystick, and
37+
* graphics hardware via OpenGL and Direct3D. It is used by video playback
38+
* software, emulators, and popular games including Valve's award winning
39+
* catalog and many Humble Bundle games.
40+
*
41+
* SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
42+
* Support for other platforms may be found in the source code.
43+
*
44+
* SDL is written in C, works natively with C++, and there are bindings
45+
* available for several other languages, including C# and Python.
46+
*
47+
* This library is distributed under the zlib license, which can be found
48+
* in the file "COPYING.txt".
49+
*
50+
* The best way to learn how to use SDL is to check out the header files in
51+
* the "include" subdirectory and the programs in the "test" subdirectory.
52+
* The header files and test programs are well commented and always up to date.
53+
* More documentation and FAQs are available online at:
54+
* http://wiki.libsdl.org/
55+
*
56+
* If you need help with the library, or just want to discuss SDL related
57+
* issues, you can join the developers mailing list:
58+
* http://www.libsdl.org/mailing-list.php
59+
*
60+
* Enjoy!
61+
* Sam Lantinga ([email protected])
62+
*/
63+
64+
#ifndef _SDL_H
65+
#define _SDL_H
66+
67+
#include "SDL_main.h"
68+
#include "SDL_stdinc.h"
69+
#include "SDL_assert.h"
70+
#include "SDL_atomic.h"
71+
#include "SDL_audio.h"
72+
#include "SDL_clipboard.h"
73+
#include "SDL_cpuinfo.h"
74+
#include "SDL_endian.h"
75+
#include "SDL_error.h"
76+
#include "SDL_events.h"
77+
#include "SDL_filesystem.h"
78+
#include "SDL_joystick.h"
79+
#include "SDL_gamecontroller.h"
80+
#include "SDL_haptic.h"
81+
#include "SDL_hints.h"
82+
#include "SDL_loadso.h"
83+
#include "SDL_log.h"
84+
#include "SDL_messagebox.h"
85+
#include "SDL_mutex.h"
86+
#include "SDL_power.h"
87+
#include "SDL_render.h"
88+
#include "SDL_rwops.h"
89+
#include "SDL_system.h"
90+
#include "SDL_thread.h"
91+
#include "SDL_timer.h"
92+
#include "SDL_version.h"
93+
#include "SDL_video.h"
94+
95+
#include "begin_code.h"
96+
/* Set up for C function definitions, even when using C++ */
97+
#ifdef __cplusplus
98+
extern "C" {
99+
#endif
100+
101+
/* As of version 0.5, SDL is loaded dynamically into the application */
102+
103+
/**
104+
* \name SDL_INIT_*
105+
*
106+
* These are the flags which may be passed to SDL_Init(). You should
107+
* specify the subsystems which you will be using in your application.
108+
*/
109+
/* @{ */
110+
#define SDL_INIT_TIMER 0x00000001
111+
#define SDL_INIT_AUDIO 0x00000010
112+
#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */
113+
#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */
114+
#define SDL_INIT_HAPTIC 0x00001000
115+
#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */
116+
#define SDL_INIT_EVENTS 0x00004000
117+
#define SDL_INIT_NOPARACHUTE 0x00100000 /**< Don't catch fatal signals */
118+
#define SDL_INIT_EVERYTHING ( \
119+
SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \
120+
SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \
121+
)
122+
/* @} */
123+
124+
/**
125+
* This function initializes the subsystems specified by \c flags
126+
* Unless the ::SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
127+
* signal handlers for some commonly ignored fatal signals (like SIGSEGV).
128+
*/
129+
extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
130+
131+
/**
132+
* This function initializes specific SDL subsystems
133+
*/
134+
extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
135+
136+
/**
137+
* This function cleans up specific SDL subsystems
138+
*/
139+
extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
140+
141+
/**
142+
* This function returns a mask of the specified subsystems which have
143+
* previously been initialized.
144+
*
145+
* If \c flags is 0, it returns a mask of all initialized subsystems.
146+
*/
147+
extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
148+
149+
/**
150+
* This function cleans up all initialized subsystems. You should
151+
* call it upon all exit conditions.
152+
*/
153+
extern DECLSPEC void SDLCALL SDL_Quit(void);
154+
155+
/* Ends C function definitions when using C++ */
156+
#ifdef __cplusplus
157+
}
158+
#endif
159+
#include "close_code.h"
160+
161+
#endif /* _SDL_H */
162+
163+
/* vi: set ts=4 sw=4 expandtab: */

0 commit comments

Comments
 (0)