mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
mingw build fixes.
Minor improvement in minimap.
This commit is contained in:
21
premake4.lua
21
premake4.lua
@@ -79,7 +79,14 @@ newgcctoolchain {
|
||||
name = "mingw32",
|
||||
description = "Mingw32 to cross-compile windows binaries from *nix",
|
||||
prefix = "i686-w64-mingw32-",
|
||||
cppflags = ""
|
||||
cppflags = "-B /usr/bin/i686-w64-mingw32-"
|
||||
}
|
||||
|
||||
newgcctoolchain {
|
||||
name = "mingw64",
|
||||
description = "Mingw64 to cross-compile windows binaries from *nix",
|
||||
prefix = "x86_64-w64-mingw64-",
|
||||
cppflags = "-B /usr/bin/x86_64-w64-mingw64-"
|
||||
}
|
||||
|
||||
newgcctoolchain {
|
||||
@@ -358,11 +365,11 @@ end
|
||||
|
||||
function add_cross_config_links()
|
||||
if not is_vs() then
|
||||
if os.is_real("mingw32") or os.is_real("windows") or os.is_real("ios") then -- if is crosscompiling from *nix
|
||||
if os.is_real("mingw32") or os.is_real("mingw64") or os.is_real("windows") or os.is_real("ios") then -- if is crosscompiling from *nix
|
||||
linkoptions { "-static-libgcc", "-static-libstdc++" }
|
||||
end
|
||||
|
||||
if os.is_real("mingw32") then
|
||||
if os.is_real("mingw32") or os.is_real("mingw64") then
|
||||
linkoptions { "-Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic" }
|
||||
end
|
||||
end
|
||||
@@ -509,6 +516,8 @@ function generate_os_links()
|
||||
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32" } )
|
||||
elseif os.is_real("mingw32") then
|
||||
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32" } )
|
||||
elseif os.is_real("mingw64") then
|
||||
multiple_insert( os_links, { "opengl32", "glu32", "gdi32", "ws2_32", "winmm", "ole32" } )
|
||||
elseif os.is_real("macosx") then
|
||||
multiple_insert( os_links, { "OpenGL.framework", "CoreFoundation.framework" } )
|
||||
elseif os.is_real("freebsd") then
|
||||
@@ -522,7 +531,7 @@ function generate_os_links()
|
||||
if not _OPTIONS["with-mojoal"] then
|
||||
if os.is_real("linux") or os.is_real("freebsd") or os.is_real("haiku") or os.is_real("emscripten") then
|
||||
multiple_insert( os_links, { "openal" } )
|
||||
elseif os.is_real("windows") or os.is_real("mingw32") then
|
||||
elseif os.is_real("windows") or os.is_real("mingw32") or os.is_real("mingw64") then
|
||||
multiple_insert( os_links, { "OpenAL32" } )
|
||||
elseif os.is_real("macosx") or os.is_real("ios") then
|
||||
multiple_insert( os_links, { "OpenAL.framework" } )
|
||||
@@ -667,7 +676,7 @@ function backend_is( name, libname )
|
||||
|
||||
local ret_val = os_findlib( libname ) and backend_sel
|
||||
|
||||
if os.is_real("mingw32") or os.is_real("emscripten") then
|
||||
if os.is_real("mingw32") or os.is_real("mingw64") or os.is_real("emscripten") then
|
||||
ret_val = backend_sel
|
||||
end
|
||||
|
||||
@@ -749,7 +758,7 @@ function build_eepp( build_name )
|
||||
buildoptions{ "-std=c++14" }
|
||||
end
|
||||
|
||||
if os.is("windows") then
|
||||
if os.is_real("mingw32") or os.is_real("mingw64") or os.is_real("windows") then
|
||||
files { "src/eepp/system/platform/win/*.cpp" }
|
||||
files { "src/eepp/network/platform/win/*.cpp" }
|
||||
else
|
||||
|
||||
11
premake5.lua
11
premake5.lua
@@ -123,11 +123,20 @@ function download_and_extract_dependencies()
|
||||
end
|
||||
end
|
||||
|
||||
function build_arch_configuration()
|
||||
filter {"architecture:x86", "options:cc=mingw"}
|
||||
buildoptions { "-B /usr/bin/i686-w64-mingw32-" }
|
||||
|
||||
filter {"architecture:x86_64", "options:cc=mingw"}
|
||||
buildoptions { "-B /usr/bin/x86_64-w64-mingw32-" }
|
||||
end
|
||||
|
||||
function build_base_configuration( package_name )
|
||||
incdirs { "src/thirdparty/zlib" }
|
||||
|
||||
set_ios_config()
|
||||
set_xcode_config()
|
||||
build_arch_configuration()
|
||||
|
||||
filter "not system:windows"
|
||||
buildoptions{ "-fPIC" }
|
||||
@@ -159,6 +168,7 @@ function build_base_cpp_configuration( package_name )
|
||||
|
||||
set_ios_config()
|
||||
set_xcode_config()
|
||||
build_arch_configuration()
|
||||
|
||||
filter "action:not vs*"
|
||||
buildoptions { "-Wall" }
|
||||
@@ -202,6 +212,7 @@ function build_link_configuration( package_name, use_ee_icon )
|
||||
|
||||
set_ios_config()
|
||||
set_xcode_config()
|
||||
build_arch_configuration()
|
||||
|
||||
filter { "system:windows", "action:not vs*" }
|
||||
if ( true == use_ee_icon ) then
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
cd $(dirname "$0")
|
||||
premake5 --file=../../premake5.lua --os=windows gmake2
|
||||
premake5 --file=../../premake5.lua --os=windows --cc=mingw --with-mojoal gmake2
|
||||
cd ../../make/windows/
|
||||
mingw32-make $@
|
||||
|
||||
|
||||
@@ -909,17 +909,20 @@ Uint32 UICodeEditor::onMouseDown( const Vector2i& position, const Uint32& flags
|
||||
|
||||
if ( mMinimapEnabled ) {
|
||||
Rectf rect( getMinimapRect( getScreenStart() ) );
|
||||
if ( !mVScrollBar->isDragging() && !mMinimapDragging &&
|
||||
if ( ( flags & EE_BUTTON_LMASK ) && !mVScrollBar->isDragging() && !mMinimapDragging &&
|
||||
rect.contains( position.asFloat() ) ) {
|
||||
Int64 lineCount = mDoc->linesCount();
|
||||
Float lineSpacing = getMinimapLineSpacing();
|
||||
Float minimapHeight = lineCount * lineSpacing;
|
||||
bool isTooLarge = isMinimapFileTooLarge();
|
||||
if ( isTooLarge )
|
||||
minimapHeight = rect.getHeight();
|
||||
Float dy = position.y - rect.Top;
|
||||
Int64 jumpToLine = eefloor( ( dy / minimapHeight ) * lineCount ) + 1;
|
||||
scrollTo( { jumpToLine, 0 }, true, true );
|
||||
updateMipmapHover( position.asFloat() );
|
||||
if ( !mMinimapHover ) {
|
||||
Int64 lineCount = mDoc->linesCount();
|
||||
Float lineSpacing = getMinimapLineSpacing();
|
||||
Float minimapHeight = lineCount * lineSpacing;
|
||||
bool isTooLarge = isMinimapFileTooLarge();
|
||||
if ( isTooLarge )
|
||||
minimapHeight = rect.getHeight();
|
||||
Float dy = position.y - rect.Top;
|
||||
Int64 jumpToLine = eefloor( ( dy / minimapHeight ) * lineCount ) + 1;
|
||||
scrollTo( { jumpToLine, 0 }, true, true );
|
||||
}
|
||||
mMinimapDragging = true;
|
||||
mMouseDown = true;
|
||||
getUISceneNode()->getWindow()->getInput()->captureMouse( true );
|
||||
@@ -2566,7 +2569,7 @@ Rectf UICodeEditor::getMinimapRect( const Vector2f& start ) const {
|
||||
|
||||
void UICodeEditor::drawMinimap( const Vector2f& start, const std::pair<int, int>& lineRange ) {
|
||||
Float charHeight = PixelDensity::getPixelDensity() * mMinimapConfig.scale;
|
||||
Float charSpacing = eefloor( 0.8 * PixelDensity::getPixelDensity() * mMinimapConfig.scale );
|
||||
Float charSpacing = eemax( 1.f, eefloor( 0.8 * PixelDensity::getPixelDensity() * mMinimapConfig.scale ) );
|
||||
Float lineSpacing = getMinimapLineSpacing();
|
||||
Rectf rect( getMinimapRect( start ) );
|
||||
int visibleLinesCount = ( lineRange.second - lineRange.first );
|
||||
@@ -2744,7 +2747,7 @@ Vector2f UICodeEditor::getScreenStart() const {
|
||||
}
|
||||
|
||||
Float UICodeEditor::getMinimapLineSpacing() const {
|
||||
return eefloor( 2 * PixelDensity::getPixelDensity() * mMinimapConfig.scale );
|
||||
return eemax( 1.f, eefloor( 2 * PixelDensity::getPixelDensity() * mMinimapConfig.scale ) );
|
||||
}
|
||||
|
||||
bool UICodeEditor::isMinimapFileTooLarge() const {
|
||||
|
||||
57
src/tools/ecode/thirdparty/subprocess.h
vendored
57
src/tools/ecode/thirdparty/subprocess.h
vendored
@@ -33,7 +33,7 @@
|
||||
#ifndef SHEREDOM_SUBPROCESS_H_INCLUDED
|
||||
#define SHEREDOM_SUBPROCESS_H_INCLUDED
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(push, 1)
|
||||
|
||||
/* disable warning: '__cplusplus' is not defined as a preprocessor macro,
|
||||
@@ -43,11 +43,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
#define subprocess_pure
|
||||
#define subprocess_weak __inline
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
@@ -211,7 +211,7 @@ subprocess_weak int subprocess_alive(struct subprocess_s *const process);
|
||||
#define SUBPROCESS_NULL 0
|
||||
#endif
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#if !defined(_WIN32)
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
@@ -219,7 +219,7 @@ subprocess_weak int subprocess_alive(struct subprocess_s *const process);
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
|
||||
#if (_MSC_VER < 1920)
|
||||
#ifdef _WIN64
|
||||
@@ -326,7 +326,7 @@ __declspec(dllimport) unsigned long __stdcall WaitForMultipleObjects(
|
||||
__declspec(dllimport) int __stdcall GetOverlappedResult(void *, LPOVERLAPPED,
|
||||
unsigned long *, int);
|
||||
|
||||
#if defined(_DLL) && (_DLL == 1)
|
||||
#if defined(_DLL)
|
||||
#define SUBPROCESS_DLLIMPORT __declspec(dllimport)
|
||||
#else
|
||||
#define SUBPROCESS_DLLIMPORT
|
||||
@@ -336,8 +336,12 @@ SUBPROCESS_DLLIMPORT int __cdecl _fileno(FILE *);
|
||||
SUBPROCESS_DLLIMPORT int __cdecl _open_osfhandle(subprocess_intptr_t, int);
|
||||
SUBPROCESS_DLLIMPORT subprocess_intptr_t __cdecl _get_osfhandle(int);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
void *__cdecl _alloca(subprocess_size_t);
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
#else
|
||||
typedef size_t subprocess_size_t;
|
||||
#endif
|
||||
|
||||
@@ -350,7 +354,7 @@ struct subprocess_s {
|
||||
FILE *stdout_file;
|
||||
FILE *stderr_file;
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
void *hProcess;
|
||||
void *hStdInput;
|
||||
void *hEventOutput;
|
||||
@@ -366,7 +370,7 @@ struct subprocess_s {
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
subprocess_weak int subprocess_create_named_pipe_helper(void **rd, void **wr);
|
||||
int subprocess_create_named_pipe_helper(void **rd, void **wr) {
|
||||
const unsigned long pipeAccessInbound = 0x00000001;
|
||||
@@ -384,7 +388,7 @@ int subprocess_create_named_pipe_helper(void **rd, void **wr) {
|
||||
__declspec(thread) static long index = 0;
|
||||
const long unique = index++;
|
||||
|
||||
#if _MSC_VER < 1900
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push, 1)
|
||||
#pragma warning(disable : 4996)
|
||||
_snprintf(name, sizeof(name) - 1,
|
||||
@@ -427,13 +431,14 @@ int subprocess_create(const char *const commandLine[], int options,
|
||||
int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
const char *const environment[],
|
||||
struct subprocess_s *const out_process) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
int fd;
|
||||
void *rd, *wr;
|
||||
char *commandLineCombined;
|
||||
subprocess_size_t len;
|
||||
int i, j;
|
||||
unsigned long flags = 0;
|
||||
int need_quoting;
|
||||
const unsigned long startFUseStdHandles = 0x00000100;
|
||||
const unsigned long handleFlagInherit = 0x00000001;
|
||||
const unsigned long createNoWindow = 0x08000000;
|
||||
@@ -603,8 +608,12 @@ int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
// Combine commandLine together into a single string
|
||||
len = 0;
|
||||
for (i = 0; commandLine[i]; i++) {
|
||||
// For the ' ' and two '"' between items and trailing '\0'
|
||||
len += 3;
|
||||
// For the trailing \0
|
||||
len++;
|
||||
|
||||
// Quote the argument if it has space or tabs in it
|
||||
if (strpbrk(commandLine[i], "\t\v ") != NULL)
|
||||
len += 2;
|
||||
|
||||
for (j = 0; '\0' != commandLine[i][j]; j++) {
|
||||
switch (commandLine[i][j]) {
|
||||
@@ -637,7 +646,10 @@ int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
if (0 != i) {
|
||||
commandLineCombined[len++] = ' ';
|
||||
}
|
||||
commandLineCombined[len++] = '"';
|
||||
need_quoting = strpbrk(commandLine[i], "\t\v ") != NULL;
|
||||
if (need_quoting) {
|
||||
commandLineCombined[len++] = '"';
|
||||
}
|
||||
|
||||
for (j = 0; '\0' != commandLine[i][j]; j++) {
|
||||
switch (commandLine[i][j]) {
|
||||
@@ -656,7 +668,10 @@ int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
|
||||
commandLineCombined[len++] = commandLine[i][j];
|
||||
}
|
||||
commandLineCombined[len++] = '"';
|
||||
|
||||
if (need_quoting) {
|
||||
commandLineCombined[len++] = '"';
|
||||
}
|
||||
}
|
||||
|
||||
commandLineCombined[len] = '\0';
|
||||
@@ -764,7 +779,7 @@ int subprocess_create_ex(const char *const commandLine[], int options,
|
||||
_Exit(execve(commandLine[0], (char *const *)commandLine,
|
||||
empty_environment));
|
||||
} else {
|
||||
_Exit(execvp(commandLine[0], (char *const *)commandLine));
|
||||
_Exit(execvp(commandLine[0], (char *const *)commandLine));
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
@@ -819,7 +834,7 @@ FILE *subprocess_stderr(const struct subprocess_s *const process) {
|
||||
|
||||
int subprocess_join(struct subprocess_s *const process,
|
||||
int *const out_return_code) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
const unsigned long infinite = 0xFFFFFFFF;
|
||||
|
||||
if (process->stdin_file) {
|
||||
@@ -894,7 +909,7 @@ int subprocess_destroy(struct subprocess_s *const process) {
|
||||
process->stderr_file = SUBPROCESS_NULL;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
if (process->hProcess) {
|
||||
CloseHandle(process->hProcess);
|
||||
process->hProcess = SUBPROCESS_NULL;
|
||||
@@ -917,7 +932,7 @@ int subprocess_destroy(struct subprocess_s *const process) {
|
||||
}
|
||||
|
||||
int subprocess_terminate(struct subprocess_s *const process) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
unsigned int killed_process_exit_code;
|
||||
int success_terminate;
|
||||
int windows_call_result;
|
||||
@@ -936,7 +951,7 @@ int subprocess_terminate(struct subprocess_s *const process) {
|
||||
|
||||
unsigned subprocess_read_stdout(struct subprocess_s *const process,
|
||||
char *const buffer, unsigned size) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
void *handle;
|
||||
unsigned long bytes_read = 0;
|
||||
struct subprocess_overlapped_s overlapped = {0, 0, {{0, 0}}, SUBPROCESS_NULL};
|
||||
@@ -981,7 +996,7 @@ unsigned subprocess_read_stdout(struct subprocess_s *const process,
|
||||
|
||||
unsigned subprocess_read_stderr(struct subprocess_s *const process,
|
||||
char *const buffer, unsigned size) {
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
void *handle;
|
||||
unsigned long bytes_read = 0;
|
||||
struct subprocess_overlapped_s overlapped = {0, 0, {{0, 0}}, SUBPROCESS_NULL};
|
||||
@@ -1030,7 +1045,7 @@ int subprocess_alive(struct subprocess_s *const process) {
|
||||
if (!is_alive) {
|
||||
return 0;
|
||||
}
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_WIN32)
|
||||
{
|
||||
const unsigned long zero = 0x0;
|
||||
const unsigned long wait_object_0 = 0x00000000L;
|
||||
|
||||
Reference in New Issue
Block a user