Sidenote About Using Static Lib
2 posters
Sidenote About Using Static Lib
A little while back there was a post (http://forum.sio2interactive.com/about-the-sdk-f1/guide-using-sio2-sdk-without-the-template-project-t274.htm) on setting up SIO2 as a static lib for faster compile times and easier source code management. It is ok if you don't plan on modifying/tweaking the actual sio2 engine. There was a comment mentioning that you can setup a static lib with all the sources files EXCEPT sio2, which works amazingly well. The steps below are for reference for anyone who wants to do things this way. It sill leaves the whole sio2 source tree in your project, so you can modify it. I have no intention of modifying the lua, bullet, libpng, etc. sources so this saves a bunch of time on clean and builds. All credit goes to lyxite for posting his guide. I just modified the steps a tiny bit.
1. Create a Cocoa Static Library project in Xcode. Xcode -> File -> New Project -> Static Library -> Cocoa Static Library, named sio2.
2. Download sio2 sdk, extract it. In the SDK folder locate 'src' folder.
3. In Finder, copy that src into the project folder 'sio2'. DO NOT COPY THE sio2 DIRECTORY!!!
4. In Xcode, add the 'src' folder to the newly created project. To do so:
1. Ctrl click on the project root, Add -> Existing Files -> Select the 'src' folder (note that this is the one in the sio2 folder)
2. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
5. If you try to compile now, you get a few thousand errors, there are a few things you need to do in order make it compile
1. In Xcode, delete a file named 'sio2_wrap.c' from the 'lua' group. Since I don't know whether this file is going to be useful in the future or not, just choose 'Delete References' when Xcode asks.
6. Now build. You get no error but a tiny warning. I assume that is not critical.
7. Change the configurations, make sure you build for all the following 4 combinations. (if you are targeting 2.1, change version number from 2.0 to 2.1 accordingly).
1. Device - 2.2.1 | Debug
2. Device - 2.2.1 | Release
3. Simulator - 2.2.1 | Debug
4. Simulator - 2.2.1 | Release
8. In Xcode, open your own game project
9. Ctrl click on game project root, Add -> Existing Files, choose the sio2.xcodeproj we've just created. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
10. Once added, you will see a file name 'libsio2.a' under sio2.xcodeproj. Drag that file to Targets -> game_name -> Link Binary With Binaries.
1. Remember we have built 4 version of the static library?
2. Xcode is smart enough to know which one to link to, when you change the configuration in your own game project.
11. Ctrl click on the project root, Add -> Existing Files -> Select the 'sio2' folder that you did not include in step 3 above
12. Now, select the sio2 group, you will see a bunch of files named like 'sio2_xxxxx.h' or 'sio2_xxxxx.cc'. You need to select all of them (except README.txt) in the top-right view, hit the Get Info icon in the tool bar. In the General tab, change the file type to 'sourcecode.cpp.objcpp'.
That should get your rolling with a fast compiling project file. Many thanks to lyxite for his post.
1. Create a Cocoa Static Library project in Xcode. Xcode -> File -> New Project -> Static Library -> Cocoa Static Library, named sio2.
2. Download sio2 sdk, extract it. In the SDK folder locate 'src' folder.
3. In Finder, copy that src into the project folder 'sio2'. DO NOT COPY THE sio2 DIRECTORY!!!
4. In Xcode, add the 'src' folder to the newly created project. To do so:
1. Ctrl click on the project root, Add -> Existing Files -> Select the 'src' folder (note that this is the one in the sio2 folder)
2. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
5. If you try to compile now, you get a few thousand errors, there are a few things you need to do in order make it compile
1. In Xcode, delete a file named 'sio2_wrap.c' from the 'lua' group. Since I don't know whether this file is going to be useful in the future or not, just choose 'Delete References' when Xcode asks.
6. Now build. You get no error but a tiny warning. I assume that is not critical.
7. Change the configurations, make sure you build for all the following 4 combinations. (if you are targeting 2.1, change version number from 2.0 to 2.1 accordingly).
1. Device - 2.2.1 | Debug
2. Device - 2.2.1 | Release
3. Simulator - 2.2.1 | Debug
4. Simulator - 2.2.1 | Release
8. In Xcode, open your own game project
9. Ctrl click on game project root, Add -> Existing Files, choose the sio2.xcodeproj we've just created. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
10. Once added, you will see a file name 'libsio2.a' under sio2.xcodeproj. Drag that file to Targets -> game_name -> Link Binary With Binaries.
1. Remember we have built 4 version of the static library?
2. Xcode is smart enough to know which one to link to, when you change the configuration in your own game project.
11. Ctrl click on the project root, Add -> Existing Files -> Select the 'sio2' folder that you did not include in step 3 above
12. Now, select the sio2 group, you will see a bunch of files named like 'sio2_xxxxx.h' or 'sio2_xxxxx.cc'. You need to select all of them (except README.txt) in the top-right view, hit the Get Info icon in the tool bar. In the General tab, change the file type to 'sourcecode.cpp.objcpp'.
That should get your rolling with a fast compiling project file. Many thanks to lyxite for his post.
uprise78- Posts : 228
Join date : 2008-10-31
Re: Sidenote About Using Static Lib
how about someone just compiles the lib and make it available ... -.-
i am fairly into programming, but mostly it has been C++ on Windows before i switched, so Xcode is quite new to me still. Even me, a intermediate programmer is failing to do this correctly apparently. So, it would save a few, if not a lot, of people a lot of grief if it was either just included in the SDK or made available for download. I'm still struggling with it
i am fairly into programming, but mostly it has been C++ on Windows before i switched, so Xcode is quite new to me still. Even me, a intermediate programmer is failing to do this correctly apparently. So, it would save a few, if not a lot, of people a lot of grief if it was either just included in the SDK or made available for download. I'm still struggling with it
Nocturnal- Posts : 7
Join date : 2009-04-14
Re: Sidenote About Using Static Lib
uprise78 wrote:
11. Ctrl click on the project root, Add -> Existing Files -> Select the 'sio2' folder that you did not include in step 3 above
12. Now, select the sio2 group, you will see a bunch of files named like 'sio2_xxxxx.h' or 'sio2_xxxxx.cc'. You need to select all of them (except README.txt) in the top-right view, hit the Get Info icon in the tool bar. In the General tab, change the file type to 'sourcecode.cpp.objcpp'.
Somewhere in these two steps things go wrong. I've tried this numerous times now ..... please will someone *clarify* what the heck is going on? are you assuming an existing SIO2 project, or do you assume a new Cocoa Touch app project, either way it does NOT work and no one has explained this and it's bugging me, because i cannot get to do anything before i have done this. I'm sorry if i am being aggressive in my message, i don't mean to, but i am throwing things around my apartment because this is so irritating and i can't understand why the developer behind it all doesn't make this available, it only makes sense!
Nocturnal- Posts : 7
Join date : 2009-04-14
Re: Sidenote About Using Static Lib
The static lib is nothing all that fancy nor is it required in any way shape or form to create an SIO2 game. If you insist on creating the static lib, here is a link to the static lib project: [url=http://www.4shared.com/file/104738699/4538d98/SIO2StaticLib.html ]http://www.4shared.com/file/104738699/4538d98/SIO2StaticLib.html [/url]. Follow the very brief instructions below to get it working with any of the tutorials. From there, you should be able to add it to a copy of the SIO2 template without much fuss. If you cant, you should read and reread the Xcode docs or just move on and use the SIO2 library as is coming back to creating a static library when you are more familiar with Xcode.
- Download and unzip the SIO2StaticLib zip and add it to your SIO2 SDK directory.
- Open any SIO2 project (pick a tutorial from the SDK)
- Select the png, bullet, jpeg, lua, theora, vorbis and zlib folders as shown here: and delete them (only delete references!)
- Ctrl click on game project root, Add -> Existing Files, choose the sio2.xcodeproj we've just created. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
- Once added, you will see a file name 'libsio2.a' under sio2.xcodeproj. Drag that file to Targets -> game_name -> Link Binary With Binaries.
- Download and unzip the SIO2StaticLib zip and add it to your SIO2 SDK directory.
- Open any SIO2 project (pick a tutorial from the SDK)
- Select the png, bullet, jpeg, lua, theora, vorbis and zlib folders as shown here: and delete them (only delete references!)
- Ctrl click on game project root, Add -> Existing Files, choose the sio2.xcodeproj we've just created. In the confirmation dialog, make sure 'copy items to destination folder' is UNCHECKED
- Once added, you will see a file name 'libsio2.a' under sio2.xcodeproj. Drag that file to Targets -> game_name -> Link Binary With Binaries.
uprise78- Posts : 228
Join date : 2008-10-31
Similar topics
» Static Objects
» Static frame rate
» Rigid object sometimes falling through a static floor.
» Reposition a static physics object
» Clang static code analyzer (memory debug tool based on llvm)
» Static frame rate
» Rigid object sometimes falling through a static floor.
» Reposition a static physics object
» Clang static code analyzer (memory debug tool based on llvm)
Permissions in this forum:
You cannot reply to topics in this forum