moving to wxWidgets 3.0

Building and customizing Audacity from the source code.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 3.0

Post by Edgar » Thu Nov 14, 2013 11:42 pm

Make sure to reboot your computer after resetting the WXWIN environmental variable! Do this before you attempt to ever compile Audacity.

Use this Microsoft Visual Studio project:
audacity-vs2012.sln
to compile Audacity.

I would suggest following this procedure:
1) download & compile current wxWidgets stable 3.0

2) set WXWIN environmental variable

3) Make sure to reboot your computer after resetting the WXWIN environmental variable! Do this before you attempt to ever compile Audacity.

4) checkout a clean Audacity SVN HEAD

5) open the audacity-vs2012.sln in VC++ 2012 and make all the needed Linker library changes:
Use a text editor which will edit these two files:
winProjectsAudacityAudacity.vcproj
[previous line edited 21 November 2013 to repair typo]
winProjectsAudacityAudacity.vcxproj
use search and replace (case-sensitive NOT full word) to change all instances of:
wxbase28
into:
wxbase30
(should be four replacements) and also:
wxmsw28
into:
wxmsw30
(should be six replacements).

6) while not mandatory, if you plan on making your own changes to the source code, you might want to add the wxWidgets include/lib paths:
$(WXWIN)includelib
to your Visual Studio's search paths (under Tools>Options>Projects>VC++ Directories.

7) search all Audacity source code for every instance of "AddPendingEvent" it will find a bunch of lines like:
AddPendingEvent(e);
change them to:
ProcessWindowEvent(e);
(remember the (e) might really be (event) then use "ProcessWindowEvent(event);" etc. (Note - the word "event" is a reserved word for Microsoft's Visual Studio so in the future it should not be used and eventually all existing usages must be replaced.)

8) There are lots of wxFont related statements which will need to be changed:
wxFont(fontSize, wxSWISS, wxNORMAL, wxNORMAL)
will become:
wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)
in this case you'll want to search (match case, match whole word):
wxSWISS, wxNORMAL, wxNORMAL
and replace with:
wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL

wxFont(fontSize, wxSWISS, wxNORMAL, wxBOLD)
will become:
wxFont(fontSize, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD)
in this case you'll want to search (match case, match whole word):
wxSWISS, wxNORMAL, wxBOLD
and replace with:
wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD

wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL)
will become:
wxFont(fontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)
in this case you'll want to search (match case, match whole word):
wxFIXED, wxNORMAL, wxNORMAL
and replace with:
wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL

NOTE in wxWidgets 2.8 style and weight use the same #define (wxNORMAL) so you cannot simply replace it globally.

There will be a few places that this misses, the next thing you'll want to do is search for these:
wxSwiss becomes wxFONTFAMILY_SWISS
wxFixed becomes wxFONTFAMILY_TELETYPE
wxModern becomes wxFONTFAMILY_MODERN
wxNormal becomes one of: wxFONTSTYLE_NORMAL or wxFONTWEIGHT_NORMAL (be careful not to get them mixed up)
wxBold becomes wxFONTWEIGHT_BOLD


9) use Batch Build to compile everything (click the "Select All" button Then the "Build" button – this will build the entire Audacity solution including help and locale plus all the external libraries in both Release and Debug configurations). You will get a lot of errors!

10) I found it easiest to start with the external libraries--fewer changes--so open the Solution Explorer window and start at the bottom "twolame"--right-click to get a context menu, choose Project Only > Build only twolame, fix errors until it builds then move up to "soundtouch" and continue.

When you hit an error search through the above patch to find the solution (or a similar solution) and apply the fix manually.

I have attached a new patch against revision 12947 SVN HEAD as of 14 November 2013. I have not tested the functionality of this version of Audacity but I know there are problems – the Log is broken, trying to access it from the menu causes Audacity to crash.
Attachments
2wx30-2.zip
(232.61 KiB) Downloaded 223 times
Last edited by Edgar on Fri Nov 22, 2013 8:01 am, edited 1 time in total.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: moving to wxWidgets 3.0

Post by Gale Andrews » Fri Nov 22, 2013 7:54 am

Edgar wrote:5) open the audacity-vs2012.sln in VC++ 2012 and make all the needed Linker library changes:
Use a text editor which will edit these two files:
winProjectsAudacityAudacity.vcxproj
winProjectsAudacityAudacity.vcxproj
Hi Ed. As those files are the same, which is the second file to be edited?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Edgar
Forum Crew
Posts: 2042
Joined: Thu Sep 03, 2009 9:13 pm
Operating System: Windows 10

Re: moving to wxWidgets 3.0

Post by Edgar » Fri Nov 22, 2013 7:59 am

Gale Andrews wrote:
Edgar wrote: Use a text editor which will edit these two files:
winProjectsAudacityAudacity.vcxproj
winProjectsAudacityAudacity.vcxproj
As those files are the same, which is the second file to be edited?
Sorry…
Use a text editor which will edit these two files:
winProjectsAudacityAudacity.vcproj
winProjectsAudacityAudacity.vcxproj

LaurentFr
Posts: 12
Joined: Fri Jul 20, 2012 6:12 pm
Operating System: Please select

Re: moving to wxWidgets 3.0

Post by LaurentFr » Tue Jan 14, 2014 6:49 pm

Hi,

thanks you for your patch
May be something is wrong in my code or i ihave missed something in patch but I have append this two functions
bool EndEdit(int,int,const wxGrid *,const wxString &,wxString *){return true;};
void ApplyEdit(int,int,wxGrid *){return;};
ingrid.h for class ChoiceEditor and TimeEditor

I have got link error
1>libflac.lib(metadata_iterators.obj) : error LNK2019: symbole externe non résolu _ftello référencé dans la fonction _FLAC__metadata_simple_iterator_next
1>libflac.lib(stream_encoder.obj) : error LNK2001: symbole externe non résolu _ftello
1>libflac.lib(stream_decoder.obj) : error LNK2001: symbole externe non résolu _ftello
1>libflac.lib(metadata_iterators.obj) : error LNK2019: symbole externe non résolu _fseeko référencé dans la fonction _FLAC__metadata_simple_iterator_get_application_id
1>libflac.lib(stream_encoder.obj) : error LNK2001: symbole externe non résolu _fseeko
1>libflac.lib(stream_decoder.obj) : error LNK2001: symbole externe non résolu _fseeko

I have changed in files metadata_iterators.c, stream_decoder.c abd streal_encoder.c at line 50 :
#if _MSC_VER <= 1600 || defined __BORLANDC__ /* @@@ [2G limit] */
in
#if _MSC_VER <= 1700 || defined __BORLANDC__ /* @@@ [2G limit] */


For logmessage about font it's better to use now in wxWidgets TimeTextCtrl.cpp
wxFont(fontSize, wxFONTFAMILY_SWISS , wxFONTSTYLE_NORMAL , wxFONTWEIGHT_NORMAL ) instead of
wxFont(fontSize, wxFIXED, wxNORMAL, wxNORMAL)
Laurent

System windows 7 Visual studio 2012 update 2 project audacity win32

schmide
Posts: 22
Joined: Sun Oct 06, 2013 1:01 am
Operating System: Please select

Re: moving to wxWidgets 3.0

Post by schmide » Sun Jan 19, 2014 3:39 am

Just a note. I just completed this transition and am running on the current code base with vc2012 and wx3.0.

Hopefully it will get in after this next release. I'm chatting about it now.

BTW I found 62 incompatibilities between 2.8 - 3.0

schmide
Posts: 22
Joined: Sun Oct 06, 2013 1:01 am
Operating System: Please select

Re: moving to wxWidgets 3.0

Post by schmide » Sun Jan 19, 2014 3:48 am

Oh and btw Edgar your post was very helpful in jump starting me.

Post Reply