[fdo-commits] r2691 - trunk/Fdo/Python

svn_fdo at osgeo.org svn_fdo at osgeo.org
Mon Mar 19 15:07:26 EDT 2007


Author: gregboone
Date: 2007-03-19 15:07:26 -0400 (Mon, 19 Mar 2007)
New Revision: 2691

Added:
   trunk/Fdo/Python/Makefile
   trunk/Fdo/Python/build_linux.sh
Log:
Ticket #39: Add Linux Makefile Support -- Work In Progress

Added: trunk/Fdo/Python/Makefile
===================================================================
--- trunk/Fdo/Python/Makefile	                        (rev 0)
+++ trunk/Fdo/Python/Makefile	2007-03-19 19:07:26 UTC (rev 2691)
@@ -0,0 +1,128 @@
+##
+## Copyright (C) 2004-2006  Autodesk, Inc.
+## 
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of version 2.1 of the GNU Lesser
+## General Public License as published by the Free Software Foundation.
+## 
+## This library 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
+## Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+
+# Filename: Makefile
+#
+# Usage:    make [clean]
+#
+# Description: Compiles and links the Linux version of the FDO wrappers.  This script assumes
+#              that the following software packages are installed:
+#              - SWIG 1.3.x
+#              - Python 2.4
+#
+#              Once the build is completed, the generated files (_FDO.so and FDO.py)
+#              are copied to /usr/local/fdo-3.3.0/lib.
+#
+# Parameters:  clean
+#              Optional input.  Deletes all object files and output files
+#              install
+#              Optional input.  Copies output files to /usr/local/fdo-3.3.0/lib
+#              uninstall
+#              Optional input.  Deletes output files from /usr/local/fdo-3.3.0/lib
+#
+# ------------------------------------------------------------------------------
+# ATTENTION: Edit the following variables to match your environment.
+# ------------------------------------------------------------------------------
+
+# C++ compiler
+CC=g++
+
+# Target directory where the final shared library will be placed
+TARGET_DIR=/usr/local/fdo-3.3.0/lib
+
+# Location of the FDO header files.
+FDO_INCLUDE_PATH=$(FDO)/Unmanaged/Inc
+
+# Location of the FDO library files.
+FDO_LIB_PATH=$(FDO)/Unmanaged/Src
+
+# Additional Libraries
+LIB = \
+-L$(TARGET_DIR) \
+-L$(PYTHON_LIB_PATH)/config \
+-lFDO \
+-lpython2.4 \
+-lutil
+
+# Include directories.  
+# Intentionally include the FDO header files FIRST.
+# This will prevent GCC from seeing the overriding header files in ./Inc, which
+# are for Windows ONLY
+INC = -I$(FDO_INCLUDE_PATH) -I$(PYTHON_INCLUDE_PATH) -I./ -I./Inc 
+
+# Compiler and linker flags
+CFLAGS = -DFULLPROTO -D__USE_GNU -DLINUX
+LFLAGS = -fPIC -shared -Wl,-rpath,$(FDO_LIB_PATH)
+
+# C/C++ Source Files
+CSRC = \
+Src/Common/utils.cpp \
+Src/Common/FdoProxyConnectionManager.cpp \
+Src/Fdo/FdoWrapper.cpp \
+Src/Common/StringBuffer.cpp
+
+CSRC-OBJ = $(notdir $(patsubst %.cpp,%.o,$(CSRC)))	
+
+# SWIG Interface files
+SWIGSRC = \
+Swig/Fdo/Main.i \
+Swig/Fdo/FdoTypemaps.i \
+Swig/Fdo/FdoPointercasts.i \
+Swig/Fdo/GeometryIncludes.i \
+Swig/Fdo/CommonIncludes.i \
+Swig/Fdo/FdoIncludes.i \
+Swig/Common/CommonExceptions.i \
+Swig/Common/CommonInit.i \
+Swig/Common/CommonTypemaps.i
+
+all: sharedlib
+	@echo "Make completed."
+
+sharedlib: objs
+	@echo "Linking..."
+	@$(CC) $(LFLAGS) -o _FDO.so $(CSRC-OBJ) $(LIB)
+
+objs: swig_release $(CSRC)
+	@echo "Compiling wrapper source..."
+	@$(CC) $(INC) $(CFLAGS) -c $(CSRC)
+	@echo "Finished compiling"
+
+# Execute swig command, suppress known warning messages
+swig_release: $(SWIGSRC)
+	@echo "Generating python wrapper code with SWIG..."
+	@swig -c++ -python -I./Swig -I./Inc -I./Inc_Merged -I./Inc_Merged/Common/Io -ignoremissing -nodefault -module FDO -w201 -w389 -w319 -w312 -w361 -w401 -o Src/Fdo/FdoWrapper.cpp Swig/Fdo/Main.i
+
+# Execute swig command, and display all warning messages
+swig_verbose: $(SWIGSRC)
+	@echo "Generating python wrapper code with SWIG..."
+	@swig -c++ -python -I./Swig -I./Inc -I./Inc_merged -I./Inc_Merged/Common/Io -ignoremissing -nodefault -module FDO -o Src/Fdo/FdoWrapper.cpp Swig/Fdo/Main.i
+
+clean:
+	@rm -f $(CRC_OBJ)
+	@rm -f Src/Fdo/FDO.py
+	@rm -f Src/Fdo/FdoWrapper.cpp
+	@rm -f *.o
+	@rm -f _FDO.so
+
+install:
+	cp Src/Fdo/FDO.py $(TARGET_DIR)
+	cp _FDO.so $(TARGET_DIR)
+
+uninstall:
+	@rm -f $(TARGET_DIR)/FDO.py
+	@rm -f $(TARGET_DIR)/_FDO.so
+

Added: trunk/Fdo/Python/build_linux.sh
===================================================================
--- trunk/Fdo/Python/build_linux.sh	                        (rev 0)
+++ trunk/Fdo/Python/build_linux.sh	2007-03-19 19:07:26 UTC (rev 2691)
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+##
+## Copyright (C) 2004-2006  Autodesk, Inc.
+## 
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of version 2.1 of the GNU Lesser
+## General Public License as published by the Free Software Foundation.
+## 
+## This library 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
+## Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+##
+
+# Filename: build_linux.sh
+#
+# Usage:    ./build_linux.sh
+#
+# Description: Build the Linux version of the Python wrappers for FDO
+#              This script assumes that the following software packages are installed:
+#              - SWIG 1.3.24
+#              - Python 2.4
+
+#
+# GLOBALS
+#
+
+#
+# Merge the standard FDO header file (found in /usr/local/fdo-3.3.0/include/)
+# with the local 'overriding' header files (found in ./Fdo_Inc).  The merged
+# files will be put in ./Inc_Merged
+#
+echo "Creating the ./Inc_Merged directory...";
+rm -rf ./Inc_Merged >& /dev/null
+if [ $? -ne 0 ]
+then
+	echo "Error: Cannot delete ./Inc_merged.";
+	echo "Exiting.";
+	exit 1;
+fi
+
+mkdir Inc_Merged >& /dev/null
+if [ $? -ne 0 ]
+then
+	echo "Error: Unable to mkdir Inc_Merged.";
+	echo "Exiting.";
+	exit 1;
+fi 	
+
+cp -R $FDO/Unmanaged/Inc/* ./Inc_Merged/. >& /dev/null
+if [ $? -ne 0 ]
+then
+	echo "Error: Unable to copy $FDO/Unmanaged/Inc to ./Inc_Merged";
+	echo "Exiting.";
+	exit 1;
+fi
+
+chmod -R +w ./Inc_Merged/* >& /dev/null
+if [ $? -ne 0 ]
+then
+	echo "Error: Unable to chmod 644 on ./Inc_Merged/*";
+	echo "Exiting.";
+	exit 1;
+fi
+
+cp -R ./Fdo_Inc/* ./Inc_Merged/. >& /dev/null
+if [ $? -ne 0 ]
+then
+	echo "Error: Unable to copy ./Fdo_Inc/. to ./Inc_Merged";
+	echo "Exiting.";
+	exit 1;
+fi
+
+
+#
+# Execute the makefiles to build the wrappers
+#
+pushd . >& /dev/null
+echo "Building FDO wrappers for Python.  This will take a few minutes..."
+
+#
+# List of Makefiles.  If you have a new provider makefile, add it here.
+#
+makeFileNames=(Makefile) 
+
+#
+# Execute each makefile
+#
+for makeFileName in ${makeFileNames[@]}; do
+	echo "Running make on '$makeFileName'..."
+	make -f $makeFileName
+	make -f $makeFileName install
+	if [ $? -ne 0 ]
+	then
+		echo "Error: Building Makefile '$makeFileName' failed.";
+		echo "Exiting.";
+		exit 1;
+	fi
+done
+
+popd >& /dev/null
+
+echo "Script completed."


Property changes on: trunk/Fdo/Python/build_linux.sh
___________________________________________________________________
Name: svn:executable
   + *



More information about the fdo-commits mailing list