SDL中文论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 8540|回复: 4
打印 上一主题 下一主题

[Discuss] How to Use SDK and Compile

[复制链接]

187

主题

346

帖子

2450

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2450
跳转到指定楼层
楼主
发表于 2016-7-5 21:06:20 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 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)
回复

使用道具 举报

187

主题

346

帖子

2450

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2450
沙发
 楼主| 发表于 2016-7-5 21:06:59 | 只看该作者

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.


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.



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

Upgrade SDK
  • Download lastest Rose and generate Studio. Run Studio.
  • Right mouse click on the left side of the top node of the work kit. Press "Import app ...".
  • Select old Rose's resource path.
回复 支持 反对

使用道具 举报

187

主题

346

帖子

2450

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2450
板凳
 楼主| 发表于 2016-7-5 21:07:35 | 只看该作者

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.

  • sdl2.dll: Open and compile <SDL>/SDL2-2.0.7/VisualC/SDL.sln.
  • sdl2_image.dll: Open and compile <SDL>/SDL2_image-2.0.1/VisualC/SDL_image.sln.
  • sdl2_mixer.dll: Open and compile <SDL>/SDL2_mixer-2.0.1/Visual/SDL_mixer.sln.
  • sdl2_ttf.dll: Open and compile <SDL>/SDL2_ttf-2.0.14/VisualC/SDL_ttf.sln.


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.

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"
回复 支持 反对

使用道具 举报

187

主题

346

帖子

2450

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2450
地板
 楼主| 发表于 2016-7-5 21:08:03 | 只看该作者

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...".

  • blesmart, kingdom, sesame, sleep, studio: Private directory of the the 5 developing app. Below "2. studio.app" show its detail contents.
  • external: same as "external" on Windows.
  • librose: same as "librose" on Windows.
  • SDL: same as "SDL" on Windows.
  • linker: same as "linker" on Windows.
  • scripts: same as "scripts" on Windows.


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.

  • libSDL.a: Open and compile <SDL>/SDL2-2.0.4/Xcode-iOS/SDL/SDLiPhoneOS.xcodeproj.
  • libogg.a: open and compile <SDL>/libogg-1.3.0/Xcode-iPhoneOS/Ogg.xcodeproj. Copy libogg.a to <SDL>/SDL2_mixer-2.0.1/Xcode-iOS/lib/-iphoneos(-iphonesimulator, if simulator) manually.
  • libvorbis.a, libvorbisfile.a: Open and compile <SDL>/libvorbis-1.3.2/Xcode-iPhoneOS/Vorbis.xcodeproj. Copy libvorbis.a and libvorbisfile.a to <SDL>/SDL2_mixer-2.0.1/Xcode-iOS/lib/-iphoneos(-iphonesimulator, if simulator) manually.
  • libSDL_mixer.a: Open and compile <SDL>/SDL2_mixer-2.0.1/Xcode-iOS/SDL_mixer.xcodeproj
  • libSDL_image.a: Open and compile <SDL>/SDL2_image-2.0.1/Xcode-iOS/SDL_image.xcodeproj.
  • libSDL_ttf.a: Open and compile <SDL>/SDL2_ttf-2.0.14/Xcode-iOS/SDL_ttf.xcodeproj.


2. studio.app

  • studio: Private source code of Studio app. Same as "<apps-src>/apps/studio" on Widnows.
  • projectfiles: Project files, compile output files.
  • app-studio, data, fonts, translations, xwml: Resource packet of Studio app. Same as Windows.


How to Compile
  • Except libogg.a, libvorbis.a, libvorbisfile.a, copy all *.so when compile SDL to <linker>/ios/lib.
  • Open <studio>/projectfiles/Xcode-iOS/studio.xcodeproj.
  • If studio.xcodeproj is just automatically generated by Studio Rose, "src" group is empty. You need to add the app's private source file to the group. Detail steps: 1) Right click on the "src" group, select "Add Files to studio..." on the pop-up menu. 2)On the pop-up window, view "Option", make sure to select "Create groups", add then.  
  • compile.


Run
By this time, there is studio.app. Make it to ipa.
回复 支持 反对

使用道具 举报

187

主题

346

帖子

2450

积分

版主

Rank: 7Rank: 7Rank: 7

积分
2450
5#
 楼主| 发表于 2016-7-5 21:08:37 | 只看该作者

Android Studio 3.0.1 + NDK-r16b(Android)

本帖最后由 ancientcc 于 2018-3-27 09:15 编辑

  • You need not install cygwin. It use window's "cmd" utility.
  • Please use the built-in entry in Android Studio to install the NDK: “File”-“Project Structure…”-“SDK Location”.
  • To now, I can not custom resource directory desired to package into the APK, which means that in order to be packaged into APK, you must put resource in directory named <app>/src/main/assets/res(res is Rose requirement). And they are copier of "<app>-res", for reducing size, they will not be uploaded to GitHub. Please make sure that the assets/res is copied. "Po" directory can be ignored when copying. For simplicity, you can use the menu command: "Copy resource to android's apk...".
    Below is one shapshot of assets/res.



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
  • Copy *.so to <projectfiles>/android/app/libs/armeabi.
    1. cd %SCRIPTS%
    2. android_2_app.bat %studio%
    复制代码

  • Run Android Studio
  • Enter "Welcome to Android Studio", select "Open an existing Android Studio project".
  • "Open File or Project"--locate to <projectfiles>/android. Open.
  • Connect Android device, "Run"--"Run 'app'", will generat sutdio.apk in <projectfiles>/android/app/build/outputs/apk, and can debug it.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|丽谷软件|libsdl.cn

GMT+8, 2024-5-20 05:38 , Processed in 0.039880 second(s), 21 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表