It is currently Wed Jan 27, 2021 5:53 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: PureBasic Project: Compile groups of targets
PostPosted: Fri Feb 23, 2018 11:22 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
Hi all,

Right now you can add several targets to a project and either compile a single target or compile all targets. I was wondering if there is a possibility of compiling groups of targets

I have a massive project, separated in several modules (with for each platform a different target (Win x64/x86, Linux x64/x86, MacOS x64/x86) and right now if I want to compile a subset of targets, I have to compile all of them. I considered separating the groups into several projects, however you can have only one project open in PureBasic - so that's not efficient in my project.

Does anyone know how I can compile groups of targets or can anyone tell me if that's a feature that will ever be implemented in the IDE? I checked the pbcompiler flags if it is possible to compile a project on CLI, specifying a target, but that doesn't seem to be the case; it appears that the targets are handled in the IDE.

Cheers,
Bas

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Project: Compile groups of targets
PostPosted: Sat Feb 24, 2018 2:43 am 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 5:21 pm
Posts: 5818
Location: Germany
You can tell the IDE to compile a project via the commandline. You can even compile multiple targets this way.

_________________
quidquid Latine dictum sit altum videtur


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Project: Compile groups of targets
PostPosted: Sat Feb 24, 2018 9:25 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
Hi freak,

Thanks, I didn't know that! I can make groups of targets that way and integrate it as a tool.

It still would be awesome if it would be added to the IDE some day though, as graphical option :D

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Project: Compile groups of targets
PostPosted: Sat Feb 24, 2018 2:29 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Dec 23, 2003 3:54 am
Posts: 1869
It's not the nicest way, but I use constants to force compiler errors, so only the targets for this OS build when I hit "Build All".

For example, put something like this in your code:
Code:
CompilerSelect (#PB_Compiler_OS)
  CompilerCase (#PB_OS_Windows)
    #WindowsBuild = 1
    #MacBuild = 0
  CompilerCase (#PB_OS_MacOS)
    #WindowsBuild = 0
    #MacBuild = 1
CompilerEndSelect


Then for each target, go to Compiler Options > Constants > Custom Constants and add
Code:
#WindowsBuild = 1

or similar for each OS.


Then when you Build All, the targets for other OS'es will error out.


EDIT: Simpler yet, just use this, then you can define your own messages instead of messages about constant errors.
Code:
CompilerIf (Defined(WindowsBuild, #PB_Constant) And (#PB_Compiler_OS <> #PB_OS_Windows))
  CompilerError "Windows build disabled on this OS"
CompilerElseIf (Defined(MacBuild, #PB_Constant) And (#PB_Compiler_OS <> #PB_OS_MacOS))
  CompilerError "Mac build disabled on this OS"
CompilerEndIf

_________________
On GitHub: PB Includes - IDE Tools - Color Themes - IDE Branches - TabBarGadget Mods


Last edited by kenmo on Wed Feb 28, 2018 1:59 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: PureBasic Project: Compile groups of targets
PostPosted: Wed Feb 28, 2018 12:41 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon May 12, 2008 1:25 pm
Posts: 374
Location: The Netherlands
Yes, however I don't want that to happen as I also use the build success indicaters to actually see if a build succeeds. Using the PB Editor's flags are just the right thing for me!

Thanks :)

_________________
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye