######################################################################### #################### LogiLogi.org Make LakeUsr Lib ###################### ######################################################################### ######## Copyright (C) 2004 Wybo Wiersma ######## ######################################################################### # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ######################################################################### ### The lakeUsr library... ### The lakeUsr library contains a lot of easy functions for direct use in a lakefile. These functions are all listed and concisely described below. LakeUsr builds upon the lakeExtend library (README.EXTEND.txt). It is split up in four sub-libraries lakeUsrFun (the user functions and the initLakeUsr function), lakeUsrShareInit (the initialization- classes and the classes sharing global variables), lakeUsrTask (the task functions (NOT the RunFuns) and the classes inheriting from Task), lakeUsrTaskRunFun (the replacable RunFun's, classes inheriting from the class RunFun). ### The lakeUsr functions ### initLakeUsr(); Initializes the lakeUsr library. Must be called before lakeUsr is used (this is done by default in the .lake/partsrc/lake.head.7.init.cc source) # Calls the taskprocessor (normally ran in run-part of .lake/partsrc # files) processTasks(); Sorts and runs the tasks specified upto that point. Each task has a runRank, between runRanks tasks are ran in the order specified. Tasks having runRanks that are "absolute" are ran after the items specified before it and before the items specified after it. # Easy build, install & clean task-commands (see below for Lib-usage & # arguments) lakeBuild(std::string const & sourcesToBuild, std::string const & intoExecutable); Builds the sources in sourcesToBuild into the executable named intoExecutable lakeBuildSLib(std::string const & sourceDir); lakeBuildSLib(std::string const & sourceDir, std::string const & libName); Builds static libraries where (1st function) the library-name defaults to the leaf (deepest sub-dir, a/b/c, the leaf is c) of the sourceDir or (2nd function) it is specified as libName lakeInstallSLib(std::string const & sourceDir, std::string const & libToDir, std::string const & libsHdrsToDir); lakeInstallSLib(std::string const & sourceDir, std::string const & libToDir, std::string const & libsHdrsToDir, std::string const & libName); Installs a static library from sourceDir into libToDir (the .a file) and into libsHdrsToDir (the header-file). The libName defaults to the leaf, just like in lakeBuildSLib if it is not provided. lakeClean(std::string const & dirTreeToCleanFrom); Cleans all .a and .o files and any .o/ (buildDirSuff) subdirs found within dirTreeToCleanFrom. # Normal build, install & clean task-commands (see below for Lib-usage & # arguments) build(std::string const & sourcesToBuild, std::string const & buildDir, std::string const & intoExecutable); Builds sourcesToBuild using buildDir into intoExecutable buildSLib(std::string const & sourceDir, std::string const & buildDir, std::string const & libName); Builds the static library libName in sourceDir using buildDir installSLib(std::string const & sourceDir, std::string const & buildDir, std::string const & libToDir, std::string const & libsHdrsToDir, std::string const & libName); Installs the static library libName from sourceDir (the header) and buildDir (the .a file) into libToDir (the .a file) resp. libsHdrsToDir (the header file) extClean(std::string const & dirTreeToCleanFrom, std::string const & extToClean); Deletes all files that have the extension extToClean found in dirTreeToCleanFrom purgeDir(std::string const & dirTreeToPurge); Deletes (rm -rf) all files and directories in the dirTreeToPurge directory and the dirTreeToPurge dir itself runCommand(std::string const & commandToRun); Runs the command commandToRun. The runRank (order at which it is ran) of this task is "absolute" by default (meaning that it is ran at the place specified, not after tasks specified after it and not before tasks specified before it) uninstallFile(std::string const & dirFileToUninstall); Deletes the file with name dirFileToUninstall # Lib usage commands useLib(std::string const & libToAdd); Specifies that a library is added using (by default for g++) the -l option useLibDir(std::string const & libDirToAdd); Uses that dir with the -L option (a dir where libraries are to be looked for when linking) useLibIncDir(std::string const & libIncDirToAdd); Specifies the dir where to look for library headers (-I option) addCompileArgs(std::string const & extraCompilePreArgs, std::string const & extraCompilePostArgs = ""); Adds default compile-arguments before and if specified after the normal -c and -o etc... sequence. addCompilePostArgs(std::string const & extraCompilePostArgs); Same as above but only after the sequence addLinkArgs(std::string const & extraLinkPreArgs, std::string const & extraLinkPostArgs = ""); Adds default link-arguments before and if specified after the normal link sequence. addLinkPostArgs(std::string const & extraLinkPostArgs); Same as above but only after the sequence addSLibPackArgs(std::string const & extraSLibPackPreArgs, std::string const & extraSLibPackPostArgs = ""); Adds default link-arguments before and if specified after the normal static library-packing (ar) sequence. addSLibPackPostArgs(std::string const & extraSLibPackPostArgs); Same as above but only after the sequence # Configuration setting, getting and setting (values) setConf(std::string const & settingName, std::string const & settingValue); Sets settingName to settingValue. Add e_ in front of the settings name to add settings that are not available in the default ConfigStore (./lake/config/config.txt contains them all) getConf(std::string const & settingName); Gets the value of a setting (the getConf class is a string) setBuildDirSuffix(std::string const & buildDirSuffix); Sets the buildDirSuffix # Configuragion storing, restoring (copy paste) storeConfig(std::string const & label = ""); Temporarily stores the current config behind the label for later restoring restoreConfig(std::string const & label = ""); Restores a config that was stored using the function above saveConfig(std::string const & label = ""); Saves a config to disk (in the .lake/data dir) under the label label (config..