Referencing wxWidgets Externally (Non portable) - Ravbug/wxWidgetsTemplate GitHub Wiki
If you do not want to store wxWidgets within your repository, simply delete the wxWidgets
folder in the repository root. Then follow the instructions below to link your external wxWidgets install to the template.
macOS
- Open
mac.xcodeproj
in the template repository root. - Select
wxocoa.xcodeproj
,wxcocoa.xcconfig
,wxdebug.xcconfig
, andwxrelease.xcconfig
in the left sidebar - In the inspector in the right sidebar, select
Absolute Path
(or a different option that is more suitable). - Click the miniature folder button, then select
your wxWidgets folder/build/osx/
- Select
mac
(top level item) in the left sidebar. Press the Build Settings tab, then scroll to the bottom of the page. - Select the
WXROOT
row, then change the path to where wxWidgets is located on your Mac. - Select your Dynamic target. Open the General tab, then press the
+
underEmbedded Binaries
. Selectlibwx_osx_cocoa.dylib
from the dropdown menu. Repeat this forLinked Frameworks and Libraries
. - Select your Static target. Under Linked Frameworks and Libraries, press the
+
button, then selectlibwx_osx_cocoa_static.a
from the dropdown. - Compile and run both the Static and Dynamic configurations for your app. They should compile successfully now.
Windows
- Using a text editor (NOT Visual Studio), open
windows.sln
in the template repository root. - Using Find and Replace, replace all instances of
wxWidgets\build\msw\
withyour_path\to\wxWidgets\build\msw\
- Save changes to
windows.sln
, then open it with Visual Studio. If the project list in the Solution Explorer lists unavailable projects, check that the paths you replaced are correct. - In the Solution Explorer, select the
application
project, then go toProject->Properties
- Set the Configuration to
All Configurations
and Platform toAll Platforms
(top of the popup window) - Navigate to
C/C++ -> General
in the dialog sidebar, then editAdditional Include Directories
. Change the two items so that they point toyour wxWidgets\include\msvc\
andyour wxWidgets\include\
- Change
Platform
toWin32
. Then navigate toLinker -> General
and editAdditional Library Directories
. Change the one item toyour wxWidgets\lib\vc_lib
- Change
Platform
tox64
. Then navigate toLinker -> General
and editAdditional Library Directories
. Change the one item toyour wxWidgets\lib\vc_x64_lib
- Follow the instructions on Building the Projects.
- Go back to
windows.sln
. Build all the Platform and Configuration combinations (Debug and Release for x64 and Win32). They should all work. If you get a compile error, the path you entered in step 4 is incorrect. If you get a linker error, the path you entered in step 6 or 7 is incorrect.
Linux
- Open
makefile
- Change
WXROOT
on line 3 to the full path to your wxWidgets folder
# flags needed to build the target (compiler, target name, and compiler flags)
CC = c++
WXROOT := new/path/to/wxWidgets
- Save changes to
makefile
, then opensetup-linux.sh
- Change WXROOT on line 6 to the full path to your wxWidgets folder (same as what you entered in the makefile)
# Modify this variable if wxWidgets is not located in this repository
# change it to the path where wxWidgets is located
WXROOT=new/path/to/wxWidgets
- Save changes to
setup-linux.sh
, then runmake clean-all && make run
to build and run the app. If you get a compiler or linker error, your path is incorrect. Check the path and then rerun the command.