message(FATAL_ERROR "Required library ${PREFIX} NOT FOUND.\nInstall the library (dev version) and try again. If the library is already installed, use ccmake to set the missing variables manually.")
print"Platform not recognized (did not match linux or darwin)"
print"Script doesn't download dependencies for this platform"
raiseSystemExit
defpackage_source():
install_build(cmakecall,exitVal=False)
subprocess.check_call(["make","package_source"])
raiseSystemExit
defpackage():
install_build(cmakecall,exitVal=False)
subprocess.check_call(["make","package"])
raiseSystemExit
defremake():
ifnotos.path.isdir(build_dir):
print"Directory '%s' does not exist"%build_dir
print"You must make before you can remake."
return1
os.chdir(build_dir)
subprocess.check_call(["make",makeargs])
raiseSystemExit
defclean():
if'posix'inos.name:
print"Cleaning '%s' with rm -rf"%build_dir
subprocess.check_call(["rm","-rf",build_dir])
else:
print"Cleaning '%s' with shutil.rmtree()"%build_dir
print"(may be very slow)"
shutil.rmtree(build_dir,ignore_errors=True)
print"Build cleaned"
# requires PROFILE definition in CMakeLists.txt:
# set(CMAKE_BUILD_TYPE PROFILE)
# set(CMAKE_CXX_FLAGS_PROFILE "-g -pg")
# set(CMAKE_C_FLAGS_PROFILE "-g -pg")
defprofile():
cmakecall.insert(1,"-DDEV_MODE::bool=TRUE")
cmakecall.insert(2,"-DBUILD_TYPE=PROFILE")
install_build(cmakecall)
defmenu():
print"1. developer build: used for development."
print"2. install build: used for building before final installation to the system."
print"3. grab dependencies: installs all the required packages for debian based systems (ubuntu maverick/ debian squeeze,lenny) or darwin with macports."
print"4. package source: creates a source package for distribution."
print"5. package: creates binary packages for distribution."
print"6. remake: calls make again after project has been configured as install or in source build."
print"7. clean: removes the build directory."
print"8. profile: compiles for gprof."
print"9. end."
opt=raw_input("Please choose an option: ")
returnopt
try:
loop_num=0
# continues until a function raises system exit or ^C
while(1):
iflen(args)==1andloop_num==0:
opt=args[0]
loop_num+=1
else:
opt=menu()
try:
opt=int(opt)
exceptValueError:
pass
ifopt==1:
print"You chose developer build"
dev_build()
elifopt==2:
print"You chose install build"
install_build(cmakecall)
elifopt==3:
print"You chose to install dependencies"
grab_deps()
elifopt==4:
print"You chose to package the source"
package_source()
elifopt==5:
print"You chose to package the binary"
package()
elifopt==6:
print"You chose to re-call make on the previously configured build"
remake()
elifopt==7:
print"You chose to clean the build"
clean()
elifopt==8:
# requires definition in CMakeLists.txt (see def above)
git is a distributed version control system (DVCS). Version control is useful for software development for many reasons. Each version, or commit, acts as history of the software. If something breaks, it is easy to go back to a previous version that worked. git is also very useful for writing software as a team. Each commit is labeled with an author, so other authors can see who made what change.
git can be used in a variety of ways, but in this lab, we use a simple setup. The main, shared code is stored on either github (public, for open source projects), bitbucket (private), or our lab server (for projects that cannot be online). These repositories are considered "origin master". Users use the 'clone' command once to make a local copy of the repository, 'pull' to get updated changes, and 'commit' and 'push' to contribute their changes.
Following is a list of basic commands for git.
## Initial setup ##
To fetch a project for the first time (aka clone a repository):
_substitute appropriate address_
```console
git clone git@github.com:jgoppert/jsbsim.git
cd jsbsim
```
To setup your username and password (so everyone knows who did such great work!):
A few basic Unix commands are all that is necessary to be able to work with files.
First, all of these commands must be typed into the Terminal. Its icon is a black square with '>_' in white. On Debian, it is located at Applications > Accessories > Terminal. After typing the command, press Enter.
'ls' lists the files in the current directory. The '-al' option shows hidden files and shows extra information in a list (directories have a d in front of them). Specifying a path will show the files in that directory.
```console
ls
ls -al
ls -al Projects
```
'pwd' shows the absolute path to the current directory.
```console
pwd
```
'cd' means change directory. It can be used in several ways.
Used alone, it moves to the home directory of the current user. This is useful if you are looking at files somewhere else and need to go back to the home directory without typing the whole path.
```console
cd
```
If there are directories inside the current directory (use 'ls -al', directories have d in front of them), you can move to them with a relative path:
```console
cd Projects/jsbsim
```
If you want to move to a directory *outside* of the current directory, use an absolute path (the same thing that would be returned by 'pwd', notice that it begins with a slash):
```console
cd /usr/local
```
Another important symbol is the tilde (~), which means the home directory of the current user (the same place 'cd' will move to):
```console
cd ~/Projects/jsbsim
```
'cp' is copy and 'mv' is move, which is also used to rename files.
To move a file from the current directory into the directory 'src/':