Thursday, September 10, 2015

wxWidgets 3.0

To add the repository, first import the key:
sudo apt-key adv --fetch-keys http://repos.codelite.org/CodeLite.asc
 
Then add the source:


sudo tee /etc/apt/sources.list.d/wxwidgets.list
deb http://repos.codelite.org/wx3.0.2/ubuntu/  $(lsb_release -sc) universe
sudo apt-get update

Install wxWidgets modules:

sudo apt-get install libwxbase3.0-0-unofficial libwxbase3.0-dbg libwxbase3.0-dev libwxgtk3.0-0-unofficial libwxgtk3.0-dbg wx3.0-doc wx3.0-examples 

Create soft-link:
sudo ln -s /usr/include/wx-3.0-unofficial/wx /usr/include/wx 
To compile a single file, create a script named wxcompile and edit it with the content as below (assume with have subdirectory obj/Debug and bin/Debug:

#!/bin/bash

if [ -z "${1}" ]
then
    echo "$0 "
    exit 1
fi

FILE=`basename $1`
CPPF=$FILE
OBJF=`basename -s .cpp $CPPF`
OBJF=${OBJF}.o
g++ -g -c -Wall -DWX_PRECOMP -Winvalid-pch `wx-config --cppflags` -o obj/Debug/${OBJF} ${CPPF}


To link, create a script file name 'wxlink' and its content as below:



#!/bin/bash

if [ -z "${1}" ]
then
    echo "$0 "
    exit 1
fi

FOUT=$1
OBJF=obj/Debug/*.o

g++ -v obj/Debug/*.o `wx-config --libs` -o obj/Debug/$FOUT

For a bigger project which requires more complicated and conditional compilation, use Makefile.

No comments:

Post a Comment