This post is split off from:
https://forum.orx-project.org/discussion/8234 Proposal
#2.
Premake is a brilliant tool for making projects on all operating systems and IDEs. It would be of great benefit to beginners to have everything down to one command + options to build without fuss.
I would propose we start with a folder structure template in the bitbucket repo. This could either be:
1. orx/code/demo
2. orx/tutorial
Either could serve as a template for developer's own projects. A build folder will exist there as well as a premake4.lua file.
In the same folder will exist two script files:
1. buildproject.sh
2. buildproject.bat (and accompanying powershell script)
One is for linux/mac and the other for windows.
Command usage would be:
buildproject <SolutionName> <ProjectName> <IDE>
Example:
buildproject mySolution myProject codelite
Another:
buildproject MyGame alienInvadersProject gmake
The sequence of tasks the script would preform would be:
1. Search and replace strings in the premake4.lua file with the values in parameters 1 and 2.
2. Save a new temporary premake4-configured.lua file.
3. Execute premake from inside orx/extern/premake against the new lua file and pass along param3, the IDE value.
4. Copy in the orx/lib libraries and report to the user if they do not exist yet.
5. Copy in the includes.
Done. The user can then copy this entire project folder out as the basis for their own project - complete with the configured solution and project names.
Below is a test script I have done for the .lua configuration part using powershell on windows. The linux script will be more straight forward:
param($p1, $p2, $p3, $p4)
(Get-Content $p1) |
ForEach-Object { $_ -replace "-- Solution: orx", "-- Solution: $p3" } |
ForEach-Object { $_ -replace 'solution "Tutorial"', "solution ""$p3""" } |
ForEach-Object { $_ -replace "-- Project: 01_Object", "-- Project: $p4" } |
ForEach-Object { $_ -replace 'project "01_Object"', "project ""$p4""" } |
ForEach-Object { $_ -replace 'files {"../src/01_Object.c"}', 'files {"../**.cpp", "../include/**.h"}' } |
Set-Content $p2
The advantage of this solution is that it requires no other thirdparty libraries or scripting languages except what is standard on most machines (ie bash or powershell/msdos batch).
Comments
Currenty builds using premake for windows. Either supply parameters or it will prompt you for each with a question if you don't supply anything.
If "android" is a supplied parameter, it hits the android stub for now. Potentially, this could go off and execute gradle scripts to build something simple for android beginners, or those curious to try their project on an android device.
This looks good, so this can generate project files for which platforms in its current state?
codeblocks, codelite, gmake, vs2002, vs2003, vs2005, vs2008, vs2010, vs2012, vs2013, xcode3, xcode4
Codelite and gmake can be for windows, linux or mac.
I'm starting to feel that my taste in development tools is too misaligned with the orx community for me to be able to contribute via a project template
Ubisoft did add support for Android+Android Studio to it, but of course it's not something I was allowed to use elsewhere.
I used Eclipsed+CDT for a few years before dropping it around 2008, when it got worse and worse in term of stability and performance, but I'm sure they've fixed all those issues by now.
I never liked eclipse tbh.
Update: I found this premake fork which happens to support xcode4 ios, also android ndk project not sure if that's eclipse, might wanna look into it. https://github.com/soundsrc/premake-stable