diff --git a/client.pro b/client.pro index fb6ec2edd..eee2b9360 100644 --- a/client.pro +++ b/client.pro @@ -20,6 +20,8 @@ WITH_SAMPLES = ON #WITH_UNITTESTS = ON +#WITH_DOXYGEN = ON + equals(WITH_BLACKMISC, ON) { SUBDIRS += src/blackmisc @@ -62,5 +64,6 @@ equals(WITH_UNITTESTS, ON) { SUBDIRS += } - - +equals(WITH_DOXYGEN, ON) { + SUBDIRS += docs/doxygen.pro +} diff --git a/docs/doxygen.pro b/docs/doxygen.pro new file mode 100644 index 000000000..48b0e7e03 --- /dev/null +++ b/docs/doxygen.pro @@ -0,0 +1,49 @@ +# Copyright (C) 2013 VATSIM community / contributors +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/ +# +# Black magic to get qmake to generate a build target to process the file +# Doxyfile.cmake.in and then invoke doxygen. + +TEMPLATE = lib +CONFIG += staticlib +CONFIG -= qt + +COPY_FILES += qconfigure.pl +CONFIGURE_IN += Doxyfile.cmake.in +DOXYFILE = Doxyfile + +defineReplace(qconfigureReplace) { + file = $$1 + file = $$basename(file) + file = $$replace(file, .cmake.in, ) + return($$file) +} + +win32: copy.commands = copy ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} +else: copy.commands = cp ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} +copy.CONFIG = no_link +copy.input = COPY_FILES +copy.output = ${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT} +copy.name = COPY +QMAKE_EXTRA_COMPILERS += copy + +qconfigure.commands = perl qconfigure.pl ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} \ + CMAKE_CURRENT_BINARY_DIR=$$OUT_PWD \ + CMAKE_CURRENT_SOURCE_DIR=$$PWD +qconfigure.CONFIG = no_link +qconfigure.depends = qconfigure.pl +qconfigure.input = CONFIGURE_IN +qconfigure.name = QCONFIGURE +qconfigure.output_function = qconfigureReplace +QMAKE_EXTRA_COMPILERS += qconfigure + +DOXY_INPUT = . +doxy.commands = doxygen $$DOXYFILE +doxy.CONFIG = no_link +doxy.depends = $$DOXYFILE +doxy.input = DOXY_INPUT +doxy.name = DOXY +doxy.output = .nothing +QMAKE_EXTRA_COMPILERS += doxy \ No newline at end of file diff --git a/docs/qconfigure.pl b/docs/qconfigure.pl new file mode 100644 index 000000000..95c2b8373 --- /dev/null +++ b/docs/qconfigure.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl +# +# Copyright (C) 2013 VATSIM community / contributors +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/ +# +# Script used by the qmake project file doxygen.pro to process the file +# Doxyfile.cmake.in + +use strict; +use warnings; + +die "not enough arguments\n" if @ARGV < 2; + +my ($infile, $outfile, @vars) = @ARGV; + +my %vars; +for my $line (@vars) +{ + my ($var, $val) = split '=', $line; + $vars{$var} = $val; + + die "missing '=' in parameter\n" unless defined $val; +} + +$infile =~ s.\\./.g; +$outfile =~ s.\\./.g; + +open my $in, '<', $infile or die "couldn't read from $infile\n"; +open my $out, '>', $outfile or die "couldn't write to $outfile\n"; + +while (defined(my $line = <$in>)) +{ + for my $var (keys %vars) + { + $line =~ s.\@$var\@.$vars{$var}.g; + } + print $out $line; +} + +close $in; +close $out; \ No newline at end of file