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

Fix lime.ndll build on MinGW #1660

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion project/Build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@
<lib name="rpcrt4.lib" if="LIME_HARFBUZZ" />
<lib name="dwrite.lib" if="LIME_HARFBUZZ" />

<lib name="comsuppw.lib" unless="winrt" />
<lib name="comsuppw.lib" unless="winrt || mingw" />
<lib name="wbemuuid.lib" />

<lib name="D3D11.lib" if="winrt" />
<lib name="RuntimeObject.lib" if="winrt" />
Expand Down
2 changes: 1 addition & 1 deletion project/include/system/System.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace lime {
}


#ifndef HX_WINDOWS
#if !defined(HX_WINDOWS) || defined(__MINGW32__)
#include <stdint.h>
#else

Expand Down
2 changes: 1 addition & 1 deletion project/lib/cairo
Submodule cairo updated from b43e7c to 33173d
6 changes: 4 additions & 2 deletions project/lib/custom/cairo/configs/windows/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,15 @@
// #define CAIRO_HAS_DLSYM 1


#ifdef __MINGW32__
// #define HAVE_BYTESWAP_H 1
// #define HAVE_INTTYPES_H 1
// #define HAVE_STDINT_H 1
#define HAVE_STDINT_H 1
// #define HAVE_SYS_INT_TYPES_H 1
// #define HAVE_UNISTD_H 1
// #define HAVE_UINT128_T 1
// #define HAVE_UINT64_T 1
#define HAVE_UINT64_T 1
#endif


// #define HAVE_INTEL_ATOMIC_PRIMITIVES 1
Expand Down
5 changes: 0 additions & 5 deletions project/lib/custom/openal/include/config-windows-x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@

#include <math.h>

#ifndef isfinite
#include <float.h>
#define isfinite _finite
#endif

/* Define a restrict macro for non-aliased pointers */
#define RESTRICT __restrict

Expand Down
3 changes: 2 additions & 1 deletion project/lib/freetype-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftbitmap.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftcalc.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftcid.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftcolor.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftdbgmem.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftdebug.c" />
<file name="${NATIVE_TOOLKIT_PATH}/freetype/src/base/ftfntfmt.c" />
Expand Down Expand Up @@ -134,4 +135,4 @@

</files>

</xml>
</xml>
4 changes: 2 additions & 2 deletions project/lib/harfbuzz-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

<compilerflag value="-DHAVE_UNISCRIBE" if="windows" />
<compilerflag value="-DHAVE_DIRECTWRITE" if="windows HXCPP_M64" /> <!-- Windows 7+ -->
<compilerflag value="-wd4244" if="windows" />
<compilerflag value="-wd4267" if="windows" />
<compilerflag value="-wd4244" if="windows MSVC_VER" />
<compilerflag value="-wd4267" if="windows MSVC_VER" />
<compilerflag value="-D_CRT_SECURE_NO_WARNINGS" if="windows" />
<compilerflag value="-D_CRT_NONSTDC_NO_WARNINGS" if="windows" />

Expand Down
19 changes: 7 additions & 12 deletions project/lib/openal-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
<file name="${NATIVE_TOOLKIT_PATH}/openal/common/strutils.cpp" />
<file name="${NATIVE_TOOLKIT_PATH}/openal/common/threads.cpp" />

<compilerflag value="-mmmx" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse2" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse3" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-mssse3" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />

<section if="NATIVE_TOOLKIT_HAVE_SDL">

<compilerflag value="-I${NATIVE_TOOLKIT_PATH}/custom/sdl/include/" />
Expand All @@ -94,11 +100,6 @@

<compilerflag value="-D_POSIX_C_SOURCE=200112L" />
<compilerflag value="-D_XOPEN_SOURCE=500" />
<compilerflag value="-mmmx" unless="rpi" />
<compilerflag value="-msse" unless="rpi" />
<compilerflag value="-msse2" unless="rpi" />
<compilerflag value="-msse3" unless="rpi" />
<compilerflag value="-mssse3" unless="rpi" />
<compilerflag value="-mfpu=neon" if="rpi" unless="HXCPP_ARM64" />
<compilerflag value="-fcommon" />

Expand All @@ -112,12 +113,6 @@

<file name="${NATIVE_TOOLKIT_PATH}/openal/alc/backends/coreaudio.cpp" />

<compilerflag value="-mmmx" unless="HXCPP_ARM64" />
<compilerflag value="-msse" unless="HXCPP_ARM64" />
<compilerflag value="-msse2" unless="HXCPP_ARM64" />
<compilerflag value="-msse3" unless="HXCPP_ARM64" />
<compilerflag value="-mssse3" unless="HXCPP_ARM64" />

</section>

<section if="windows">
Expand All @@ -134,7 +129,7 @@
<compilerflag value="-Drestrict=" />
<compilerflag value="-D_CRT_SECURE_NO_WARNINGS" />
<compilerflag value="-D_CRT_NONSTDC_NO_DEPRECATE" />
<compilerflag value="/wd4098" />
<compilerflag value="/wd4098" if="MSVC_VER"/>
<compilerflag value="-Dstrcasecmp=_stricmp" />
<compilerflag value="-Dstrncasecmp=_strnicmp" />

Expand Down
10 changes: 5 additions & 5 deletions project/lib/pixman-files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

<compilerflag value="-I${ANDROID_NDK_ROOT}/sources/android/cpufeatures" if="android" />

<compilerflag value="-mmmx" if="linux || mac" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse" if="linux || mac" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse2" if="linux || mac" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse3" if="linux || mac" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-mssse3" if="linux || mac" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-mmmx" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse2" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-msse3" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />
<compilerflag value="-mssse3" if="linux || mac || mingw" unless="rpi || HXCPP_ARM64" />

<compilerflag value="-Wno-attributes" if="android" />
<compilerflag value="-Wno-tautological-constant-out-of-range-compare" if="mac || ios || tvos" />
Expand Down
2 changes: 1 addition & 1 deletion project/src/backend/sdl/SDLWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#ifdef HX_WINDOWS
#include <SDL_syswm.h>
#include <Windows.h>
#include <windows.h>
#undef CreateWindow
#endif

Expand Down
2 changes: 1 addition & 1 deletion project/src/graphics/opengl/OpenGL.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
//#define LIME_GLES3_API
#include <windows.h>
#ifndef NATIVE_TOOLKIT_SDL_ANGLE
#include <gl/GL.h>
#include <GL/gl.h>
#endif

typedef ptrdiff_t GLsizeiptrARB;
Expand Down
14 changes: 7 additions & 7 deletions project/src/system/System.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <wbemidl.h>
#include <comutil.h>
#pragma comment(lib, "wbemuuid.lib")
#include <Windows.h>
#include <windows.h>
#endif

#include <system/System.h>
Expand Down Expand Up @@ -124,7 +124,7 @@ namespace lime {

}

hres = pSvc->ExecQuery (bstr_t ("WQL"), query, WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);
hres = pSvc->ExecQuery (bstr_t (L"WQL"), query, WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, NULL, &pEnumerator);

if (FAILED (hres)) {

Expand Down Expand Up @@ -164,7 +164,7 @@ namespace lime {
std::wstring* System::GetDeviceModel () {

#if defined (HX_WINDOWS) && !defined (HX_WINRT)
return GetWMIValue (bstr_t ("SELECT * FROM Win32_ComputerSystemProduct"), L"Version");
return GetWMIValue (bstr_t (L"SELECT * FROM Win32_ComputerSystemProduct"), bstr_t (L"Version"));
#endif

return NULL;
Expand All @@ -175,7 +175,7 @@ namespace lime {
std::wstring* System::GetDeviceVendor () {

#if defined (HX_WINDOWS) && !defined (HX_WINRT)
return GetWMIValue (bstr_t ("SELECT * FROM Win32_ComputerSystemProduct"), L"Vendor");
return GetWMIValue (bstr_t (L"SELECT * FROM Win32_ComputerSystemProduct"), bstr_t (L"Vendor"));
#endif

return NULL;
Expand All @@ -186,7 +186,7 @@ namespace lime {
std::wstring* System::GetPlatformLabel () {

#if defined (HX_WINDOWS) && !defined (HX_WINRT)
return GetWMIValue (bstr_t ("SELECT * FROM Win32_OperatingSystem"), L"Caption");
return GetWMIValue (bstr_t (L"SELECT * FROM Win32_OperatingSystem"), bstr_t (L"Caption"));
#endif

return NULL;
Expand All @@ -204,7 +204,7 @@ namespace lime {
std::wstring* System::GetPlatformVersion () {

#if defined (HX_WINDOWS) && !defined (HX_WINRT)
return GetWMIValue (bstr_t ("SELECT * FROM Win32_OperatingSystem"), L"Version");
return GetWMIValue (bstr_t (L"SELECT * FROM Win32_OperatingSystem"), bstr_t (L"Version"));
#endif

return NULL;
Expand Down Expand Up @@ -411,4 +411,4 @@ size_t _mbsrtowcs(wchar_t * ws, const char **src, size_t wn, mbstate_t *st)
return -1;
}

#endif
#endif
5 changes: 4 additions & 1 deletion templates/cpp/static/BuildMain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

<include name="${HXCPP}/build-tool/BuildCommon.xml" />

<set name="no_shared_libs" value="1" />

<files id="main">

<file name="Main.cpp" />
Expand Down Expand Up @@ -30,7 +32,8 @@
<lib name="wldap32.lib" />
<lib name="shell32.lib" />
<lib name="comdlg32.lib" />
<lib name="comsuppw.lib" />
<lib name="wbemuuid.lib" />
<lib name="comsuppw.lib" unless="mingw" />
<lib name="usp10.lib" />
<lib name="rpcrt4.lib" />
<lib name="dwrite.lib" />
Expand Down
6 changes: 3 additions & 3 deletions tools/platforms/WindowsPlatform.hx
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ class WindowsPlatform extends PlatformTarget

if (!targetFlags.exists("32") && !targetFlags.exists("x86_32")
&& System.hostArchitecture == X64
&& (command != "rebuild" || targetType == "cpp" || targetType == "winrt"))
&& (command != "rebuild" || targetType == "cpp" || targetType == "neko" || targetType == "winrt"))
{
if (targetType == "winrt")
{
Expand Down Expand Up @@ -945,12 +945,12 @@ class WindowsPlatform extends PlatformTarget

var msvc19 = true;

if ((!hasVSCommunity && vs140 == null) || (hxcppMSVC != null && hxcppMSVC != vs140))
if (project.defines.exists("mingw") || (!hasVSCommunity && vs140 == null) || (hxcppMSVC != null && hxcppMSVC != vs140))
{
msvc19 = false;
}

var suffix = (msvc19 ? "-19.lib" : ".lib");
var suffix = (msvc19 ? "-19" : "") + "${LIBEXT}";

for (i in 0...project.ndlls.length)
{
Expand Down