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

  1. Open mac.xcodeproj in the template repository root.
  2. Select wxocoa.xcodeproj, wxcocoa.xcconfig, wxdebug.xcconfig, and wxrelease.xcconfig in the left sidebar
  3. In the inspector in the right sidebar, select Absolute Path (or a different option that is more suitable). Location dropdown screenshot
  4. Click the miniature folder button, then select your wxWidgets folder/build/osx/ Mini folder button
  5. Select mac (top level item) in the left sidebar. Press the Build Settings tab, then scroll to the bottom of the page.
  6. Select the WXROOT row, then change the path to where wxWidgets is located on your Mac. Xcode Build Settings screenshot
  7. Select your Dynamic target. Open the General tab, then press the + under Embedded Binaries. Select libwx_osx_cocoa.dylib from the dropdown menu. Repeat this for Linked Frameworks and Libraries. Embedded binaries and Linked Libraries selection
  8. Select your Static target. Under Linked Frameworks and Libraries, press the + button, then select libwx_osx_cocoa_static.a from the dropdown. Linked libraries
  9. Compile and run both the Static and Dynamic configurations for your app. They should compile successfully now.

Windows

  1. Using a text editor (NOT Visual Studio), open windows.sln in the template repository root.
  2. Using Find and Replace, replace all instances of wxWidgets\build\msw\ with your_path\to\wxWidgets\build\msw\
  3. 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.
  4. In the Solution Explorer, select the application project, then go to Project->Properties accessing project propeties
  5. Set the Configuration to All Configurations and Platform to All Platforms (top of the popup window)
  6. Navigate to C/C++ -> General in the dialog sidebar, then edit Additional Include Directories. Change the two items so that they point to your wxWidgets\include\msvc\ and your wxWidgets\include\ Include path configuration
  7. Change Platform to Win32. Then navigate to Linker -> General and edit Additional Library Directories. Change the one item to your wxWidgets\lib\vc_lib 32 bit library configuration
  8. Change Platform to x64. Then navigate to Linker -> General and edit Additional Library Directories. Change the one item to your wxWidgets\lib\vc_x64_lib 64 bit library configuration
  9. Follow the instructions on Building the Projects.
  10. 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

  1. Open makefile
  2. 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
  1. Save changes to makefile, then open setup-linux.sh
  2. 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
  1. Save changes to setup-linux.sh, then run make 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.