diff --git a/.gitignore b/.gitignore index caed69009..ed3dc0654 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ projects/android-project-ant/gen projects/android-project-ant/assets projects/android-project-ant/libs src/examples/strobe -src/thirdparty/SDL2-2.0.12* +src/thirdparty/SDL2-2.0.* *.dll bin/ee* bin/eepp-* @@ -52,4 +52,6 @@ eepp.geany /bin/assets/icon/ee.iconset ecode.dmg /projects/linux/ecode/ecode.app -*.AppImage \ No newline at end of file +*.AppImage +/projects/mingw32/ecode/ecode/ +/projects/mingw32/ecode/ecode-* \ No newline at end of file diff --git a/include/eepp/physics/physicshelper.hpp b/include/eepp/physics/physicshelper.hpp index 1c1ae978b..49fa972e7 100644 --- a/include/eepp/physics/physicshelper.hpp +++ b/include/eepp/physics/physicshelper.hpp @@ -79,7 +79,7 @@ typedef cpBB cBB; #ifdef PHYSICS_RENDERER_ENABLED inline Color colorFromPointer( void* ptr ) { - unsigned long val = (long)ptr; + UintPtr val = (UintPtr)ptr; // hash the pointer up nicely val = ( val + 0x7ed55d16 ) + ( val << 12 ); diff --git a/premake4.lua b/premake4.lua index bbe973fba..12d7c2df5 100644 --- a/premake4.lua +++ b/premake4.lua @@ -538,7 +538,7 @@ function build_link_configuration( package_name, use_ee_icon ) add_cross_config_links() configuration "emscripten" - linkoptions { "-s TOTAL_MEMORY=67108864 -sALLOW_MEMORY_GROWTH" } + linkoptions { "-s TOTAL_MEMORY=67108864" } linkoptions { "-s USE_SDL=2" } buildoptions { "-s USE_SDL=2" } defines { "NO_POSIX_SPAWN" } diff --git a/premake5.lua b/premake5.lua index 9e033720a..a2d0c5882 100644 --- a/premake5.lua +++ b/premake5.lua @@ -7,6 +7,7 @@ newoption { trigger = "with-gles1", description = "Compile with GLES1 support" } newoption { trigger = "with-mojoal", description = "Compile with mojoAL as OpenAL implementation instead of using openal-soft (requires SDL2 backend)" } newoption { trigger = "use-frameworks", description = "In macOS it will try to link the external libraries from its frameworks. For example, instead of linking against SDL2 it will link against SDL2.framework." } newoption { trigger = "windows-vc-build", description = "This is used to build the framework in Visual Studio downloading its external dependencies and making them available to the VS project without having to install them manually." } +newoption { trigger = "windows-mingw-build", description = "This is used to build the framework with mingw downloading its external dependencies." } newoption { trigger = "with-emscripten-pthreads", description = "Enables emscripten build to use posix threads" } newoption { trigger = "with-mold-linker", description = "Tries to use the mold linker instead of the default linker of the toolchain" } newoption { @@ -88,9 +89,10 @@ os_links = { } backends = { } static_backends = { } backend_selected = false -remote_sdl2_version = "SDL2-2.0.20" -remote_sdl2_devel_src_url = "https://libsdl.org/release/SDL2-2.0.20.zip" -remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-2.0.20-VC.zip" +remote_sdl2_version = "SDL2-2.0.22" +remote_sdl2_devel_src_url = "https://libsdl.org/release/SDL2-2.0.22.zip" +remote_sdl2_devel_vc_url = "https://www.libsdl.org/release/SDL2-devel-2.0.2-VC.zip" +remote_sdl2_devel_mingw_url = "https://www.libsdl.org/release/SDL2-devel-2.0.22-mingw.zip" function incdirs( dirs ) if is_xcode() then @@ -103,13 +105,13 @@ function download_and_extract_sdl(sdl_url) print("Downloading: " .. sdl_url) local dest_dir = "src/thirdparty/" local local_file = dest_dir .. remote_sdl2_version .. ".zip" - local _, response_code = http.download(sdl_url, local_file) + local res, response_code = http.download(sdl_url, local_file) if response_code == 200 then print("Downloaded successfully to: " .. local_file) zip.extract(local_file, dest_dir) print("Extracted " .. local_file .. " into " .. dest_dir) else - print("Failed to download: " .. sdl_url) + print("Failed to download: " .. sdl_url .. " res: " .. res) exit(1) end end @@ -134,6 +136,8 @@ function download_and_extract_dependencies() if not os.isdir("src/thirdparty/" .. remote_sdl2_version) then if _OPTIONS["windows-vc-build"] then download_and_extract_sdl(remote_sdl2_devel_vc_url) + elseif _OPTIONS["windows-mingw-build"] then + download_and_extract_sdl(remote_sdl2_devel_mingw_url) elseif os.istarget("ios") then download_and_extract_sdl(remote_sdl2_devel_src_url) end @@ -289,6 +293,12 @@ function build_link_configuration( package_name, use_ee_icon ) filter { "options:windows-vc-build", "system:windows", "platforms:x86_64" } syslibdirs { "src/thirdparty/" .. remote_sdl2_version .."/lib/x64" } + filter { "options:windows-mingw-build", "architecture:x86", "options:cc=mingw" } + syslibdirs { "src/thirdparty/" .. remote_sdl2_version .."/i686-w64-mingw32/lib/" } + + filter { "options:windows-mingw-build", "architecture:x86_64", "options:cc=mingw" } + syslibdirs { "src/thirdparty/" .. remote_sdl2_version .."/x86_64-w64-mingw32/lib/" } + filter "system:emscripten" targetname ( package_name .. extension ) linkoptions { "-O3 -s TOTAL_MEMORY=67108864" } @@ -391,7 +401,7 @@ function add_static_links() end end -function can_add_static_backend( name ) +function can_add_static_backend() if _OPTIONS["with-static-backend"] then return true end @@ -591,6 +601,12 @@ function build_eepp( build_name ) filter "options:windows-vc-build" incdirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" } + filter { "options:windows-mingw-build", "architecture:x86", "options:cc=mingw" } + incdirs { "src/thirdparty/" .. remote_sdl2_version .."/i686-w64-mingw32/include/" } + + filter { "options:windows-mingw-build", "architecture:x86_64", "options:cc=mingw" } + incdirs { "src/thirdparty/" .. remote_sdl2_version .."/x86_64-w64-mingw32/include/" } + filter "action:vs*" incdirs { "src/thirdparty/libzip/vs" } @@ -744,6 +760,10 @@ workspace "eepp" build_base_cpp_configuration( "mojoal" ) filter "options:windows-vc-build" incdirs { "src/thirdparty/" .. remote_sdl2_version .. "/include" } + filter { "options:windows-mingw-build", "architecture:x86", "options:cc=mingw" } + incdirs { "src/thirdparty/" .. remote_sdl2_version .."/i686-w64-mingw32/include/" } + filter { "options:windows-mingw-build", "architecture:x86_64", "options:cc=mingw" } + incdirs { "src/thirdparty/" .. remote_sdl2_version .."/x86_64-w64-mingw32/include/" } project "efsw-static" kind "StaticLib" diff --git a/projects/linux/ecode/build.app.sh b/projects/linux/ecode/build.app.sh index bb1e5da49..99b32dd49 100755 --- a/projects/linux/ecode/build.app.sh +++ b/projects/linux/ecode/build.app.sh @@ -28,10 +28,16 @@ cp -r ../../../bin/assets/fonts/remixicon.ttf ecode.app/assets/fonts/ cp -r ../../../bin/assets/fonts/NotoEmoji-Regular.ttf ecode.app/assets/fonts/ cp -r ../../../bin/assets/fonts/NotoColorEmoji.ttf ecode.app/assets/fonts/ cp -r ../../../bin/assets/plugins ecode.app/assets/ -cp -r ../../../bin/assets/icon ecode.app/assets/ +mkdir -p ecode.app/assets/icon/ +cp -r ../../../bin/assets/icon/ee.png ecode.app/assets/icon/ mkdir ecode.app/assets/ui cp ../../../bin/assets/ui/breeze.css ecode.app/assets/ui/ +VERSIONPATH=../../../src/tools/ecode/version.hpp +ECODE_MAJOR_VERSION=$(grep "define ECODE_MAJOR_VERSION" $VERSIONPATH | awk '{print $3}') +ECODE_MINOR_VERSION=$(grep "define ECODE_MINOR_VERSION" $VERSIONPATH | awk '{print $3}') +ECODE_PATCH_LEVEL=$(grep "define ECODE_PATCH_LEVEL" $VERSIONPATH | awk '{print $3}') + export APPIMAGETOOL="appimagetool" if ! command -v appimagetool &> /dev/null @@ -41,4 +47,4 @@ then chmod +x "$APPIMAGETOOL" fi -$APPIMAGETOOL ecode.app +$APPIMAGETOOL ecode.app ecode-"$ECODE_MAJOR_VERSION"."$ECODE_MINOR_VERSION"."$ECODE_PATCH_LEVEL"-"$(arch)".AppImage diff --git a/projects/mingw32/ecode/build.app.sh b/projects/mingw32/ecode/build.app.sh new file mode 100755 index 000000000..31f0a5893 --- /dev/null +++ b/projects/mingw32/ecode/build.app.sh @@ -0,0 +1,51 @@ +#!/bin/bash +CANONPATH=$(readlink -f "$0") +DIRPATH="$(dirname "$CANONPATH")" +cd "$DIRPATH" || exit + +ARCH=x86 +ARCHI=i686 +for i in "$@"; do + case $i in + config=*) + ARCH="${i#*=}" + shift + ;; + *) + ;; + esac +done + +if [[ "$ARCH" == *"x86_64"* ]]; then + ARCH=x86_64 + ARCHI=$ARCH +fi + +../make.sh -e config=release_"$ARCH" -j"$(nproc)" ecode + +SDLVER=$(grep "remote_sdl2_version =" ../../../premake5.lua | awk '{print $3}' | tr -d '"') +rm -rf ./ecode +mkdir -p ecode/assets +cp ../../../bin/ecode.exe ecode/ +cp ../../../bin/eepp.dll ecode/ +cp ../../../src/thirdparty/"$SDLVER"/$ARCHI-w64-mingw32/bin/SDL2.dll ecode/ +mkdir -p ecode/assets/colorschemes +mkdir -p ecode/assets/fonts +cp -r ../../../bin/assets/colorschemes ecode/assets/ +cp -r ../../../bin/assets/fonts/DejaVuSansMono.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/fonts/nonicons.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/fonts/NotoSans-Regular.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/fonts/remixicon.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/fonts/NotoEmoji-Regular.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/fonts/NotoColorEmoji.ttf ecode/assets/fonts/ +cp -r ../../../bin/assets/plugins ecode/assets/ +mkdir ecode/assets/ui +cp ../../../bin/assets/ui/breeze.css ecode/assets/ui/ + +VERSIONPATH=../../../src/tools/ecode/version.hpp +ECODE_MAJOR_VERSION=$(grep "define ECODE_MAJOR_VERSION" $VERSIONPATH | awk '{print $3}') +ECODE_MINOR_VERSION=$(grep "define ECODE_MINOR_VERSION" $VERSIONPATH | awk '{print $3}') +ECODE_PATCH_LEVEL=$(grep "define ECODE_PATCH_LEVEL" $VERSIONPATH | awk '{print $3}') +ECODE_ZIP_NAME=ecode-$ECODE_MAJOR_VERSION.$ECODE_MINOR_VERSION.$ECODE_PATCH_LEVEL-$ARCH.zip + +zip -r "$ECODE_ZIP_NAME" ecode/ \ No newline at end of file diff --git a/projects/mingw32/make.sh b/projects/mingw32/make.sh index 42bbf0534..28d15cc72 100755 --- a/projects/mingw32/make.sh +++ b/projects/mingw32/make.sh @@ -1,17 +1,35 @@ -#!/bin/sh -cd $(dirname "$0") -premake5 --file=../../premake5.lua --os=windows --cc=mingw --with-mojoal gmake2 -cd ../../make/windows/ -mingw32-make $@ +#!/bin/bash +cd "$(dirname "$0")" || exit + +ARCH=32 +for i in "$@"; do + case $i in + config=*) + CONFIG="${i#*=}" + shift + ;; + *) + ;; + esac +done + +if [[ "$CONFIG" == *"x86_64"* ]]; then + ARCH=64 +fi + +premake5 --file=../../premake5.lua --os=windows --cc=mingw --with-mojoal --windows-mingw-build gmake2 +cd ../../make/windows/ || exit + +mingw"$ARCH"-make "$@" case "$OSTYPE" in darwin*|linux*|freebsd*) - cd ../../bin/ + cd ../../bin/ || exit ln -sf ../libs/windows/eepp.dll eepp.dll ln -sf ../libs/windows/eepp-debug.dll eepp-debug.dll ;; cygwin*|win*) - cd ../../libs/windows/ + cd ../../libs/windows/ || exit if [ -f eepp.dll ]; then cp -f eepp.dll ../../bin/eepp.dll diff --git a/src/eepp/system/color.cpp b/src/eepp/system/color.cpp index 64c36ea9a..39cffaeb3 100644 --- a/src/eepp/system/color.cpp +++ b/src/eepp/system/color.cpp @@ -297,7 +297,7 @@ Color Color::fromHsl( const Colorf& hsl ) { } Color Color::fromPointer( void* ptr ) { - unsigned long val = (long)ptr; + UintPtr val = (UintPtr)ptr; // hash the pointer up nicely val = ( val + 0x7ed55d16 ) + ( val << 12 ); diff --git a/src/eepp/system/platform/win/clockimpl.cpp b/src/eepp/system/platform/win/clockimpl.cpp index 278d23699..1e13f72b0 100644 --- a/src/eepp/system/platform/win/clockimpl.cpp +++ b/src/eepp/system/platform/win/clockimpl.cpp @@ -11,14 +11,10 @@ ClockImpl::~ClockImpl() {} void ClockImpl::restart() { // Get the current process core mask - DWORD procMask; - DWORD sysMask; + DWORD_PTR procMask; + DWORD_PTR sysMask; -#if _MSC_VER >= 1400 && defined( _M_X64 ) - GetProcessAffinityMask( GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask ); -#else GetProcessAffinityMask( GetCurrentProcess(), &procMask, &sysMask ); -#endif // Find the lowest core that this process uses if ( mTimerMask == 0 ) { diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 2da1c2093..bdba08b86 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -3284,6 +3284,10 @@ void App::init( std::string file, const Float& pidelDensity, const std::string& } } +} // namespace ecode + +using namespace ecode; + #if EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN std::vector parseEmscriptenArgs( int argc, char* argv[] ) { if ( argc < 1 ) @@ -3345,5 +3349,3 @@ EE_MAIN_FUNC int main( int argc, char* argv[] ) { return EXIT_SUCCESS; } - -} // namespace ecode