I am working on upgrading wxWidgets version to 3.1.6 in MSys2.
While doing that I tested how to use wx-config-3.1.
And, CB still needs a patch to make it easy to do.
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
wxFileName MasterPath;
MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+ m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
+ m_Macros[_T("TARGET_COMPILER_VOLUME")] = MasterPath.GetVolume();
}
m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
}
TARGET_COMPILER_UNIX_PATH is like TARGET_COMPILER_DIR but, it always uses forward slashes and does not have a slash at the end. And, it does not show the drive letter like I thought it would.
So, I also added TARGET_COMPILER_VOLUME which will be just the drive letter.
custom variable
WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_VOLUME):$(TARGET_COMPILER_UNIX_PATH)
Extra setting entry example
`sh.exe -c '$(WX_CONFIG) --cflags'`
Global Compiler Additional paths; this may be needed with wxWidgets 3.1.6; might not be needed with 3.1.5 msys2 library
$(TARGET_COMPILER_DIR)../usr/bin
Hi, Tim, thanks, I am also interested on this usage.
But:
WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_VOLUME):$(TARGET_COMPILER_UNIX_PATH)
Do we need two variables? I mean maybe we only need one variable to handle this?
I just did some test:
F:\code>sh.exe -c 'wx-config-3.1 --prefix=F:/code/msys2-64/mingw64/ --libs all'
-LF:/code/msys2-64/mingw64//lib -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_webview-3.1 -lwx_mswu_stc
-3.1 -lwx_mswu_richtext-3.1 -lwx_mswu_ribbon-3.1 -lwx_mswu_propgrid-3.1 -lwx_mswu_aui-3.1 -lwx_mswu_gl-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1
-lwx_baseu-3.1
F:\code>sh.exe -c 'wx-config-3.1 --prefix=F:\code\msys2-64\mingw64\ --libs all'
So, you can see, we only need the "/" (forward slash) path separator version of the TARGET_COMPILER_DIR?
There is a command named "cygpath", which can do such convert
F:\code>cygpath -m F:\code\msys2-64\mingw64\
F:/code/msys2-64/mingw64/
So, either we can define a new variable like "TARGET_COMPILER_DIR_UNIX_SEP" or we may use the cygpath command some where.
F:\code>sh.exe -c 'wx-config-3.1 --prefix=`cygpath -m F:\code\msys2-64\mingw64\ ` --libs all'
-LF:codemsys2-64mingw64/lib -pipe -Wl,--dynamicbase,--high-entropy-va,--nxcompat,--default-image-base-high -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_webview-3.1 -lwx_mswu_stc-3.1
-lwx_mswu_richtext-3.1 -lwx_mswu_ribbon-3.1 -lwx_mswu_propgrid-3.1 -lwx_mswu_aui-3.1 -lwx_mswu_gl-3.1 -lwx_mswu_html-3.1 -lwx_mswu_qa-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx
_baseu-3.1
This works, but please note that there is a space after the string "F:\code\msys2-64\mingw64\". Also, I don't know how to do this inside the C::B build option.
Could not find what I thought I did.
But, I found a more complex solution.
Your stuff will likely fail to work; but, try doing it. Maybe you have better luck; I really do not know CB scripting and I think it might be simple using CB scripting.
If you want a better fix than fix the below so it works in setting a custom variable.
$TO_UNIX_PATH{$(TARGET_COMPILER_DIR)}
Everything I try failed to work in setting a custom variable; the two lines work patch I posted yesterday.
I just recalled the changing of TARGET_COMPILER_DIR patch was posted by someone else.
I cannot remember who did it; but, it just changed the "\" to "/" and I think it removed the trailing slash.
Tim S.
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
wxFileName MasterPath;
MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+ m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetVolume() +
+ MasterPath.GetVolumeSeparator() + MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
}
m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
}
I am building CB with the above patch; no idea if it will work; but, the wxWidgets directions implies it might.
Edit: It worked in the wx 3.1 minimal test project. No idea what it will do under wxWidgets 3.0 or under Linux.
Edit2: WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_UNIX_PATH)
Tim S.
Hi, Tim, you method works under C::B.
I just add the below line to the linker option:
`sh.exe -c 'wx-config-3.1 --prefix=$TO_UNIX_PATH{$(TARGET_COMPILER_DIR)} --libs all'`
and the linker works correctly(it link to the wx library supplied by msys2).
So, is the patch below still needed?
Index: src/sdk/macrosmanager.cpp
===================================================================
--- src/sdk/macrosmanager.cpp (revision 12814)
+++ src/sdk/macrosmanager.cpp (working copy)
@@ -394,6 +394,8 @@
wxFileName MasterPath;
MasterPath.SetPath(c->GetMasterPath(), wxPATH_NATIVE);
m_Macros[_T("TARGET_COMPILER_DIR")] = MasterPath.GetPathWithSep(wxPATH_NATIVE);
+ m_Macros[_T("TARGET_COMPILER_UNIX_PATH")] = MasterPath.GetVolume() +
+ MasterPath.GetVolumeSeparator() + MasterPath.GetPath(wxPATH_GET_VOLUME, wxPATH_UNIX);
}
m_Macros[_T("TARGET_OBJECT_DIR")] = target->GetObjectOutput();
}
I am building CB with the above patch; no idea if it will work; but, the wxWidgets directions implies it might.
Edit: It worked in the wx 3.1 minimal test project. No idea what it will do under wxWidgets 3.0 or under Linux.
Edit2: WX_CONFIG=wx-config-3.1 --prefix=$(TARGET_COMPILER_UNIX_PATH)
Tim S.
What is the msys2 package do we need to use this cbp?
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw
# pacman -S mingw-w64-x86_64-wxwidgets3.2-msw-cb_headers
Those two packages?
EDIT:
Where is the "updatemsys2.sh"?
Here are some steps I need to use Tim's cbp file:
0, use pacman to install wx library (3.2)
pacman -S mingw-w64-x86_64-wxwidgets3.2-msw
pacman -S mingw-w64-x86_64-wxwidgets3.2-msw-cb_headers
1, Set the compiler path to msys2's mingw 64 bit comipler, in my PC, it is
and put the string
$(TARGET_COMPILER_DIR)../usr/bin
In the "Additional Paths" option in the global Compiler setting.
2, open the cbp file(CodeBlocks_wx32-msys2.cbp), build.
3, in the msys2 mingw64's shell, run the command
Note that those tools are needed to used by the "update" script
pacman -S zip
pacman -S rsync
The result C::B(in the outputmsys2 folder) looks OK :)
Note this only contains the core plugins.
BTW: it takes about 12 minutes to build the CodeBlocks_wx32-msys2.cbp on my PC, while it takes more than about 35 minutes to let the "Clangd_client" to parse all the 457 source files on my PC. :(
I have come across two issues as described below:
WX_CONFIG Library usage
Cannot build SDK target using what I think is the standard using the library linker tag as follows:
You cannot use the following
<Add library="`$(WX_CONFIG) --libs std,aui,propgrid`" />
You need to use this
<Add option="`$(WX_CONFIG) --libs std,aui,propgrid`" />
I see no difference between what you say works and not works.
Tim S
I think they are different options:
For example:
<Linker>
<Add option="`$(WX_CONFIG) --libs std,aui`" />
<Add option="-Wl,--no-undefined" />
<Add library="codeblocks" />
</Linker>
The "Add library" told C::B that a library named "codeblocks" will be linked, C::B will generate the correct linker command line option.
While, the "Add option" let the user directly put the linker command line option.