News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

[Proposal] Move the custom variables WX_SUFFIX... to global variables

Started by BlueHazzard, January 30, 2017, 08:42:51 PM

Previous topic - Next topic

sodev

This question i also always ask myself when a fresh installation of CodeBlocks asks me to put something into cb_release_type :P.

Anyway i like having this in the global variables as well because CodeBlocks has so many project files, changing this is such a PITA. And no, i don't use that Project Options Plugin, it is not that intuitive to use plus in the dark days of the past some of these variables had a different name in a few projects.

But i might be a bit biased, i use a lot of these global variables to pull in external libraries into my projects without polluting the project files with machine dependent paths :).

oBFusCATed

In my opinion everybody doing something a bit more complex should reconsider if using something like cmake isn't a better option. C::B's build system can do a lot of things, but it is more limited compared to something like cmake...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

BlueHazzard

Quote from: oBFusCATed on September 12, 2018, 08:03:47 PM
What happens when these variables are empty?
How do you know what to put in there for initial values if you're new users and just starting?

We have discussed this countless times on the top. The conclusion was, that at the moment the same thing is to do for the "wx30" variable and the "cb_release_type"...
We should provide a proper README and INSTALL file...
I volunteer for all upcoming forum posts to answer them without any grumble

oBFusCATed

Hehe, and when you're tired of answering posts and quit?
Or people just don't be bothered to even post a question after they are greeted with some messages on project open?

I think it will be better if we have some UI and project storage for defaults and/or note/hints/help strings for the global variables?
I'm not really sure how this is supposed to work, but we need something like better than the current dialog.

A good example for similar tools is cmake-gui. It lists (almost) all variables and allows the user to set/change them.
There are tooltips with hints/help which is provided by users.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

ollydbg

BlueHazzard's work is great!

Under Windows, we have cbp/workspace/bat files for wx3.0 and wx3.1 and also we have 32bit and 64bit, maybe soon we will have wx3.2. I think we should only have one kinds of such files.

About OBF's suggestion of the UI, yes, it should be improved, at least some hint strings in the C::B's global variable setting dialog.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

AndrewCot

I second that BlueHazzard's work is great!

This saved me a number of hours trying to see what the best option was to support building against various wxWidget combinations (3.1.5 V's trunk <aka 3.1.6 in the future> and/or  debug V's release) without modifying the Windows project files every time I wanted to change a wxwidget variables.



AndrewCot

@BlueHazzard How is you changes in your github branch going? This may be helpful with Wxwidget 3.2 changes in order to not having to create yet another set of project files if possible. I think it could be possible based on the global changes that I have made in my local source to make it easier to build and potentially not have to change allot project files. It may also be possible to remove the Windows 32 bit build project files in the future as well.

Is it possible with you current code to also use a variable to change the "31_64" in the following project line so it uses two variables, one for WX.WX_VERSION and another for CB_BUILD.OSBIT (I
have not thought of a good name for this one) like the follwoing?
Original:    <Option output="devel31_64/txml" prefix_auto="1" extension_auto="1" />
Potential future:    <Option output="devel$(#WX.WX_VERSION )_$(#CB_BUILD.OSBITS)/txml" prefix_auto="1" extension_auto="1" />


I have the following global variables so that I can easily change my build:
<WXWIDGET>  <BASE>
      D:\Andrew_Development\Libraries\wxWidgets-3.1.5
  <INCLUDE>
      D:\Andrew_Development\Libraries\wxWidgets-3.1.5\include
  <LIB>
      D:\Andrew_Development\Libraries\wxWidgets-3.1.5\lib
  User-defined:
      <WX_CFG>
          ""
      <WX_VERSION>
          31
      <WX_SUFFIX>
          u

<cb_build>
    <BASE>
        D:\Andrew_Development\Work_Installers\AC-WindowsInstaller\src
    <INCLUDE>
        D:\Andrew_Development\Work_Installers\AC-WindowsInstaller\src\include
    User-defined:
        <COMPILER_OPTIONS>
            -g -O0 -ggdb

AndrewCot

I did a quick replace of "31_64" with "$(#WXWIDGETS.WX_VERSION)_$(#CB_BUILD.OSBITS)" and defined the two new global variables in CodeBlocks_wx31_64.cbp and it built. I then changes a few more specific keywords, but do NOT change "31 " or "64" globally as you will get into trouble if you do as some files include these.

@Miguel this may help out with moving to wxWidget 3.2 in  that on Windows instead of ending up with 4 sets or project files as follows you could have one, but some of the issues raised in previous posts need to be resolved.     CodeBlocks_wx31.cbp     CodeBlocks_wx32.cbp         * expected future for wx32
     CodeBlocks_wx31_64.cbp     CodeBlocks_wx32_64.cbp  * expected future for wx32

Miguel Gimenez

FYI, you can write

<BASE>
      D:\Andrew_Development\Libraries\wxWidgets-3.1.5
<INCLUDE>
      $(#WXWIDGETS)\include
<LIB>
      $(#WXWIDGETS)\lib


or just leave INCLUDE and LIB empty.

AndrewCot

Agree.I am still playing with the variables and reworking them as I think of better ways of using them. The next one that I spotted last night was to move $(#CB_RELEASE_TYPE) variable to be a built in cflags instead of a "base" variable. This has been staring me in the face for weeks and I only thought of it last night and will make the project files and variables more intuitive IMHO.

AndrewCot

In the attached 7z file is my cbp & workspace files that use the global variables from the code snippet below.

These cbp & workspace files allow me to do the following:

       
  • Change from 32 to 64 build without changing any cbp file

       
  • change wxWidget versions  without changing any cbp file
  • change wxWidget and other external third party dependent library references without changing any cbp file
  • change the CPP debug flags without changing any cbp file
  • change wxWidget library CFG, Version and Suffix without changing any cbp file
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocksGlobalVariableExportConfig version="1">
    <cb_win32>
        <cb_build>
            <BASE>D:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental\src</BASE>
            <INCLUDE>$(#CB_BUILD)\include</INCLUDE>
            <CFLAGS>-g -O0 -ggdb</CFLAGS>
            <OSBITS>32</OSBITS>
            <CPP_STD>gnu++17</CPP_STD>
        </cb_build>
        <wxwidgets>
            <BASE>D:\Andrew_Development\Libraries\wxWidgets-3.1.5_win$(#CB_BUILD.OSBITS)</BASE>
            <INCLUDE>$(#WXWIDGETS)\include</INCLUDE>
            <LIB>$(#WXWIDGETS)\lib</LIB>
            <WX_CFG>&quot;&quot;</WX_CFG>
            <WX_VERSION>31</WX_VERSION>
            <WX_SUFFIX>u</WX_SUFFIX>
        </wxwidgets>
        <discount>
            <BASE>D:\Andrew_Development\Libraries\discount_win$(#CB_BUILD.OSBITS)</BASE>
            <INCLUDE>$(#DISCOUNT)</INCLUDE>
            <LIB>$(#DISCOUNT)</LIB>
        </discount>
        <boost>
            <BASE>D:\Andrew_Development\Libraries\boost</BASE>
            <INCLUDE>$(#BOOST)</INCLUDE>
        </boost>
    </cb_win32>
    <cb_win64>
        <wxwidgets>
            <BASE>D:\Andrew_Development\Libraries\wxWidgets-3.1.5_win64</BASE>
            <INCLUDE>$(#WXWIDGETS)\include</INCLUDE>
            <LIB>$(#WXWIDGETS)\lib</LIB>
            <WX_CFG>&quot;&quot;</WX_CFG>
            <WX_VERSION>31</WX_VERSION>
            <WX_SUFFIX>u</WX_SUFFIX>
        </wxwidgets>
        <discount>
            <BASE>D:\Andrew_Development\Libraries\discount_win64</BASE>
            <INCLUDE>$(#DISCOUNT)</INCLUDE>
            <LIB>$(#DISCOUNT)</LIB>
        </discount>
        <cb_build>
            <BASE>D:\Andrew_Development\Work_Installers\CodeBLocks_Private_Experimental\src</BASE>
            <INCLUDE>$(#CB_BUILD)\include</INCLUDE>
            <CFLAGS>-g -O0 -ggdb</CFLAGS>
            <OSBITS>64</OSBITS>
            <CPP_STD>gnu++17</CPP_STD>
        </cb_build>
        <boost>
            <BASE>D:\Andrew_Development\Libraries\boost</BASE>
            <INCLUDE>$(#BOOST)</INCLUDE>
        </boost>
    </cb_win64>
</CodeBlocksGlobalVariableExportConfig>

P.S. The files include references to plugins and other items that you may not have as these files are from my local build directory and NOT from the CB SVN source tree. If you hit an issue diff the <TBA>_wx31_64.[cbp|workspace] against the <TBA>Windows.[cbp|workspace] file that you have an issue with.

AndrewCot

Using the workspace/project files in the 7z file from the previous post makes it a allot easier to upgrade from wxWidget 3.1.5 to 3.1.6 as you can change one global variable and the recompile and you are done. The only catch is you must have already built wxWidget 3.1.6