Tapatalk

Is it possible to configure one compiler config file for multiple compiler executables?

Is it possible to configure one compiler config file for multiple compiler executables?

2362
MasterMaster
2362

    May 07, 2013#1

    I have a situation where I would like to make things a bit easier on myself.

    I am testing out, and will possibly be making the plunge to Free Pascal, as I have extensive knowledge of Delphi, and it is very similar, except with Free Pascal I can compile for any platform without having to make changes to the code.

    I want to be able to, by using the Set Compiler Options under the Build menu, set the target OS for the compile, and then UES use the proper compiler/cross-compiler to do the job, with a default to the OS that I am coding under (Win7 64-bit). I have Free Pascal compilers that will compile native code from Win7-64 to Win32, OS-X 32 and 64, Linux 32 and 64, FreeBSD, Haiku, etc. I just need to be able to set the target in a drop-down, that will automatically select the correct compiler executable and set the proper target extension and a target directory (much like there is a debug directory and release directory, but I want release directories for each target platform.)

    Is this possible to do within a single compiler config file without me having to select a different compiler for each target build? Or will I have to select a different compiler config file for each target build?

    What would be ideal is if I could have the drop-down in the tool-bar that says "Debug/Release" to have all my target options in that, like: Debug Win64, Release Win64, Release Win32, Release Ubuntu64, Release Ubuntu32, etc. Just need to know what is possible here. I don't want all the step by step at this point, as I'd like to dive in and figure most of it out myself, but no sense in diving in if it isn't possible.

    6,688587
    Grand MasterGrand Master
    6,688587

      May 07, 2013#2

      One method to support a multi-platform compiler is to create a compiler config which calls for Cmd0 = under Build, .PAS and .RC a batch file which you have to write. The first parameter passed to the batch file from the config (= project.mak makefile) should be the platform setting, the second parameter is the type of command (compile file, build target, ...), other parameters are for example project directory path, project name, output file name, the debug and release flags

      [Settings]
      Platform = All|Win64|Win32|Ubuntu64|Ubuntu32

      [SettingsInfo]
      Platform = Target platform for created executable.

      [.PAS]
      Cmd0 = FreePascal.bat $(Platform) Compile $R $I etc.

      [Build]
      Cmd0 = FreePascal.bat $(Platform) Build $R etc.

      The batch file FreePascal.bat evaluates the first 2 parameters for setting the right compiler and compiler options and determining the right target respectively output path.

      I don't know if it is possible to create IF conditions directly in the config file itself so that the makefile created by UEStudio already depends on some compiler settings.

      Of course the batch file could be also called via user/project tools with parameters which differ from one build to the other like platform, debug or release build.


      Another method would be to use a solution. Such a multi-platform configuration is a typical scenario for solution. You create one project for every platform and put all those projects into a solution. With the Batch Build command you can then easily select which projects of the solution should be build once the code works fine for one platform.

      2362
      MasterMaster
      2362

        May 07, 2013#3

        Thanks, Mofi, for your answer. From that, I think I'll try out a couple of things, explore a bit, and make a decision on which way to go.

        As always, it seems there will always be a way to figure out how to get more done with UES.