User forums > Using Code::Blocks
[SOLVED]How to define different custom compilers for 64bit only?
cacb:
--- Quote from: MortenMacFly on December 19, 2015, 07:13:52 pm ---Why make it so complicated? Make 2 targets in the project, one for 64, one for 32 bit. Setup different compilers for them, then assign the files to be compiled as needed. Thus,. for the 32 bit exclude the ASM files, for 64 bit don't.
--- End quote ---
Because it would break my existing setup. I was hoping to include this project into an existing workspace with 15-20 existing projects configured as explained. They can all be built together in debug or release (I have targets for that) in 64/32bit mode (controlled via global variables).
If I can't do a conditional compile, I may have to do what you suggest, but then I need to keep it in a different workspace so as to not mess up the existing builds. But it would be nice it it could be avoided.
Could virtual targets somehow be a solution? I haven't used them and I am not sure what they are for.
cacb:
Well, I found a solution that works and which does not break my configuration. Perhaps you think it is too complicated, but I think it simplifies things as the new project fits in my system. Here's what i did:
First, I wrote a very simple dummy compiler that understands the same command line parameters as ml64.exe in MSVC, i.e. like this:
ml64.exe /c /nologo /W3 /Zi /Fo$object $file
The /Fo option defines the required output object file (shown here with C::B variables $object and $file). The dummy compiler simply creates a c++ file containing a dummy function and compiles it to the actual target object file name using the current c++ compiler (cl.exe). Then the linker and build system is happy.
Second, I defined a custom command to build the problem *.asm file, see attachment. The custom command refers to a global variable which takes different values for 32bit and 64bit. In the 64bit case it is obviously set to ml64.exe, and in the 32bit case it runs the dummy compiler.
Problem solved.
MortenMacFly:
--- Quote from: cacb on December 19, 2015, 11:17:50 pm ---Problem solved.
--- End quote ---
Ok, good to know. Under this circumstances it seems a good solution.
cacb:
--- Quote from: MortenMacFly on December 20, 2015, 10:41:23 am ---Ok, good to know. Under this circumstances it seems a good solution.
--- End quote ---
I have been using it today and it does the job just fine. If anyone needs something similar in C::B, I have attached the complete dummy compiler code code as a zip file. As it stands it is MSVC dependent, but can be adapted to other needs easily.
Navigation
[0] Message Index
[*] Previous page
Go to full version