SDL中文论坛

标题: How to Use SDK and Compile [打印本页]

作者: ancientcc    时间: 2016-7-5 21:06
标题: How to Use SDK and Compile
本帖最后由 ancientcc 于 2018-4-7 14:45 编辑

#2: Basic Development Process, Upgrade SDK
#3: Visual Studio 2017(Windows)
#4: Xcode 9.3.(iOS)
#5: Android Studio 3.0.1 + NDK-r16b(Android)
作者: ancientcc    时间: 2016-7-5 21:06
标题: Basic Development Process
本帖最后由 ancientcc 于 2017-5-28 22:40 编辑

Step 1: Download Rose and SDL

Note the location of Rose and SDL when place, same as below.
(, 下载次数: 2455)

Step 2: Compile and Run Studio
After downloading Rose, there is a app named Studio. Please compile Studio. How to compile see the 3th floor(Windows), 4th floor(iOS) and 5th floor(Android).

Step 3: New app to Work Kit
Download Rose will generate apps-res, apps-src locally, they are collectively known as work kit. Next, new app on Windows, detail operation: 1)Run Rose Studio. 2)Right mouse click on the left side of the top node of the work kit. 3)Press "New app ..." on pop-up menu. Below assume your created app is "hello".

Step 4: Develop other platform's version: Android, iOS
Run Studio, export "hello" package, it will genenate "hello-res", "hello-src" on directory same level as the work kit.

(, 下载次数: 2687)

Reference the #4th floor, compile hello.app on iOS.
Reference the #5th floor, compile hello.apk on Android.

Upgrade SDK

作者: ancientcc    时间: 2016-7-5 21:07
标题: Visual Studio 2017(Windows)
本帖最后由 ancientcc 于 2018-3-27 08:52 编辑

Compile
In order to compile, requires Visual Studio 2017 or later.
In "Configuration Manager", "Active solution configuration" select Release, "Active solution platform" select Win32. Although it is release, you can still use breakpoints to debug.

1. SDL
After downloading Rose, necessary SDL development library has placed on the <linker>/windows. If you don't want to recompile them, can skip this part, and go to "2. studio.exe" directly.



2. studio.exe
chromium.lib: open and compile <SDL>/chromium/projectfiles/vc/chromium.sln. In "Configuration Manager", "Active solution configuration" select Release, "Active solution platform" select Win32.
studio.exe: open and compile <apps-src>/apps/projectfiles/VC/studio.sln.

Run
1. Copy necessary dll
By this time, if successful, there are SDL2.dll, SDL2_ttf.dll, SDL2_mixer.dll, SDL2_net.dll, SDL2_image.dll, studio.exe in <apps-src>/apps/projectfiles/vc/Release. In order to run, you should copy other necessary dll to, necessary dll include libfreetype-6.dll, libjpeg-9.dll, libogg-0.dll, libpng16-16.dll, libtiff-5.dll, libvorbis-0.dll, libvorbisfile-3.dll, libwebp-4.dll, mikmod.dll, smpeg.dll zlib1.dll. You can copy them from resource packet.

2. Connect Resource Packet
In order to run by Vistual Studio Command, need set Command Arguments. Below is relative setting.
(, 下载次数: 2468)
It indicats Resource Pakcet is located in apps-res that is same parent as apps-src.

3. Run
"Debug"--"Start Debuging" or "Start Without Debuging"

作者: ancientcc    时间: 2016-7-5 21:08
标题: XCode 9.3(iOS)
本帖最后由 ancientcc 于 2018-4-7 14:44 编辑

Directory structure on iOS is different from Windows and Android, below is one shapshot. First, you require to create this directory structure on Mac OS X. For simplicity, you can use the menu command: "Tools"---"Create iOS work kit...".
(, 下载次数: 2650)


Compile
1. SDL
After downloading Rose, necessary SDL development library has placed on the <linker>/ios. If you don't want to recompile them, can skip this part, and go to "2. studio.app" directly.



2. studio.app
(, 下载次数: 2681)


How to Compile


Run
By this time, there is studio.app. Make it to ipa.
作者: ancientcc    时间: 2016-7-5 21:08
标题: Android Studio 3.0.1 + NDK-r16b(Android)
本帖最后由 ancientcc 于 2018-3-27 09:15 编辑



Open <apps-src>/scripts/android_set_variable.bat, update path of NDK variable according to you PC. This sample assume you place downloaded Rose at c:/apps-res and c:/apps-src.

  1. set NDK=c:\Users\ancientli\AppData\Local\Android\sdk\ndk-bundle

  2. set _APP_SRC=c:\apps-src
  3. set SCRITPS=C:\apps-src\scripts
  4. set SDL_sdl=c:\apps-src\SDL\SDL2-2.0.5\android
  5. set SDL_image=c:\apps-src\SDL\SDL2_image-2.0.1\android
  6. set SDL_mixer=c:\apps-src\SDL\SDL2_mixer-2.0.1\android
  7. set SDL_ttf=c:\apps-src\SDL\SDL2_ttf-2.0.14\android
  8. set studio=c:\apps-src\apps\projectfiles\android
复制代码

Execute "cmd" utility, run this bat.
  1. cd c:\apps-src\apps\scripts
  2. android_set_variable.bat
复制代码

1. Compile
1. SDL
After downloading Rose, necessary SDL development library has placed on the <linker>/android. If you don't want to recompile them, can skip this part, and go to "2. libmain.so" directly.

libSDL2.so
  1. cd %SDL_sdl%
  2. %NDK%/ndk-build
复制代码

Copy *.so to ndk lib diectory.
  1. cd %SCRIPTS%
  2. android_2_ndk.bat
复制代码
Remark: there is maybe error when copy libgettext.so, libSDL2_image.so, libSDL2_mixer.so, libSDL2_net.so, libSDL2_ttf.so, ignore them.

libSDL2_image.so
  1. cd %SDL_image%
  2. %NDK%/ndk-build
复制代码
libSDL2_mixer.so
  1. cd %SDL_mixer%
  2. %NDK%/ndk-build
复制代码

libSDL2_ttf.so
  1. cd %SDL_ttf%
  2. %NDK%/ndk-build
复制代码


2. libmain.so
Copy *.so to ndk lib diectory.
  1. cd %SCRIPTS%
  2. android_2_ndk.bat
复制代码
Remark: Should no error.

libmain.so
  1. cd %studio%
  2. %NDK%/ndk-build
复制代码


2. Generate and run studio.apk





欢迎光临 SDL中文论坛 (http://www.libsdl.cn/bbs/) Powered by Discuz! X3.3