From a9edcf7e04052b1ff16bae3df7dc45d536be6cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marti=CC=81n=20Lucas=20Golini?= Date: Fri, 17 Jan 2020 16:32:25 -0300 Subject: [PATCH] iOS build fixes. --- premake4.lua | 49 ++++++++++++++----- premake5.lua | 10 ++-- projects/ios/compile-all.sh | 12 ++--- .../ios/{compile-arm7.sh => compile-arm64.sh} | 8 +-- projects/ios/compile-x86.sh | 6 +-- projects/ios/compile-x86_64.sh | 18 +++++++ projects/osx/ee.cflags | 1 + projects/osx/ee.cxxflags | 1 + projects/osx/ee.files | 36 +++++++++++--- projects/osx/ee.includes | 4 +- src/eepp/system/sys.cpp | 4 +- 11 files changed, 108 insertions(+), 41 deletions(-) rename projects/ios/{compile-arm7.sh => compile-arm64.sh} (58%) create mode 100755 projects/ios/compile-x86_64.sh create mode 100644 projects/osx/ee.cflags create mode 100644 projects/osx/ee.cxxflags diff --git a/premake4.lua b/premake4.lua index 047a2e366..99324bfda 100644 --- a/premake4.lua +++ b/premake4.lua @@ -119,10 +119,10 @@ newplatform { } newclangtoolchain { - name ="ios-arm7", - description = "iOS ARMv7", + name ="ios-arm64", + description = "iOS ARM64", prefix = iif( os.getenv("TOOLCHAINPATH"), os.getenv("TOOLCHAINPATH"), "" ), - cppflags = "-arch armv7 -mfpu=neon" + cppflags = "-arch arm64" } newclangtoolchain { @@ -132,6 +132,13 @@ newclangtoolchain { cppflags = "-m32 -arch i386" } +newclangtoolchain { + name ="ios-x86_64", + description = "iOS x86_64", + prefix = iif( os.getenv("TOOLCHAINPATH"), os.getenv("TOOLCHAINPATH"), "" ), + cppflags = "-m64 -arch x86_64" +} + if _OPTIONS.platform then -- overwrite the native platform with the options::platform premake.gcc.platforms['Native'] = premake.gcc.platforms[_OPTIONS.platform] @@ -165,8 +172,9 @@ function explode(div,str) end function os.get_real() - if _OPTIONS.platform == "ios-arm7" or + if _OPTIONS.platform == "ios-arm64" or _OPTIONS.platform == "ios-x86" or + _OPTIONS.platform == "ios-x86_64" or _OPTIONS.platform == "ios-cross-arm7" or _OPTIONS.platform == "ios-cross-x86" then return "ios" @@ -289,6 +297,9 @@ function build_base_configuration( package_name ) includedirs { "src/thirdparty/libzip/vs" } end + set_ios_config() + set_xcode_config() + configuration "debug" defines { "DEBUG" } flags { "Symbols" } @@ -304,9 +315,6 @@ function build_base_configuration( package_name ) buildoptions{ "-Wall", "-std=gnu99" } end targetname ( package_name ) - - set_ios_config() - set_xcode_config() end function build_base_cpp_configuration( package_name ) @@ -409,6 +417,10 @@ function build_link_configuration( package_name, use_ee_icon ) if _OPTIONS.platform == "ios-cross-x86" then extension = ".x86.ios" end + + if _OPTIONS.platform == "ios-cross-x86_64" then + extension = ".x86_64.ios" + end end configuration "debug" @@ -480,11 +492,11 @@ function generate_os_links() end if not _OPTIONS["with-mojoal"] then - if os.istarget("linux") or os.istarget("freebsd") or os.istarget("haiku") or os.istarget("emscripten") 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.istarget("windows") or os.istarget("mingw32") then + elseif os.is_real("windows") or os.is_real("mingw32") then multiple_insert( os_links, { "OpenAL32" } ) - elseif os.istarget("macosx") or os.istarget("ios") then + elseif os.is_real("macosx") or os.is_real("ios") then multiple_insert( os_links, { "OpenAL.framework" } ) end end @@ -570,7 +582,7 @@ function set_xcode_config() end function set_ios_config() - if _OPTIONS.platform == "ios-arm7" or _OPTIONS.platform == "ios-x86" then + if _OPTIONS.platform == "ios-arm64" or _OPTIONS.platform == "ios-x86" or _OPTIONS.platform == "ios-x86_64" then local err = false if nil == os.getenv("TOOLCHAINPATH") then @@ -581,13 +593,13 @@ function set_ios_config() if nil == os.getenv("SYSROOTPATH") then print("You must set SYSROOTPATH enviroment variable.") - print("\tExample: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk") + print("\tExample: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk") err = true end if nil == os.getenv("IOSVERSION") then print("You must set IOSVERSION enviroment variable.") - print("\tExample: 5.0") + print("\tExample: 12.1") err = true end @@ -675,6 +687,16 @@ function check_ssl_support() defines { "EE_SSL_SUPPORT" } end +function set_macos_and_ios_config() + if os.is_real("macosx") and ( is_xcode() or _OPTIONS["use-frameworks"] ) then + libdirs { "/System/Library/Frameworks", "/Library/Frameworks" } + end + + if _OPTIONS["use-frameworks"] then + defines { "EE_USE_FRAMEWORKS" } + end +end + function build_eepp( build_name ) includedirs { "include", "src", "src/thirdparty", "include/eepp/thirdparty", "src/thirdparty/freetype2/include", "src/thirdparty/zlib", "src/thirdparty/libogg/include", "src/thirdparty/libvorbis/include", "src/thirdparty/mbedtls/include" } @@ -683,6 +705,7 @@ function build_eepp( build_name ) includedirs { "src/thirdparty/mojoAL" } end + set_macos_and_ios_config() set_ios_config() set_xcode_config() diff --git a/premake5.lua b/premake5.lua index da69d65fa..94959c098 100644 --- a/premake5.lua +++ b/premake5.lua @@ -125,6 +125,9 @@ function build_base_configuration( package_name ) includedirs { "src/thirdparty/libzip/vs" } end + set_ios_config() + set_xcode_config() + configuration "debug" defines { "DEBUG" } symbols "On" @@ -139,9 +142,6 @@ function build_base_configuration( package_name ) buildoptions{ "-Wall", "-std=gnu99" } end targetname ( package_name ) - - set_ios_config() - set_xcode_config() end function build_base_cpp_configuration( package_name ) @@ -516,7 +516,7 @@ function check_ssl_support() defines { "EE_SSL_SUPPORT" } end -function set_macos_config() +function set_macos_and_ios_config() if os.istarget("macosx") and ( is_xcode() or _OPTIONS["use-frameworks"] ) then libdirs { "/System/Library/Frameworks", "/Library/Frameworks" } end @@ -534,7 +534,7 @@ function build_eepp( build_name ) includedirs { "src/thirdparty/mojoAL" } end - set_macos_config() + set_macos_and_ios_config() set_ios_config() set_xcode_config() diff --git a/projects/ios/compile-all.sh b/projects/ios/compile-all.sh index dbbf7cb28..511b92f4f 100755 --- a/projects/ios/compile-all.sh +++ b/projects/ios/compile-all.sh @@ -1,15 +1,15 @@ #!/bin/sh cd $(dirname "$0") -./compile-arm7.sh $1 $2 $3 $4 $5 -./compile-x86.sh $1 $2 $3 $4 $5 +./compile-arm64.sh $@ +./compile-x86_64.sh $@ cd ../../libs/ios/ -if [ -f arm7/libeepp-static-debug.a ] && [ -f x86/libeepp-static-debug.a ]; then -lipo -create -arch armv7 arm7/libeepp-static-debug.a -arch i386 x86/libeepp-static-debug.a -output ./libeepp-debug.a +if [ -f arm64/libeepp-static-debug.a ] && [ -f x86_64/libeepp-static-debug.a ]; then +lipo -create -arch arm64 arm64/libeepp-static-debug.a -arch x86_64 x86_64/libeepp-static-debug.a -output ./libeepp-debug.a fi if [ -f arm7/libeepp-static.a ] && [ -f x86/libeepp-static.a ]; then -lipo -create -arch armv7 arm7/libeepp-static.a -arch i386 x86/libeepp-static.a -output ./libeepp.a -fi \ No newline at end of file +lipo -create -arch arm64 arm64/libeepp-static.a -arch x86_64 x86_64/libeepp-static.a -output ./libeepp.a +fi diff --git a/projects/ios/compile-arm7.sh b/projects/ios/compile-arm64.sh similarity index 58% rename from projects/ios/compile-arm7.sh rename to projects/ios/compile-arm64.sh index 5fcabb786..55dc67830 100755 --- a/projects/ios/compile-arm7.sh +++ b/projects/ios/compile-arm64.sh @@ -5,14 +5,14 @@ CLANGPATH=`xcrun -find -sdk iphoneos clang` export TOOLCHAINPATH=`dirname $CLANGPATH`/ if [ -z "$IOSVERSION" ]; then -export IOSVERSION=5.0 +export IOSVERSION=12.1 fi if [ -z "$SYSROOTPATH" ]; then export SYSROOTPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$IOSVERSION.sdk/ fi -premake4 --file=../../premake4.lua --platform=ios-arm7 --with-static-eepp --with-gles1 --with-gles2 --with-static-backend gmake +premake4 --file=../../premake4.lua --platform=ios-arm64 --with-static-eepp --with-gles1 --with-gles2 --with-static-backend --use-frameworks gmake -cd ../../make/ios-arm7/ -make $@ eepp-static +cd ../../make/ios-arm64/ +make -j`nproc` $@ eepp-static diff --git a/projects/ios/compile-x86.sh b/projects/ios/compile-x86.sh index f75a75113..c9f5588bd 100755 --- a/projects/ios/compile-x86.sh +++ b/projects/ios/compile-x86.sh @@ -5,14 +5,14 @@ CLANGPATH=`xcrun -find -sdk iphoneos clang` export TOOLCHAINPATH=`dirname $CLANGPATH`/ if [ -z "$IOSVERSION" ]; then -export IOSVERSION=7.0 +export IOSVERSION=10.0 fi if [ -z "$SYSROOTPATH" ]; then export SYSROOTPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$IOSVERSION.sdk/ fi -premake4 --file=../../premake4.lua --platform=ios-x86 --with-static-eepp --with-gles1 --with-gles2 --with-static-backend gmake +premake4 --file=../../premake4.lua --platform=ios-x86 --with-static-eepp --with-gles1 --with-gles2 --with-static-backend --use-frameworks gmake cd ../../make/ios-x86/ -make $@ eepp-static +make -j`nproc` $@ eepp-static diff --git a/projects/ios/compile-x86_64.sh b/projects/ios/compile-x86_64.sh new file mode 100755 index 000000000..760bf5644 --- /dev/null +++ b/projects/ios/compile-x86_64.sh @@ -0,0 +1,18 @@ +#!/bin/sh +cd $(dirname "$0") + +CLANGPATH=`xcrun -find -sdk iphoneos clang` +export TOOLCHAINPATH=`dirname $CLANGPATH`/ + +if [ -z "$IOSVERSION" ]; then +export IOSVERSION=12.1 +fi + +if [ -z "$SYSROOTPATH" ]; then +export SYSROOTPATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator$IOSVERSION.sdk/ +fi + +premake4 --file=../../premake4.lua --platform=ios-x86_64 --with-static-eepp --with-gles1 --with-gles2 --with-static-backend --use-frameworks gmake + +cd ../../make/ios-x86_64/ +make -j`nproc` $@ eepp-static diff --git a/projects/osx/ee.cflags b/projects/osx/ee.cflags new file mode 100644 index 000000000..68d516530 --- /dev/null +++ b/projects/osx/ee.cflags @@ -0,0 +1 @@ +-std=c17 \ No newline at end of file diff --git a/projects/osx/ee.cxxflags b/projects/osx/ee.cxxflags new file mode 100644 index 000000000..6435dfce2 --- /dev/null +++ b/projects/osx/ee.cxxflags @@ -0,0 +1 @@ +-std=c++17 \ No newline at end of file diff --git a/projects/osx/ee.files b/projects/osx/ee.files index c66ab6d52..dd0e4e397 100644 --- a/projects/osx/ee.files +++ b/projects/osx/ee.files @@ -1,4 +1,6 @@ +../../README.md ../../bin/assets/ee.ini +../../bin/assets/layouts/imported.css ../../bin/assets/layouts/test.css ../../bin/assets/layouts/test.xml ../../bin/assets/layouts/test_widgets.xml @@ -26,13 +28,11 @@ ../../include/eepp/audio/soundsource.hpp ../../include/eepp/audio/soundstream.hpp ../../include/eepp/config.hpp -../../include/eepp/core/allocator.hpp ../../include/eepp/core/core.hpp ../../include/eepp/core/debug.hpp ../../include/eepp/core.hpp ../../include/eepp/core/memorymanager.hpp ../../include/eepp/core/noncopyable.hpp -../../include/eepp/core/stlcontainers.hpp ../../include/eepp/core/string.hpp ../../include/eepp/core/utf.hpp ../../include/eepp/core/utf.inl @@ -49,7 +49,6 @@ ../../include/eepp/graphics/drawableresource.hpp ../../include/eepp/graphics/drawablesearcher.hpp ../../include/eepp/graphics/fontbmfont.hpp -../../include/eepp/graphics/fonthelper.hpp ../../include/eepp/graphics/font.hpp ../../include/eepp/graphics/fontmanager.hpp ../../include/eepp/graphics/fontsprite.hpp @@ -102,6 +101,7 @@ ../../include/eepp/graphics/textureloader.hpp ../../include/eepp/graphics/texturepacker.hpp ../../include/eepp/graphics/textureregion.hpp +../../include/eepp/graphics/triangledrawable.hpp ../../include/eepp/graphics/vertexbufferhelper.hpp ../../include/eepp/graphics/vertexbuffer.hpp ../../include/eepp/graphics/vertexbuffermanager.hpp @@ -215,7 +215,6 @@ ../../include/eepp/scene.hpp ../../include/eepp/scene/keyevent.hpp ../../include/eepp/scene/mouseevent.hpp -../../include/eepp/scene/nodeattribute.hpp ../../include/eepp/scene/node.hpp ../../include/eepp/scene/nodemessage.hpp ../../include/eepp/scene/scenemanager.hpp @@ -230,6 +229,7 @@ ../../include/eepp/system/directorypack.hpp ../../include/eepp/system/filesystem.hpp ../../include/eepp/system.hpp +../../include/eepp/system/functionstring.hpp ../../include/eepp/system/inifile.hpp ../../include/eepp/system/iostreamdeflate.hpp ../../include/eepp/system/iostreamfile.hpp @@ -288,17 +288,27 @@ ../../include/eepp/thirdparty/PlusCallback/callback.hpp ../../include/eepp/ui/base.hpp ../../include/eepp/ui.hpp +../../include/eepp/ui/css/mediaquery.hpp +../../include/eepp/ui/css/propertydefinition.hpp +../../include/eepp/ui/css/propertyspecification.hpp +../../include/eepp/ui/css/shorthanddefinition.hpp ../../include/eepp/ui/css/stylesheet.hpp ../../include/eepp/ui/css/stylesheetelement.hpp +../../include/eepp/ui/css/stylesheetlength.hpp ../../include/eepp/ui/css/stylesheetparser.hpp ../../include/eepp/ui/css/stylesheetpropertiesparser.hpp ../../include/eepp/ui/css/stylesheetproperty.hpp +../../include/eepp/ui/css/stylesheetpropertytransition.hpp ../../include/eepp/ui/css/stylesheetselector.hpp ../../include/eepp/ui/css/stylesheetselectorparser.hpp ../../include/eepp/ui/css/stylesheetselectorrule.hpp +../../include/eepp/ui/css/stylesheetspecification.hpp ../../include/eepp/ui/css/stylesheetstyle.hpp +../../include/eepp/ui/css/stylesheetvariable.hpp +../../include/eepp/ui/css/transitiondefinition.hpp ../../include/eepp/ui/marginmove/scale.hpp ../../include/eepp/ui/tools/textureatlaseditor.hpp +../../include/eepp/ui/tools/uicolorpicker.hpp ../../include/eepp/ui/uicheckbox.hpp ../../include/eepp/ui/uicombobox.hpp ../../include/eepp/ui/uicommondialog.hpp @@ -322,6 +332,7 @@ ../../include/eepp/ui/uimenusubmenu.hpp ../../include/eepp/ui/uimessagebox.hpp ../../include/eepp/ui/uinode.hpp +../../include/eepp/ui/uinodedrawable.hpp ../../include/eepp/ui/uipopupmenu.hpp ../../include/eepp/ui/uiprogressbar.hpp ../../include/eepp/ui/uipushbutton.hpp @@ -333,7 +344,6 @@ ../../include/eepp/ui/uiselectbutton.hpp ../../include/eepp/ui/uiskin.hpp ../../include/eepp/ui/uiskinstate.hpp -../../include/eepp/ui/uisliderbutton.hpp ../../include/eepp/ui/uislider.hpp ../../include/eepp/ui/uispinbox.hpp ../../include/eepp/ui/uisprite.hpp @@ -528,6 +538,7 @@ ../../src/eepp/graphics/texturepackertex.hpp ../../src/eepp/graphics/textureregion.cpp ../../src/eepp/graphics/scopedtexture.hpp +../../src/eepp/graphics/triangledrawable.cpp ../../src/eepp/graphics/vertexbuffer.cpp ../../src/eepp/graphics/vertexbuffermanager.cpp ../../src/eepp/graphics/vertexbuffermanager.hpp @@ -647,7 +658,6 @@ ../../src/eepp/scene/eventdispatcher.cpp ../../src/eepp/scene/keyevent.cpp ../../src/eepp/scene/mouseevent.cpp -../../src/eepp/scene/nodeattribute.cpp ../../src/eepp/scene/node.cpp ../../src/eepp/scene/nodemessage.cpp ../../src/eepp/scene/scenemanager.cpp @@ -659,6 +669,7 @@ ../../src/eepp/system/condition.cpp ../../src/eepp/system/directorypack.cpp ../../src/eepp/system/filesystem.cpp +../../src/eepp/system/functionstring.cpp ../../src/eepp/system/inifile.cpp ../../src/eepp/system/iostreamdeflate.cpp ../../src/eepp/system/iostreamfile.cpp @@ -706,19 +717,29 @@ ../../src/eepp/system/translator.cpp ../../src/eepp/system/virtualfilesystem.cpp ../../src/eepp/system/zip.cpp +../../src/eepp/ui/css/mediaquery.cpp +../../src/eepp/ui/css/propertydefinition.cpp +../../src/eepp/ui/css/propertyspecification.cpp +../../src/eepp/ui/css/shorthanddefinition.cpp ../../src/eepp/ui/css/stylesheet.cpp +../../src/eepp/ui/css/stylesheetlength.cpp ../../src/eepp/ui/css/stylesheetparser.cpp ../../src/eepp/ui/css/stylesheetpropertiesparser.cpp ../../src/eepp/ui/css/stylesheetproperty.cpp +../../src/eepp/ui/css/stylesheetpropertytransition.cpp ../../src/eepp/ui/css/stylesheetselector.cpp ../../src/eepp/ui/css/stylesheetselectorparser.cpp ../../src/eepp/ui/css/stylesheetselectorrule.cpp +../../src/eepp/ui/css/stylesheetspecification.cpp ../../src/eepp/ui/css/stylesheetstyle.cpp +../../src/eepp/ui/css/stylesheetvariable.cpp +../../src/eepp/ui/css/transitiondefinition.cpp ../../src/eepp/ui/tools/textureatlaseditor.cpp ../../src/eepp/ui/tools/textureatlasnew.cpp ../../src/eepp/ui/tools/textureatlasnew.hpp ../../src/eepp/ui/tools/textureatlastextureregioneditor.cpp ../../src/eepp/ui/tools/textureatlastextureregioneditor.hpp +../../src/eepp/ui/tools/uicolorpicker.cpp ../../src/eepp/ui/uicheckbox.cpp ../../src/eepp/ui/uicombobox.cpp ../../src/eepp/ui/uicommondialog.cpp @@ -739,6 +760,7 @@ ../../src/eepp/ui/uimenusubmenu.cpp ../../src/eepp/ui/uimessagebox.cpp ../../src/eepp/ui/uinode.cpp +../../src/eepp/ui/uinodedrawable.cpp ../../src/eepp/ui/uipopupmenu.cpp ../../src/eepp/ui/uiprogressbar.cpp ../../src/eepp/ui/uipushbutton.cpp @@ -750,7 +772,6 @@ ../../src/eepp/ui/uiselectbutton.cpp ../../src/eepp/ui/uiskin.cpp ../../src/eepp/ui/uiskinstate.cpp -../../src/eepp/ui/uisliderbutton.cpp ../../src/eepp/ui/uislider.cpp ../../src/eepp/ui/uispinbox.cpp ../../src/eepp/ui/uisprite.cpp @@ -864,6 +885,7 @@ ../../src/examples/sound/sound.cpp ../../src/examples/sprites/sprites.cpp ../../src/examples/strobe/strobe.cpp +../../src/examples/ui_hello_world/ui_hello_world.cpp ../../src/examples/vbo_fbo_batch/vbo_fbo_batch.cpp ../../src/test/eetest.cpp ../../src/test/eetest.hpp diff --git a/projects/osx/ee.includes b/projects/osx/ee.includes index e2b861710..f9cb5e0c8 100644 --- a/projects/osx/ee.includes +++ b/projects/osx/ee.includes @@ -5,4 +5,6 @@ ../../src/thirdparty/efsw/include ../../src/thirdparty/libvorbis/include /usr/include/freetype2/ -/Library/Frameworks/SDL2.framework/Headers +../../include/eepp/ui/css +../../src/eepp/ui/css +../../src/thirdparty/mbedtls/include diff --git a/src/eepp/system/sys.cpp b/src/eepp/system/sys.cpp index bf9fa635b..2512dd69e 100644 --- a/src/eepp/system/sys.cpp +++ b/src/eepp/system/sys.cpp @@ -549,7 +549,7 @@ static std::string sGetProcessPath() { #elif EE_PLATFORM == EE_PLATFORM_ANDROID return Window::Engine::instance()->getPlatformHelper()->getExternalStoragePath() + "/"; #else -#warning Sys::GetProcessPath() not implemented on this platform. ( will return "./" ) +#warning Sys::getProcessPath() not implemented on this platform. ( will return "./" ) return "./"; #endif } @@ -655,7 +655,7 @@ std::string Sys::getConfigPath( std::string appname ) { snprintf( path, EE_MAX_CFG_PATH_LEN, "%s/.config/%s", home, appname.c_str() ); } #elif EE_PLATFORM == EE_PLATFORM_IOS - return GetProcessPath() + "config"; + return getProcessPath() + "config"; #elif EE_PLATFORM == EE_PLATFORM_ANDROID return Window::Engine::instance()->getPlatformHelper()->getInternalStoragePath() + "/"; #else