Difference between revisions of "Compiling Gideros Source"

From GiderosMobile
 
(103 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
 
The following instructions are for developers who want to contribute to or otherwise experiment with the Gideros C/C++ engine and are ''not'' necessary for either building or deploying apps made with Gideros.
 
The following instructions are for developers who want to contribute to or otherwise experiment with the Gideros C/C++ engine and are ''not'' necessary for either building or deploying apps made with Gideros.
  
 
The Gideros project consists of the Gideros Studio IDE, the Gideros SDK libraries, Gideros Texture Packer, Gideros Font Creator, "players" or export templates for all the platforms Gideros supports, all targets of all plugins, a daemon and a bridge. The build system is flexible, so you only need the tools for the targets you are interested in deploying to with Qt (and MSYS2 on Windows) being a realistic minimum.
 
The Gideros project consists of the Gideros Studio IDE, the Gideros SDK libraries, Gideros Texture Packer, Gideros Font Creator, "players" or export templates for all the platforms Gideros supports, all targets of all plugins, a daemon and a bridge. The build system is flexible, so you only need the tools for the targets you are interested in deploying to with Qt (and MSYS2 on Windows) being a realistic minimum.
  
== Requirements ==
+
<div class="noautonum">__TOC__</div>
 +
 
 +
== 1. Requirements ==
 
=== 1.1 Install QT ===
 
=== 1.1 Install QT ===
    https://www.qt.io/download-open-source/
+
https://www.qt.io/download-open-source/
 
 
When installing, expand the tree view and ensure you are installing the MinGW child option of the Qt
 
version checkbox, as well as the MinGW option in the Tools section.
 
  
Recommended version 5.9.1 with MinGW 5.3
+
Recommended version 6.3 with MinGW <br />
  
Double click on the downloaded file and follow instructions.  
+
Double click on the downloaded file and follow instructions. When installing, expand the tree view and ensure you have ticked the MinGW child option of the Qt version checkbox, as well as the MinGW option in the Tools section.
 +
Beside main QT package, you'll need the following additional components:
 +
* WebSocket additional library
 +
* Multimedia additional library
 +
* Qt5 Compatibility addon
 
    
 
    
 
(MAC) Move the created folder into your user account folder  
 
(MAC) Move the created folder into your user account folder  
 +
 +
(LINUX)
 +
On Debian 11:
 +
echo "deb http://deb.debian.org/debian bullseye-backports main" >>/etc/apt/sources.list
 +
apt update
 +
apt install qt6-base-dev qt6-websockets-dev qt6-multimedia-dev qt6-5compat-dev
 +
 +
Depending on your distribution, you may need to install qt5 websocket lib seperately (sudo apt-get install libqt5websockets5-dev)
  
 
------
 
------
  
=== 1.2 (PC) Install console MSYS2 ===
+
===1.2 (PC) Install MSYS2 Console===
 
     https://msys2.github.io/  
 
     https://msys2.github.io/  
  
Double click on the downloaded file and follow instructions.  
+
Double click on the downloaded file (msys2-i686) and follow instructions.  
  
 
Open 32 bit MSYS2 shell: msys2_shell.cmd
 
Open 32 bit MSYS2 shell: msys2_shell.cmd
<source lang="bash">
+
<syntaxhighlight lang="bash">
pacman –Sy pacman
+
pacman -Sy pacman
pacman –Syu
+
pacman -Syu
pacman –Su
+
pacman -Su
pacman –S tar
+
pacman -S tar
pacman –S zip
+
pacman -S zip
pacman –S git
+
pacman -S unzip
pacman –S base-devel
+
pacman -S git
</source>
+
pacman -S base-devel
 +
pacman -S python
 +
#For compiling win32/32bit under a MinGW64
 +
pacman -S mingw-w64-i686-toolchain
 +
pacman -S mingw-w64-i686-glew
 +
pacman -S mingw-w64-i686-curl
 +
pacman -S mingw-w64-i686-libpng
 +
#For compiling win32/64bit under a MinGW64
 +
pacman -S mingw-w64-x86_64-toolchain
 +
pacman -S mingw-w64-x86_64-glew
 +
pacman -S mingw-w64-x86_64-curl
 +
pacman -S mingw-w64-x86_64-libpng
 +
</syntaxhighlight>
 
------
 
------
  
=== 1.3 (Mac) Install Git ===
+
=== 1.3 (Mac) Install Git & xcpretty ===
 
     http://git-scm.com/downloads
 
     http://git-scm.com/downloads
 
      
 
      
Line 42: Line 64:
  
 
(MAC) open a terminal window  
 
(MAC) open a terminal window  
<source lang="bash">
+
<syntaxhighlight lang="bash">
git config –global user.name "your git login"  
+
git config -global user.name "your git login"  
git config –global user.email "your git email"
+
git config -global user.email "your git email"
</source>
+
sudo gem install xcpretty
 +
</syntaxhighlight>
 +
------
 +
=== 1.3.1 (Linux/Debian) Install Git, build-tools ===
 +
<syntaxhighlight lang="bash">
 +
apt install git build-essential libxcb-xinerama0 libgl1-mesa-dev libz-dev libasound2-dev libglew-dev libglfw3-dev libcurl4-openssl-dev patchelf zip
 +
git config --global user.email "your git email"
 +
</syntaxhighlight>
 +
------
 +
 
 +
=== 1.4 (PC) Android requirements ===
 +
 
 +
==== 1.4.1 Install Android Studio and NDK ====
 +
 
 +
    https://developer.android.com/studio/index.html
 +
    https://developer.android.com/ndk/downloads/older_releases.html
 +
 
 +
Recommended NDK is 25c (the x86_64 version)
 +
 
 +
Once downloaded, copy the contents of the NDK to your home or C: folder, rename the folder that you copied to 'android-ndk', for example you will end up with 'c:\android-ndk' and below that folders that say build, meta, platforms, etc.
 +
 
 +
==== 1.4.2 Install Ant (no longer required but kept util someone confirms this)====
 +
    https://ant.apache.org/
 +
 
 +
Once downloaded, copy the contents of the install archive/zip file to your home folder or C: drive.
 +
Eg: so you have a folder called c:\apache-ant-1.10.5 with bin, etc, lib, manual folders within that.
 +
 
 +
==== 1.4.3 Mix Old and New Tools (no longer required but kept util someone confirms this) ====
 +
 
 +
Gideros uses Ant to build the player, unfortunately the tools to support Ant are now missing from the latest Android tools.
 +
 
 +
 
 +
There is a fix for this:
 +
 
 +
# Rename the existing 'tools' folder in the Android SDK folder to 'tools_new'.
 +
# Download an older (March 2016) version of the tools and copy that folder to the Android SDK folder.
 +
# Copy the contents of 'tools_new' over the contents of 'tools'.
 +
 
 +
Here is where you can download the compatible set of tools from:
 +
 
 +
(PC) https://dl.google.com/android/repository/tools_r25.2.5-windows.zip
 +
 
 +
(MAC) https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip
 +
 
 +
(LINUX) https://dl.google.com/android/repository/tools_r25.2.5-linux.zip
 +
 
 +
------
 +
 
 +
=== 1.5 Install Java ===
 +
You need the Java JDK
 +
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
 +
 
 +
------
 +
 
 +
=== 1.6 (PC) Install Visual Studio ===
 +
    https://www.visualstudio.com/downloads/
 +
 
 +
Install [https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk Win 8.1 SDK]
 +
 
 +
Install [https://marketplace.visualstudio.com/items?itemName=AdMediator.MicrosoftAdvertisingSDKforWindowsandWindowsPhone8x Microsoft Advertising SDK for Windows and Windows Phone 8.x]
 +
 
 +
Ensure that you have MSBuild v12 or v14 installed (building with the makefile will fail with an incorrect version).
 +
 
 +
------
 +
 
 +
=== 1.7 (MAC) Install Xcode ===
 +
    https://itunes.apple.com/fr/app/xcode/id497799835?mt=12
 +
 
 +
------
  
 +
=== 1.8 (Mac) ensure xcode command line tools are working ===
 +
(MAC) Open a terminal window
 +
<syntaxhighlight lang="bash">
 +
sudo xCodebuild -license
 +
quit
 +
agree
 +
</syntaxhighlight>
 +
<br />
 
------
 
------
  
=== 1.4 Install Gideros ===
+
=== 1.9 Install Python ===
 +
https://www.python.org/downloads/release/python-2712/
 +
 
 +
You need Python 2.7.12 or later to install emscripten properly.
 +
 
 +
Once installed, add it to your command line path, eg: c:\python27, on windows you can do this by right-clicking on 'myComputer' or 'This PC', go to 'Properties', click 'Advanced System Settings', Click 'Environmental Variables', double-click 'Path', add 'c:\python27'.
  
==== 1.4.1 Fetch gideros source code ====
+
------
 +
 
 +
=== 1.10 Install emscripten ===
 +
    http://kripken.github.io/emscripten-site/
 +
 
 +
You need this is you want to build for HTML5 + Facebook games.
 +
 
 +
Using a shell or MSYS2 (previously installed) on windows, go to your home or C: folder and type:
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/juj/emsdk.git
 +
</syntaxhighlight>
 +
 
 +
Once that has completed open a command prompt in that folder on Windows, on other system just cd to the folder.
 +
 
 +
Using emsdk, install and activate all the latest packages:
 +
 
 +
<syntaxhighlight lang="bash">
 +
#(on non-PC put ./ before emsdk)
 +
emsdk install latest
 +
emsdk activate latest
 +
</syntaxhighlight>
 +
 
 +
(PC) Type:
 +
<syntaxhighlight lang="bash">
 +
emsdk_env.bat
 +
</syntaxhighlight>
 +
 
 +
(MAC) Type:
 +
<syntaxhighlight lang="bash">
 +
source ./emsdk_env.sh
 +
</syntaxhighlight>
 +
 
 +
To use incoming branch of emscripten, use these commands instead:
 +
<syntaxhighlight lang="bash">
 +
#(on non-PC put ./ before emsdk)
 +
emsdk install sdk-incoming-64bit
 +
emsdk activate sdk-incoming-64bit
 +
</syntaxhighlight>
 +
 
 +
To further use Gideros own git fork of emscripten:
 +
<syntaxhighlight lang="bash">
 +
cd emscripten/incoming
 +
# Add a git remote link to your own repository.
 +
git remote add gideros https://github.com/gideros/emscripten.git
 +
# Obtain the changes in your link.
 +
git fetch gideros
 +
# Switch the emscripten-incoming tool to use your fork.
 +
git checkout -b gideros_incoming --track gideros/incoming
 +
#Get back to emscripten directory and rebuild
 +
cd ../..
 +
emsdk install sdk-incoming-64bit
 +
</syntaxhighlight>
 +
 
 +
 
 +
These can also be installed within emsdk: git, crunch, and spidermonkey
 +
<syntaxhighlight lang="bash">
 +
(on non-PC put ./ before emsdk)
 +
emsdk install git-1.9.4
 +
emsdk install crunch-1.03
 +
emsdk install spidermonkey-37.0.1-64bit
 +
emsdk activate git-1.9.4
 +
emsdk activate crunch-1.03
 +
emsdk activate spidermonkey-37.0.1-64bit
 +
(PC) emsdk_env.bat
 +
(MAC) source ./emsdk_env.sh
 +
</syntaxhighlight>
 +
 
 +
(PC) Make sure the environment variable EM_CONFIG is set to the location of your emscripten config file.
 +
 
 +
The emscripten build also needs the CMake command.  You can download it and extract it to your home or C: folder.  Don't forget to add it's path to the end of the EMSDKPATH in Makefile.def.
 +
 
 +
https://cmake.org/download/
 +
 
 +
------
 +
 
 +
=== 1.11 Install Steam SDK ===
 +
    https://partner.steamgames.com/?goto=%2Fdownloads%2Fsteamworks_sdk.zip
 +
 
 +
Extract the archive/zip file to your home or C: folder, for example if the file is called 'steamworks_sdk_142.zip' then you will have a 'c:\steamworks_sdk_142' folder with a solder called 'sdk' within it.  The sdk folder contains other folders such as glmgr, public, tools, etc.
 +
 
 +
This is necessary for the Steam plugin.
 +
 
 +
------
 +
 
 +
=== 1.12 Install Gideros ===
 +
 
 +
==== 1.12.1 Fetch gideros source code ====
 
(PC) Open MSYS2 32 bit shell
 
(PC) Open MSYS2 32 bit shell
  
(MAC) Open a terminal
+
(MAC/Linux) Open a terminal
  
 
Navigate to the folder where you into to work.
 
Navigate to the folder where you into to work.
  
 +
<syntaxhighlight lang="bash">
 
     git clone https://github.com/gideros/gideros  
 
     git clone https://github.com/gideros/gideros  
+
</syntaxhighlight>
==== 1.4.2 Configure scripts ====
+
 
 +
==== 1.12.2 Configure scripts ====
 
Make a copy of the file gideros/scripts/Makefile.def.example, rename it to Makefile.def and update the file copy according  
 
Make a copy of the file gideros/scripts/Makefile.def.example, rename it to Makefile.def and update the file copy according  
 
to your installation. Ensure that the QT\_ARCH and QT_TOOLSARCH paths are formatted correctly according to your Qt  
 
to your installation. Ensure that the QT\_ARCH and QT_TOOLSARCH paths are formatted correctly according to your Qt  
Line 66: Line 257:
  
 
''''''Example:''''''
 
''''''Example:''''''
 
+
<br/>
 
'''On PC:'''
 
'''On PC:'''
  
For Qt:
+
For Qt:<syntaxhighlight lang="bash>QTBASEDIR=/c/Qt
 
 
<source lang="bash>QTBASEDIR=/c/Qt
 
 
QT_ARCH=mingw53_32
 
QT_ARCH=mingw53_32
 
QT_TOOLSARCH=mingw530_32
 
QT_TOOLSARCH=mingw530_32
 
QTVER=5.9.1
 
QTVER=5.9.1
 
QT5ICUVER=59
 
QT5ICUVER=59
</source>
+
 
 +
STEAMSDK=/c/Applications/steamworks_sdk_142
 +
export STEAMSDK
 +
</syntaxhighlight>
 +
<br/>
 
For Android:
 
For Android:
  
<source lang="bash">
+
<syntaxhighlight lang="bash">
 
# on Windows, also add this to PATH
 
# on Windows, also add this to PATH
 
NDK_HOME=/c/android/android-ndk-r17b
 
NDK_HOME=/c/android/android-ndk-r17b
 
 
NDKBUILD=cmd //c /c/android/android-ndk-r17b/ndk-build.cmd
 
NDKBUILD=cmd //c /c/android/android-ndk-r17b/ndk-build.cmd
 +
#We use windows syntax for this one, as it will be used by gradle.bat script
 +
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
 +
#Windows syntax with quadruple backslashs!
 +
ANDROID_HOME=C:\\\\Users\\\\Gideros\\\\AppData\\\\Local\\\\Android\\\\sdk
  
# remember to escape disallowed characters, or wrap in quotes
+
</syntaxhighlight>
JAVA_HOME=/c/Program\ Files\ \(x86\)/Java/jdk1.8.0_144
+
<br/>
ANT_HOME=/c/apache-ant-1.10.1
 
ANDROID_HOME=C:/SDKs/Android/Sdk
 
</source>
 
 
 
 
For WinRT:
 
For WinRT:
  
<source lang="bash">
+
<syntaxhighlight lang="bash">
 
FXC="/c/Program Files (x86)/Windows Kits/8.1/bin/x86/fxc.exe"  
 
FXC="/c/Program Files (x86)/Windows Kits/8.1/bin/x86/fxc.exe"  
 
MSBUILD="/c/Program Files (x86)/MSBuild/14.0/Bin/MSbuild.exe"  
 
MSBUILD="/c/Program Files (x86)/MSBuild/14.0/Bin/MSbuild.exe"  
</source>
+
</syntaxhighlight>
 +
<br/>
  
 
For html5:
 
For html5:
  
<source lang="bash">
+
<syntaxhighlight lang="bash">
 
EMSDK=/c/emsdkwin
 
EMSDK=/c/emsdkwin
 
EMSDKPATH=$(EMSDK):$(EMSDK)/clang/e1.35.0_64bit:$(EMSDK)/node/4.1.1_64bit/bin:$(EMSDK)/python/2.7.5.3_64bit:$(EMSDK)/emscripten/1.35.0
 
EMSDKPATH=$(EMSDK):$(EMSDK)/clang/e1.35.0_64bit:$(EMSDK)/node/4.1.1_64bit/bin:$(EMSDK)/python/2.7.5.3_64bit:$(EMSDK)/emscripten/1.35.0
 
EMSDK_PREFIX=PATH=$(EMSDKPATH):$$$$PATH cmd //c
 
EMSDK_PREFIX=PATH=$(EMSDKPATH):$$$$PATH cmd //c
 
CRUNCHME=crunchme-win32.exe
 
CRUNCHME=crunchme-win32.exe
</source>
+
</syntaxhighlight>
 
+
<br/>
 
'''On MAC:'''  
 
'''On MAC:'''  
  
<source lang="bash">
+
<syntaxhighlight lang="bash">
 
QTBASEDIR=~/Qt QT_ARCH=clang_64  
 
QTBASEDIR=~/Qt QT_ARCH=clang_64  
 
QT_TOOLSARCH=clang_64  
 
QT_TOOLSARCH=clang_64  
 
QTVER=5.8  
 
QTVER=5.8  
 
QT5ICUVER=54 #deprecated stuff  
 
QT5ICUVER=54 #deprecated stuff  
</source>
+
</syntaxhighlight>
  
------
+
'''On Linux:'''
 +
(tested on Debian 11)
 +
<syntaxhighlight lang="bash">
 +
QT=/usr
 +
QMAKE=qmake6
 +
QTLIBS=/lib/x86_64-linux-gnu
 +
QTPLUGINS=$(QTLIBS)/qt6/plugins
 +
</syntaxhighlight>
 +
 
 +
==== 1.12.3 Complete working example Makefile.def for Windows ====
  
=== 1.5 (PC) Android requirements ===
+
Here is a working example, you will have to change the filename details to match your setup:
  
==== 1.5.1 Install Android Studio and NDK ====
+
[[Example Makefile.def file|example Makefile.def file]].
  
    https://developer.android.com/studio/index.html
+
==== 1.12.4 Fetch additional repositories ====
    https://developer.android.com/ndk/downloads/older_releases.html
 
  
Recommended NDK is 17b (the x86_64 version)
+
Go into just cloned gideros source folder and run make prep.repo
 +
<syntaxhighlight lang="bash">
 +
    cd gideros
 +
    make -f scripts/Makefile.gid prep.repo
 +
</syntaxhighlight>
  
==== 1.5.2 Install Ant ====
+
If you intend to build the studio, you'll need scintilla and Lexilla libraries. Compile them now with:
     https://ant.apache.org/
+
<syntaxhighlight lang="bash">
 +
     make -f scripts/Makefile.gid qlexilla
 +
    make -f scripts/Makefile.gid qscintilla
 +
</syntaxhighlight>
  
 
------
 
------
  
=== 1.6 (PC) Install Visual Studio ===
+
== 2. Building ==
    https://www.visualstudio.com/downloads/
 
  
Install [https://developer.microsoft.com/en-us/windows/downloads/windows-8-1-sdk Win 8.1 SDK]
+
If you have all dependencies in place for all targets, you can build everything at once via MSYS2 or Terminal with:
  
Install [https://marketplace.visualstudio.com/items?itemName=AdMediator.MicrosoftAdvertisingSDKforWindowsandWindowsPhone8x Microsoft Advertising SDK for Windows and Windows Phone 8.x]
+
<pre lang="bash">
 +
make -f scripts/Makefile.gid
 +
</pre>
  
Ensure that you have MSBuild v12 or v14 installed (building with the makefile will fail with an incorrect version).
+
=== 2.1 Compilation on PC :===
  
------
+
Open MSYS2 shell (msys2_shell.cmd). Standard compilation is 32 bit so use a 32 bit shell. Make sure you have installed the necessary build tools in MSYS2 using pacman, as detailed in [[#1.2 (PC) Install MSYS2 Console|Install MSYS2 Console]].
 +
.
  
=== 1.7 (MAC) Install Xcode ===
+
Navigate to gideros folder
    https://itunes.apple.com/fr/app/xcode/id497799835?mt=12
+
 +
==== 2.1.1 Build QT tools : ====
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid qtapp.install
 +
</pre>
  
------
+
-> files GiderosStudio.exe, GiderosPlayer.exe, GiderosTexturePacker.exe (…) in Build.Win folder
  
=== 1.8 Install QScintilla ===
+
==== 2.1.2 Android: ====
    https://www.riverbankcomputing.com/software/qscintilla/download
+
<pre lang="bash">
Double click on the downloaded file and follow instructions.
+
make -f scripts/Makefile.gid android.install
 +
</pre>
  
(PC) Unzip the file into the folder of your choice.  
+
= file GiderosAndroidPlayer.apk in folder Build.Win/Players
  
(MAC) Move the created folder into the Applications subfolder of your home directory.  
+
==== 2.1.3 winRT: ====
  
(MAC) Open a terminal window
+
''If necessary :''
 +
Open the solution, gideros/winRT_example/giderosgame.sln in Visual Studio. Check that the SQLite version for Windows and Windows Phone is up to date. Save and close the solution.
  
(MAC) On the first install:
+
<pre lang="bash">
 +
make -f scripts/Makefile.gid winrt.install  
 +
</pre>
  
<source lang="bash">
+
= file _bundle.appxupload in folder Build.Win/Players/WinRT
sudo xCodebuild –license
 
quit
 
agree
 
</source>
 
  
'''(MAC) WARNING ! if you use QScintilla 2.9.4 and QT 5.7 :'''
+
==== 2.1.4 win32: ====
 +
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid win32.install
 +
</pre>
  
You need to change two files from QScintilla :  
+
= files in folder Build.Win/Templates/win32
 +
 +
==== 2.1.5 Html5: ====
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid html5.install
 +
</pre>
  
QScintilla_gpl-2.9.4/Qt4Qt5/qsciscintilla.cpp
+
-> files in folders Build.Win//Players/Html5 and Build.Win/Templates/Html5
  
QScintilla_gpl-2.9.4/Qt4Qt5/Qsci/qsciscintilla.h
+
==== 2.1.6 Plugins: ====
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid bundle.win
 +
</pre>
  
See https://github.com/opencor/opencor/commit/70f3944e36b8b95b3ad92106aeae2f511b3f0e90
+
= folder bin and file gplugin in folder Build.Win/All Plugins
  
 +
==== 2.1.7 To build everything that can be built on Windows ====
 +
<syntaxhighlight lang="bash">
 +
make -f scripts/Makefile.gid all
 +
</syntaxhighlight>
  
''' With the command line, go to Q4Qt5 subfolder of QScintilla : '''
+
Then you need to copy all the plugins to the 'Build.Win' folder with:
 +
<syntaxhighlight lang="bash">
 +
make -f scripts/Makefile.gid bundle.win
 +
</syntaxhighlight>
  
On PC :
+
=== 2.2 Compilation on Mac :===
 +
Open Terminal. 
  
Open Qt command prompt (called (eg) Qt 5.9.1 for Desktop). This command prompt just sets environment variables, allowing direct running of tools installed with Qt.
+
cd to the folder « gideros »
  
Navigate to QScintilla's Qt4Qt5 subfolder with ‘cd’ command, then type :
+
==== 2.2.1 QT : ====
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid qtapp.install
 +
</pre>
  
<source lang="bash">
+
= GiderosStudio.exe, GiderosPlayer.exe, GiderosTexturePacker.exe (…) in folder Build.Mac
qmake qscintilla.pro
 
mingw32-make
 
mingw32-make install
 
</source>
 
  
On Mac:
+
==== 2.2.2 iOS : ====
Assuming X.x is your QT version, do the following :
+
<pre lang="bash">
 +
make -f scripts/Makefile.gid ios.install
 +
</pre>
  
<source lang="bash">
+
= GiderosiOSPlayer.zip in folder Buid.Mac/Players
~/Qt/X.x/clang_64/bin/qmake qscintilla.pro
 
make
 
make install
 
</source>
 
  
------
+
==== 2.2.3 Plugins: ====
 +
<pre lang="bash">
 +
make -f scripts/Makefile.gid bundle.mac
 +
</pre>
  
=== 1.9 Install emscripten ===
+
= folders bin and files gplugin in folder Buid.Mac/All Plugins
    http://kripken.github.io/emscripten-site/
 
  
You need this is you want to build for HTML5 + Facebook games.
+
------
 
 
Using emsdk, install packages sdk, clang, node, python and emscripten.
 
 
 
<source lang="bash">
 
emsdk install <PACKAGE>
 
emsdk update <PACKAGE>
 
emsdk activate <PACKAGE>
 
</source>
 
  
(PC) Make sure the environment variable EM_CONFIG is set to the location of your emscripten config file.
+
== 3. Cleaning ==
  
(MAC) run ./emsdk_env to set environment variables
+
If you want to reset the build process and start again then you can issue a 'clean' command. To do this type 'make -f scripts/Makefile.gid clean'.
  
------
+
eg:
 
+
<syntaxhighlight lang="bash">
=== 1.10 Install Steam SDK ===
+
make -f scripts/Makefile.gid clean
    https://partner.steamgames.com/?goto=%2Fdownloads%2Fsteamworks_sdk.zip
+
</syntaxhighlight>
  
This is necessary for the Steam plugin. Once you have it installed, create an environment variable called `STEAMSDK` that points to the directory you unzipped the SDK to.
 
  
 +
Sometimes you need to make a clean a particular build.  To do this type 'make -f scripts/Makefile.gid ' followed by something like 'html5' then '.clean'.
  
 +
eg:
 +
<syntaxhighlight lang="bash">
 +
make -f scripts/Makefile.gid html5.clean
 +
</syntaxhighlight>
  
==== Building ====
+
{{GIDEROS IMPORTANT LINKS}}

Latest revision as of 23:56, 18 November 2023

The following instructions are for developers who want to contribute to or otherwise experiment with the Gideros C/C++ engine and are not necessary for either building or deploying apps made with Gideros.

The Gideros project consists of the Gideros Studio IDE, the Gideros SDK libraries, Gideros Texture Packer, Gideros Font Creator, "players" or export templates for all the platforms Gideros supports, all targets of all plugins, a daemon and a bridge. The build system is flexible, so you only need the tools for the targets you are interested in deploying to with Qt (and MSYS2 on Windows) being a realistic minimum.

1. Requirements

1.1 Install QT

https://www.qt.io/download-open-source/

Recommended version 6.3 with MinGW

Double click on the downloaded file and follow instructions. When installing, expand the tree view and ensure you have ticked the MinGW child option of the Qt version checkbox, as well as the MinGW option in the Tools section. Beside main QT package, you'll need the following additional components:

  • WebSocket additional library
  • Multimedia additional library
  • Qt5 Compatibility addon

(MAC) Move the created folder into your user account folder

(LINUX) On Debian 11: echo "deb http://deb.debian.org/debian bullseye-backports main" >>/etc/apt/sources.list apt update apt install qt6-base-dev qt6-websockets-dev qt6-multimedia-dev qt6-5compat-dev

Depending on your distribution, you may need to install qt5 websocket lib seperately (sudo apt-get install libqt5websockets5-dev)


1.2 (PC) Install MSYS2 Console

   https://msys2.github.io/ 

Double click on the downloaded file (msys2-i686) and follow instructions.

Open 32 bit MSYS2 shell: msys2_shell.cmd

pacman -Sy pacman
pacman -Syu
pacman -Su
pacman -S tar
pacman -S zip
pacman -S unzip
pacman -S git
pacman -S base-devel
pacman -S python
#For compiling win32/32bit under a MinGW64
pacman -S mingw-w64-i686-toolchain
pacman -S mingw-w64-i686-glew
pacman -S mingw-w64-i686-curl
pacman -S mingw-w64-i686-libpng
#For compiling win32/64bit under a MinGW64
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-glew
pacman -S mingw-w64-x86_64-curl
pacman -S mingw-w64-x86_64-libpng

1.3 (Mac) Install Git & xcpretty

   http://git-scm.com/downloads
   

Ctrl + right click, open with « Install program.app » Follow instructions keeping default values as they are.

(MAC) open a terminal window

git config -global user.name "your git login" 
git config -global user.email "your git email"
sudo gem install xcpretty

1.3.1 (Linux/Debian) Install Git, build-tools

apt install git build-essential libxcb-xinerama0 libgl1-mesa-dev libz-dev libasound2-dev libglew-dev libglfw3-dev libcurl4-openssl-dev patchelf zip
git config --global user.email "your git email"

1.4 (PC) Android requirements

1.4.1 Install Android Studio and NDK

   https://developer.android.com/studio/index.html
   https://developer.android.com/ndk/downloads/older_releases.html

Recommended NDK is 25c (the x86_64 version)

Once downloaded, copy the contents of the NDK to your home or C: folder, rename the folder that you copied to 'android-ndk', for example you will end up with 'c:\android-ndk' and below that folders that say build, meta, platforms, etc.

1.4.2 Install Ant (no longer required but kept util someone confirms this)

   https://ant.apache.org/

Once downloaded, copy the contents of the install archive/zip file to your home folder or C: drive. Eg: so you have a folder called c:\apache-ant-1.10.5 with bin, etc, lib, manual folders within that.

1.4.3 Mix Old and New Tools (no longer required but kept util someone confirms this)

Gideros uses Ant to build the player, unfortunately the tools to support Ant are now missing from the latest Android tools.


There is a fix for this:

  1. Rename the existing 'tools' folder in the Android SDK folder to 'tools_new'.
  2. Download an older (March 2016) version of the tools and copy that folder to the Android SDK folder.
  3. Copy the contents of 'tools_new' over the contents of 'tools'.

Here is where you can download the compatible set of tools from:

(PC) https://dl.google.com/android/repository/tools_r25.2.5-windows.zip

(MAC) https://dl.google.com/android/repository/tools_r25.2.5-macosx.zip

(LINUX) https://dl.google.com/android/repository/tools_r25.2.5-linux.zip


1.5 Install Java

You need the Java JDK https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html


1.6 (PC) Install Visual Studio

   https://www.visualstudio.com/downloads/

Install Win 8.1 SDK

Install Microsoft Advertising SDK for Windows and Windows Phone 8.x

Ensure that you have MSBuild v12 or v14 installed (building with the makefile will fail with an incorrect version).


1.7 (MAC) Install Xcode

   https://itunes.apple.com/fr/app/xcode/id497799835?mt=12

1.8 (Mac) ensure xcode command line tools are working

(MAC) Open a terminal window

sudo xCodebuild -license 
quit
agree



1.9 Install Python

https://www.python.org/downloads/release/python-2712/

You need Python 2.7.12 or later to install emscripten properly.

Once installed, add it to your command line path, eg: c:\python27, on windows you can do this by right-clicking on 'myComputer' or 'This PC', go to 'Properties', click 'Advanced System Settings', Click 'Environmental Variables', double-click 'Path', add 'c:\python27'.


1.10 Install emscripten

   http://kripken.github.io/emscripten-site/

You need this is you want to build for HTML5 + Facebook games.

Using a shell or MSYS2 (previously installed) on windows, go to your home or C: folder and type:

git clone https://github.com/juj/emsdk.git

Once that has completed open a command prompt in that folder on Windows, on other system just cd to the folder.

Using emsdk, install and activate all the latest packages:

#(on non-PC put ./ before emsdk)
emsdk install latest
emsdk activate latest

(PC) Type:

emsdk_env.bat

(MAC) Type:

source ./emsdk_env.sh

To use incoming branch of emscripten, use these commands instead:

#(on non-PC put ./ before emsdk)
emsdk install sdk-incoming-64bit
emsdk activate sdk-incoming-64bit

To further use Gideros own git fork of emscripten:

cd emscripten/incoming
# Add a git remote link to your own repository.
git remote add gideros https://github.com/gideros/emscripten.git
# Obtain the changes in your link.
git fetch gideros
# Switch the emscripten-incoming tool to use your fork.
git checkout -b gideros_incoming --track gideros/incoming
#Get back to emscripten directory and rebuild
cd ../..
emsdk install sdk-incoming-64bit


These can also be installed within emsdk: git, crunch, and spidermonkey

(on non-PC put ./ before emsdk)
emsdk install git-1.9.4
emsdk install crunch-1.03
emsdk install spidermonkey-37.0.1-64bit
emsdk activate git-1.9.4
emsdk activate crunch-1.03
emsdk activate spidermonkey-37.0.1-64bit
(PC) emsdk_env.bat
(MAC) source ./emsdk_env.sh

(PC) Make sure the environment variable EM_CONFIG is set to the location of your emscripten config file.

The emscripten build also needs the CMake command. You can download it and extract it to your home or C: folder. Don't forget to add it's path to the end of the EMSDKPATH in Makefile.def.

https://cmake.org/download/


1.11 Install Steam SDK

   https://partner.steamgames.com/?goto=%2Fdownloads%2Fsteamworks_sdk.zip

Extract the archive/zip file to your home or C: folder, for example if the file is called 'steamworks_sdk_142.zip' then you will have a 'c:\steamworks_sdk_142' folder with a solder called 'sdk' within it. The sdk folder contains other folders such as glmgr, public, tools, etc.

This is necessary for the Steam plugin.


1.12 Install Gideros

1.12.1 Fetch gideros source code

(PC) Open MSYS2 32 bit shell

(MAC/Linux) Open a terminal

Navigate to the folder where you into to work.

    git clone https://github.com/gideros/gideros

1.12.2 Configure scripts

Make a copy of the file gideros/scripts/Makefile.def.example, rename it to Makefile.def and update the file copy according to your installation. Ensure that the QT\_ARCH and QT_TOOLSARCH paths are formatted correctly according to your Qt install directory structure (see below that they are named differently by Qt).

'Example:'
On PC:

For Qt:

QTBASEDIR=/c/Qt
QT_ARCH=mingw53_32
QT_TOOLSARCH=mingw530_32
QTVER=5.9.1
QT5ICUVER=59

STEAMSDK=/c/Applications/steamworks_sdk_142
export STEAMSDK


For Android:

# on Windows, also add this to PATH
NDK_HOME=/c/android/android-ndk-r17b
NDKBUILD=cmd //c /c/android/android-ndk-r17b/ndk-build.cmd
#We use windows syntax for this one, as it will be used by gradle.bat script
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
#Windows syntax with quadruple backslashs!
ANDROID_HOME=C:\\\\Users\\\\Gideros\\\\AppData\\\\Local\\\\Android\\\\sdk


For WinRT:

FXC="/c/Program Files (x86)/Windows Kits/8.1/bin/x86/fxc.exe" 
MSBUILD="/c/Program Files (x86)/MSBuild/14.0/Bin/MSbuild.exe"


For html5:

EMSDK=/c/emsdkwin
EMSDKPATH=$(EMSDK):$(EMSDK)/clang/e1.35.0_64bit:$(EMSDK)/node/4.1.1_64bit/bin:$(EMSDK)/python/2.7.5.3_64bit:$(EMSDK)/emscripten/1.35.0
EMSDK_PREFIX=PATH=$(EMSDKPATH):$$$$PATH cmd //c
CRUNCHME=crunchme-win32.exe


On MAC:

QTBASEDIR=~/Qt QT_ARCH=clang_64 
QT_TOOLSARCH=clang_64 
QTVER=5.8 
QT5ICUVER=54 #deprecated stuff

On Linux: (tested on Debian 11)

QT=/usr
QMAKE=qmake6
QTLIBS=/lib/x86_64-linux-gnu
QTPLUGINS=$(QTLIBS)/qt6/plugins

1.12.3 Complete working example Makefile.def for Windows

Here is a working example, you will have to change the filename details to match your setup:

example Makefile.def file.

1.12.4 Fetch additional repositories

Go into just cloned gideros source folder and run make prep.repo

    cd gideros
    make -f scripts/Makefile.gid prep.repo

If you intend to build the studio, you'll need scintilla and Lexilla libraries. Compile them now with:

    make -f scripts/Makefile.gid qlexilla
    make -f scripts/Makefile.gid qscintilla

2. Building

If you have all dependencies in place for all targets, you can build everything at once via MSYS2 or Terminal with:

make -f scripts/Makefile.gid

2.1 Compilation on PC :

Open MSYS2 shell (msys2_shell.cmd). Standard compilation is 32 bit so use a 32 bit shell. Make sure you have installed the necessary build tools in MSYS2 using pacman, as detailed in Install MSYS2 Console. .

Navigate to gideros folder

2.1.1 Build QT tools :

make -f scripts/Makefile.gid qtapp.install

-> files GiderosStudio.exe, GiderosPlayer.exe, GiderosTexturePacker.exe (…) in Build.Win folder

2.1.2 Android:

make -f scripts/Makefile.gid android.install 

= file GiderosAndroidPlayer.apk in folder Build.Win/Players

2.1.3 winRT:

If necessary : Open the solution, gideros/winRT_example/giderosgame.sln in Visual Studio. Check that the SQLite version for Windows and Windows Phone is up to date. Save and close the solution.

make -f scripts/Makefile.gid winrt.install 

= file _bundle.appxupload in folder Build.Win/Players/WinRT

2.1.4 win32:

make -f scripts/Makefile.gid win32.install 

= files in folder Build.Win/Templates/win32

2.1.5 Html5:

make -f scripts/Makefile.gid html5.install

-> files in folders Build.Win//Players/Html5 and Build.Win/Templates/Html5

2.1.6 Plugins:

make -f scripts/Makefile.gid bundle.win 

= folder bin and file gplugin in folder Build.Win/All Plugins

2.1.7 To build everything that can be built on Windows

make -f scripts/Makefile.gid all

Then you need to copy all the plugins to the 'Build.Win' folder with:

make -f scripts/Makefile.gid bundle.win

2.2 Compilation on Mac :

Open Terminal.

cd to the folder « gideros »

2.2.1 QT :

make -f scripts/Makefile.gid qtapp.install 

= GiderosStudio.exe, GiderosPlayer.exe, GiderosTexturePacker.exe (…) in folder Build.Mac

2.2.2 iOS :

make -f scripts/Makefile.gid ios.install 

= GiderosiOSPlayer.zip in folder Buid.Mac/Players

2.2.3 Plugins:

make -f scripts/Makefile.gid bundle.mac 

= folders bin and files gplugin in folder Buid.Mac/All Plugins


3. Cleaning

If you want to reset the build process and start again then you can issue a 'clean' command. To do this type 'make -f scripts/Makefile.gid clean'.

eg:

make -f scripts/Makefile.gid clean


Sometimes you need to make a clean a particular build. To do this type 'make -f scripts/Makefile.gid ' followed by something like 'html5' then '.clean'.

eg:

make -f scripts/Makefile.gid html5.clean