This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:tutorials:projects:using-premake-for-your-own-project [2020/08/31 08:32 (5 years ago)] – ↷ Links adapted because of a move operation 207.46.13.226 | en:tutorials:projects:using-premake-for-your-own-project [2023/05/18 16:36 (23 months ago)] (current) – Page has been retired. Please use the 'init' tool to create a project. sausage | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== How to use premake to create a build configuration for your own project ===== | ||
- | |||
- | <WRAP center round box 60%> | ||
- | Orx now provides a tool to do this for you. If you want a hassle free way of spinning up your own Orx-based projects, see the article: [[en: | ||
- | |||
- | If you wish to do this manually yourself, continue with the article below. | ||
- | </ | ||
- | |||
- | |||
- | This article will help you to create a project using the premake command supplied with Orx. These instructions largely replace the more manual IDE setup instructions by Grey: | ||
- | |||
- | {{section> | ||
- | |||
- | |||
- | ==== Download the latest Orx from Github ==== | ||
- | See here for instructions on [[en: | ||
- | |||
- | |||
- | ==== Build the Orx project from Github ==== | ||
- | |||
- | You downloaded Orx, but now you need to build it. And your project needs to use compiled files from that Orx build. These steps are covered in [[en: | ||
- | |||
- | |||
- | ==== Gather parts for your project ==== | ||
- | |||
- | Ensure you have the following suggested folder structure: | ||
- | |||
- | * **myproject** | ||
- | * **bin** (an empty bin folder) | ||
- | * **windows** (windows folder for windows exe(s) and dll(s). copy the *.dll files from orx/ | ||
- | * **build** (empty build folder - //**copy the premake4.lua file from the orx/ | ||
- | * **include** (copy the contents of orx/ | ||
- | * **lib** (an empty lib folder) | ||
- | * **windows** (copy the *.a files from orx/ | ||
- | * **src** (your source files) | ||
- | |||
- | |||
- | In the windows folders above, if you are using linux, name your folders linux. Or have both if you are doing multiplatform. | ||
- | |||
- | Make sure this folder structure is sitting next to the downloaded orx folder. If it is not, then copy paste your myproject there now, so that orx and myproject are on the same level, ie: | ||
- | / | ||
- | /orx/ | ||
- | |||
- | This will be required when the script is run. Parts of orx will be accessed to build out your project(s). Once your project is built, you won't need orx there anymore if you don't want it. | ||
- | |||
- | |||
- | |||
- | |||
- | ==== Editing the premake4.lua file in order to make a build project ==== | ||
- | |||
- | |||
- | * Edit the premake4.lua file. | ||
- | * Scroll to the line: "-- Project: 02_Clock" | ||
- | * Select from that line and remove all lines from here down to the very bottom, leaving just a single project (Project: 01). | ||
- | * Rename '-- Solution: orx' to '-- Solution: MySolution' | ||
- | * Rename ' | ||
- | * Change ' | ||
- | * Change the includedirs to just reflect your one includes folder: | ||
- | |||
- | < | ||
- | includedirs | ||
- | { | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | * Change the libdirs to just reflect your one lib folder: | ||
- | |||
- | < | ||
- | libdirs | ||
- | { | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | |||
- | * Down into the project area, Rename '-- Project: 01_Object' | ||
- | * Change ' | ||
- | * Change 'files {" | ||
- | |||
- | |||
- | |||
- | |||
- | < | ||
- | files { | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | } | ||
- | |||
- | or | ||
- | |||
- | files { | ||
- | " | ||
- | " | ||
- | } | ||
- | </ | ||
- | |||
- | * Under files, add a target name for your executable: | ||
- | |||
- | < | ||
- | | ||
- | </ | ||
- | |||
- | |||
- | |||
- | ==== Generating the build project ==== | ||
- | |||
- | * cd to your build folder (eg myproject/ | ||
- | * Call the premake4.exe from within your build folder with: | ||
- | |||
- | |||
- | < | ||
- | ..\..\orx\extern\premake\bin\windows\premake4.exe --os=windows codelite | ||
- | |||
- | or just: | ||
- | |||
- | ..\..\orx\extern\premake\bin\windows\premake4.exe codelite | ||
- | </ | ||
- | |||
- | // | ||
- | |||
- | |||
- | * Your myproject\build\windows folder will contain a codelite folder containing your new project' | ||
- | |||
- | If you wanted to build for linux (from within windows) you could do a: | ||
- | |||
- | < | ||
- | ..\..\orx\extern\premake\bin\windows\premake4.exe --os=linux codelite | ||
- | </ | ||
- | |||
- | |||
- | * Open codelite and load your newly created workspace from your myproject\build\windows\codelite folder. | ||
- | * Add your data folder with your game assets, create your configuration files, etc. | ||
- | * Build your project and play your game! | ||
- | |||
- | |||
- | ==== Notes ==== | ||
- | |||
- | I have used codelite for windows as the example throughout. However there are many more IDE/OS combos available. You can find a complete list from the latest premake here: http:// | ||
- | |||
- | ==== Premake Template ==== | ||
- | |||
- | {{tutorials: | ||
- | |||
- | All of the above has been created in a pre-zipped folder structure if you just want to try it out. However, you will still need to copy the correct files in place, ie the libraries, the includes, your source and any ini configs / assets. | ||
- | |||
- | ==== Troubleshooting ==== | ||
- | |||
- | 1. When running premake, you get: [string "local codelite = premake.codelite..." | ||
- | |||
- | Your premake4.lua file contains references to source files, but you didn't add any source files yet. | ||
- | |||
- | 2. When compiling: //fatal error: orx.h: No such file or directory// | ||
- | |||
- | You forgot to copy orx's includes to your includes. | ||
- | |||
- | 3. When compiling, if you get errors like... //undefined reference to `vtable for __cxxabiv1:: | ||
- | |||
- | You set the wrong language. Check if you want C++, your haven' | ||
- | |||
- | 4. When compiling, if you get errors like...// c:/ | ||
- | |||
- | | ||
- | |||
- | |||
- | |||
- | |||
- | |||