Author Topic: what is the correct way to build wx trunk with direct2d enabled  (Read 5553 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
what is the correct way to build wx trunk with direct2d enabled
« on: December 18, 2020, 02:18:25 pm »
For the official release of wx, such as 3.1.4, I have a file wxWidgets-3.1.4\include\wx\msw\setup.h

Then I can modify this file so that:

Code
#define wxUSE_GRAPHICS_DIRECT2D 1

So, I use the command:
Code
mingw32-make -j4 -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-Wno-unused-local-typedefs -Wno-deprecated-declarations -fno-keep-inline-dllexport" >log-release.txt 2>&1

But when I clone the official wx git, I don't see the file: wxWidgets-git\include\wx\msw\setup.h
I only see a file: wxWidgets-git\include\wx\msw\setup0.h
Which contains the line:

Code
#define wxUSE_GRAPHICS_DIRECT2D 0


So, what is the correct way to build the wxwidgets git with direct2d enabled? Do I need to modify this setup0.h? And then run the command:
Code
mingw32-make -j4 -f makefile.gcc USE_XRC=1 SHARED=1 MONOLITHIC=1 BUILD=release UNICODE=1 USE_OPENGL=1 VENDOR=cb CXXFLAGS="-Wno-unused-local-typedefs -Wno-deprecated-declarations -fno-keep-inline-dllexport" >log-release.txt 2>&1

Is there any suggested way?

Thanks.
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.

Offline Miguel Gimenez

  • Developer
  • Lives here!
  • *****
  • Posts: 1553
Re: what is the correct way to build wx trunk with direct2d enabled
« Reply #1 on: December 18, 2020, 02:31:43 pm »
wxWidgets docs recommend copying setup0.h to setup.h and then modifying setup.h.

If you have already compiled wxWidgets then you will have a setup.h file in wxWidgets-git\lib\gcc_dll\mswu\wx, and the changes to the one in include won't have any effect, so you must delete the lib one and rebuild wxWidgets

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: what is the correct way to build wx trunk with direct2d enabled
« Reply #2 on: December 18, 2020, 02:38:33 pm »
wxWidgets docs recommend copying setup0.h to setup.h and then modifying setup.h.
Thanks, I will do it.

Quote
If you have already compiled wxWidgets then you will have a setup.h file in wxWidgets-git\lib\gcc_dll\mswu\wx, and the changes to the one in include won't have any effect, so you must delete the lib one and rebuild wxWidgets
OK.
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.

Offline LETARTARE

  • Lives here!
  • ****
  • Posts: 531
  • L'ami de l'homme.The friend of man.
    • LETARTARE
Re: what is the correct way to build wx trunk with direct2d enabled
« Reply #3 on: December 18, 2020, 03:44:56 pm »
Hello,
Win : To avoid having to copy by hand, I use two files '* .bat' in attachments
CB-13483, plugins-sdk-2.25.0 : Collector-2.0.0, AddOnForQt-3.9.1
1-Win7 Business Pack1 64bits : wx-3.2.4, gcc-8.1.0,
2-OpenSuse::Leap-15.4-64bits : wx-3.2.4;gtk3, gcc-8.2.1,
=> !! The messages are translated by Deepl

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: what is the correct way to build wx trunk with direct2d enabled
« Reply #4 on: December 18, 2020, 06:14:17 pm »
Isn't this comment helpful:
Code
#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
    // You need a build of wxWidgets with enabled Direct2D rendering support.
    // Unfortunately wxWidgets doesn't enable this by default when using non-Visual studio
    // compilers, so you have to enable it manually. To do so you have to edit the file
    // <wxWidgets-root>/include/wx/msw/setup.h.
    // Change "#define wxUSE_GRAPHICS_DIRECT2D 0" to "#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT".
    // If you're rebuilding wxWidgets you might also have to edit the file
    // <wxWidgets-root>/lib/gcc_dll/mswu/wx/setup.h.
    #error "You need to have Direct2D capable wxWidget build to build Code::Blocks. We want to support fonts with ligatures!!!"
#endif // wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
(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!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: what is the correct way to build wx trunk with direct2d enabled
« Reply #5 on: December 19, 2020, 04:09:23 am »
Isn't this comment helpful:
Code
#if wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)
    // You need a build of wxWidgets with enabled Direct2D rendering support.
    // Unfortunately wxWidgets doesn't enable this by default when using non-Visual studio
    // compilers, so you have to enable it manually. To do so you have to edit the file
    // <wxWidgets-root>/include/wx/msw/setup.h.
    // Change "#define wxUSE_GRAPHICS_DIRECT2D 0" to "#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT".
    // If you're rebuilding wxWidgets you might also have to edit the file
    // <wxWidgets-root>/lib/gcc_dll/mswu/wx/setup.h.
    #error "You need to have Direct2D capable wxWidget build to build Code::Blocks. We want to support fonts with ligatures!!!"
#endif // wxCHECK_VERSION(3, 1, 0) && defined(__WXMSW__) && !defined(HAVE_DIRECTWRITE_TECHNOLOGY)

Yes, change to "#define wxUSE_GRAPHICS_DIRECT2D wxUSE_GRAPHICS_CONTEXT" is better than "#define wxUSE_GRAPHICS_DIRECT2D 1".

@LETARTARE
Thanks.
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.