User forums > General (but related to Code::Blocks)

codeblocks cbp projects for wx samples

<< < (3/5) > >>

AndrewCot:
I have been playing with wx-config-msys2 source and have got it sort of working in building C::B. I have created a C::B project for it and added it to my msys C::B workspace.


I need to first build the wx-config-msys.exe before I can then use it via a global variable. Once wx-config-msys.exe exists I then need to reload the workspace before I can then build C::B.

I need to look at the backticks expansion and see where the project file backtick expansion occurs as the expansion needs to occur at project compile time rather than at project load time. My guess is that currently the expansion occurs when the project is loaded loaded and as the  wx-config-msys.exe file does not exist then the expansion does not work or is an empty string. I need to investigate this as it is not currently working properly IMHO.

This is an example of my usage and variable setup:
Example project settings:
--- Code: ---        <Compiler>
            <Add option="`$(#WXWIDGETS.WX_CONFIG) --cflags`" />
        </Compiler>
        <Linker>
            <Add option="`$(#WXWIDGETS.WX_CONFIG) --libs std,aui,propgrid`" />
        </Linker>

--- End code ---

#WXWIDGETS.WX_CONFIG setting:

--- Code: ---D:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental_GCC\src\devel32_64\wx-config-msys2.exe --prefix=$(TARGET_COMPILER_DIR)
--- End code ---

ollydbg:
Hi, AndrewCot, nice work!

I think using the global compiler variable is better and more flexible than putting the wx-config-msys2.exe directly in the linker or compiler options.

Maybe it can have cross-platform support.

If you look at the generated exe file of eranif's project, it has a wx-config.exe which supports local(self built) wx library, and wx-config-msys2.exe support msys2's prebuild wx library. So, just change the #WXWIDGETS.WX_CONFIG setting in different cases.

AndrewCot:
I use a #WXWIDGETS.WX_CONFIG global variable that I change to build Linux or Mac for the one set of project files. Once I get the wx-config-msys2.exe building and runnign in the one project file I will have a look at the wx-config.exe as it will simplify the project files and allow me to merge my current two sets of Windows project files back into one set, which is allot more manageable and makes updates/changes allot easier.In the long run I hope (I can wish) that only one set of project files will be needed, but there are issues with the <ExtraCommands> , <Compiler> and <Linker> which have different options for the Windows compared to Linux/Mac.

ollydbg:

--- Quote from: ollydbg on September 13, 2022, 03:38:59 am ---
EDIT

I found an old reop which is also by tim
stahta01/cb_projects_for_wxWidgets: Code::Blocks projects for building wxWidgets sample code
It was several years ago, and it use the wx-config.exe.


--- End quote ---

I think tim's this repo could be a start work base.

I see in each cbp file of this repo, it has something like:


--- Code: --- <Target title="win_gcc">
<Option output="bin/$(TARGET_NAME)/$(PROJECT_NAME)" prefix_auto="1" extension_auto="1" />
<Option object_output=".objs/$(TARGET_NAME)" />
<Option type="0" />
<Option compiler="gcc" />
<Option projectLinkerOptionsRelation="2" />
<Compiler>
<Add option="`$(WX_CONFIG) --cflags`" />
</Compiler>
<Linker>
<Add option="`$(WX_CONFIG) --libs std,ribbon`" />
</Linker>
<Environment>
<Variable name="WX_CONFIG" value="wx-config --compiler=gcc --wxcfg=$(WXCFG)" />
</Environment>
</Target>

--- End code ---

Here, tim use the "WX_CONFIG" variable. This variable is cbp dependent, I think a better method is using the C::B's global compiler variable, such as #WXWIDGETS.WX_CONFIG

So, basically, what I need to do is:

1, remove the <Environment> section.
2, change the $(WX_CONFIG) to #WXWIDGETS.WX_CONFIG
3, add a gcv, which point the #WXWIDGETS.WX_CONFIG to the correct wx-config-msys2.exe or wx-config.exe
4, update tim's repo code in samples to the latest wx 3.2.1

ollydbg:
Here are some news:

I have a fork from Tim's repo, and I have used the gcv(global compiler variable) WX_CONFIG

Some of samples are updated and worked fine by using the wx-config-msys2.exe and the 3.2.0 library inside the msys2 mingw64 toolchain.

Here is the commit history:
Commits asmwarrior/cb_projects_for_wxWidgets

I'm not sure there is a find/replace method to do all the jobs, currently, I just manually edit the cbp file from C::B the build option dialog.

Some extra issue: when I try to start the generated application exe file, it looks like the starting directory is not correct. (a messagebox will be shown).

EDIT:
My WX_CONFIG setting is:


--- Code: ---wx-config-msys2.exe --prefix=$(TARGET_COMPILER_DIR)
--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version