Author Topic: How to set up my own wx-config?  (Read 6923 times)

Offline kagi3624

  • Single posting newcomer
  • *
  • Posts: 7
How to set up my own wx-config?
« on: October 27, 2021, 08:51:50 am »
Hello, on my linux machine I have a second config for cross compiling to windows that I gave a symbolic link wx-config-forw and it compiles just fine when my default wx-config is something else:
Code
x86_64-w64-mingw32-g++ minimal.cpp `wx-config-forw --cxxflags --libs` -o minimal.exe

For my wxWidget project I would like to set to set up the debug build over g++ and the default wx-config and my release build over ming and my custom wx-config-forw. So how can I tell code::blocks to use my custom wx-config instead of the default one for the release build? If I add it to 'other linker options' in the build options the default config is still used and my project fails to build.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: How to set up my own wx-config?
« Reply #1 on: October 27, 2021, 11:32:24 am »
You have  different 'other linker options'  for the release and the debug targets, just remove the call to wx-config from the common options.

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: How to set up my own wx-config?
« Reply #2 on: October 27, 2021, 07:17:33 pm »
Specify full path to your wx-config

Offline kagi3624

  • Single posting newcomer
  • *
  • Posts: 7
Re: How to set up my own wx-config?
« Reply #3 on: October 28, 2021, 08:28:01 am »
Thanks, after some fiddling around I got it now. The most difficult part for me was to understand that common compiler and linker settings are used for both build options. Kinda contra intuitive when you have the option to chose two totally different compilers. Anyway,  you also have to remove compiler settings -> other compiler options in the common build options of your projects too. Or you could just edit your project file with a text editor, I guess it works too

Code
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="myPR" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/myPR" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-g" />
<Add option="`wx-config --cflags`" />
</Compiler>
<Linker>
<Add option="`wx-config --libs`" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/myPR" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="0" />
<Option compiler="mingw32" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="-O2" />
<Add option="`wx-config-forw --cflags`" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="`wx-config-forw --libs`" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="GUIFrame.cpp" />
<Unit filename="GUIFrame.h" />
<Unit filename="WxWizFrame.fbp" />
<Unit filename="myPRApp.cpp" />
<Unit filename="myPRApp.h" />
<Unit filename="myPRMain.cpp" />
<Unit filename="myPRMain.h" />
<Extensions />
</Project>
</CodeBlocks_project_file>