Can a single Xojo Project file produce two different executable at the same time?
Say for example you are writing a client/server and both derived from the same code base.
And you change the code base and then build, it should build both the client and the server.
Can it?
[quote=199953:@Brian O’Brien]Can a single Xojo Project file produce two different executable at the same time?
Say for example you are writing a client/server and both derived from the same code base.
And you change the code base and then build, it should build both the client and the server.
Can it?[/quote]
It looks possible with conditional compilation.
You could have a boolean constant in App, for instance “Server”, that you set to true or false.
Then in App.Open, for instance, you could have
#if Serverthen
// Do whatever is necessary for server
#Else
// Do whatever is necessary for client
#endif
Yeah but is it to rename the .exe via conditions? Maybe with an IDE script or something?
You probably can with a doShellCommand.
Make allows things like this in unix worlds etc…
I was more thinking along the lines off ‘make all’
Via IdeScript is really simple
as example:
you have a Module (module1) with 3 constants:
isServer - Boolean you use in your app to use the code for server instead o the code for client
#if Module1.isServer
//Server code
#else
//Client code
#endif
appName - String for the app name, you will use as MacAppName or WindowsAppName = #Module1.appName
bundleId - String for the bundleIdentifier, you will use as (OS X) Bundle Identifier= #Module1.bundleId
The script will be:
sub checkForBuild(mode as boolean,isWin as boolean)
call SelectProjectItem "Module1"
constantValue("isServer")=if(mode,"true","false")
if mode then
ConstantValue("appName")="TestServer"+if(isWin,".exe","")
ConstantValue("bundleId")="com.test.test.server"
else
ConstantValue("appName")="TestClient"+if(isWin,".exe","")
ConstantValue("bundleId")="com.test.test.client"
end if
end sub
//Build the two versions for Mac
checkForBuild(true,false)
call BuildApp(7,false)
checkForBuild(false,false)
call BuildApp(7,true)
//or for win
checkForBuild(true,true)
call BuildApp(3,false)
checkForBuild(false,true)
call BuildApp(3,true)
Hmm… I need to try this again. The last time I was able to change the bundle id only once and then it didn’t change the bundle id again. Also building was async, wasn’t it?