[Liblas-commits] r1140 - in trunk: . apps

liblas-commits at liblas.org liblas-commits at liblas.org
Wed Mar 25 07:14:43 EDT 2009


Author: mloskot
Date: Wed Mar 25 07:14:43 2009
New Revision: 1140
URL: http://liblas.org/changeset/1140

Log:
nmake.opt: Added support of EXT_NMAKE_OPT for building libLAS with NMAKE (Ticket #117). Improved detection of GDAL_HOME and GEOTIFF_HOME - check if directories exist. Added auto-magical determination of version of Visual C++ compiler based on NMAKE version (see WARNING in NMAKE).

Modified:
   trunk/apps/makefile.vc
   trunk/nmake.opt

Modified: trunk/apps/makefile.vc
==============================================================================
--- trunk/apps/makefile.vc	(original)
+++ trunk/apps/makefile.vc	Wed Mar 25 07:14:43 2009
@@ -30,7 +30,7 @@
 	$(CC) $(CFLAGS) txt2las.c lascommon.c $(LAS_ROOT)/src/$(LAS_LIB_DLL) $(GEOTIFF_LIB)
 	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1
 
-!IF DEFINED(GDAL_HOME)
+!IF "$(GDAL_HOME)" != "" && EXIST("$(GDAL_HOME)")
 las2ogr.exe:
 	$(CC) $(CFLAGS) las2ogr.cpp $(LAS_ROOT)/src/$(LAS_LIB_DLL) $(GDAL_LIB) ..\src\$(LAS_LIB)
 	if exist $@.manifest mt -manifest $@.manifest -outputresource:$@;1

Modified: trunk/nmake.opt
==============================================================================
--- trunk/nmake.opt	(original)
+++ trunk/nmake.opt	Wed Mar 25 07:14:43 2009
@@ -2,10 +2,20 @@
 #
 # nmake.opt - main configuration file for NMAKE makefiles
 #
-# Set BUILD_DEBUG balue to YES if you want to make debug build
-# and to prepare not optimized binaries.
-BUILD_DEBUG = NO
+!MESSAGE *** libLAS Build Configuration ***
+!INCLUDE <ntwin32.mak>
+
+###############################################################################
+# For convenience, user may put custom settings to private mynmake.opt
+# and use EXT_NMAKE_OPT option while calling nmake.exe, as follows:
+#
+# nmake -f makefile.vc EXT_NMAKE_OPT=mynmake.opt
+!IFDEF EXT_NMAKE_OPT
+!MESSAGE *** Setting EXT_NMAKE_OPT $(EXT_NMAKE_OPT)
+!INCLUDE $(EXT_NMAKE_OPT)
+!ENDIF
 
+###############################################################################
 # libLAS package settings
 
 LAS_LIB = liblas.lib
@@ -15,30 +25,60 @@
 # only used for filenames of packages
 PACKAGE_VERSION = 1.2.0b3
 
+!MESSAGE *** Setting PACKAGE_VERSION $(PACKAGE_VERSION)
+
+###############################################################################
+# Set BUILD_DEBUG balue to YES if you want to make debug build
+# and to prepare not optimized binaries.
+!IFNDEF BUILD_DEBUG 
+BUILD_DEBUG = NO
+!ENDIF
+
+!MESSAGE *** Setting BUILD_DEBUG $(BUILD_DEBUG)
+
+###############################################################################
+# libLAS include directories
 INCLUDES = -I$(LAS_ROOT)/include -I$(LAS_ROOT)/include/liblas/capi
 
+!MESSAGE *** Setting libLAS INCLUDE to -I$(LAS_ROOT)/include -I$(LAS_ROOT)/include/liblas/capi
+
+###############################################################################
 # GeoTIFF Support
 # Uncomment the folling line to build GeoTIFF support for reading and
 # writing LAS files with Coordinate Systems information.  
 # comment out GEOTIFF_HOME if you are building against a GDAL source tree
 
-GEOTIFF_HOME=C:\osgeo4w
+!IFNDEF GEOTIFF_HOME
+GEOTIFF_HOME=C:\OSGeo4W
+!ENDIF
+
+!IF "$(GEOTIFF_HOME)" != "" && EXIST("$(GEOTIFF_HOME)")
+!MESSAGE *** GeoTIFF support enabled
+!MESSAGE *** Setting GEOTIFF_HOME $(GEOTIFF_HOME)
 
-!IFDEF GEOTIFF_HOME
 GEOTIFF_LIB = $(GEOTIFF_HOME)\lib\geotiff_i.lib
 GEOTIFF_INCLUDE = -I$(GEOTIFF_HOME)\include
 INCLUDES = $(INCLUDES) $(GEOTIFF_INCLUDE)
+
+!ELSE
+GEOTIFF_HOME=""
+!MESSAGE *** Support of GeoTIFF has been disabled (GEOTIFF_HOME not set)
 !ENDIF
 
+###############################################################################
 # GDAL/OGR Support
-# Uncomment the folling line to build OGR support for 
-# the las2ogr command
-#GDAL_HOME=C:\osgeo4w
-
+# Uncomment the folling line to build OGR support for the las2ogr command
 #USE_GDAL_SOURCE_TREE=YES
 #GDAL_HOME=C:\cvs\buildkit\gdal
 
-!IFDEF GDAL_HOME
+!IFNDEF GDAL_HOME
+GDAL_HOME=C:\OSGeo4W
+!ENDIF
+
+!IF "$(GDAL_HOME)" != "" && EXIST("$(GDAL_HOME)")
+!MESSAGE *** GDAL/OGR support enabled
+!MESSAGE *** Setting GDAL_HOME $(GDAL_HOME)
+
 GDAL_LIB = $(GDAL_HOME)\lib\gdal_i.lib
 GDAL_INCLUDE = -I$(GDAL_HOME)\include
 !IF "$(USE_GDAL_SOURCE_TREE)" == "YES"
@@ -47,17 +87,61 @@
 GEOTIFF_INCLUDE = -I$(GEOTIFF_HOME)\frmts\gtiff\libgeotiff
 !ENDIF
 INCLUDES = $(INCLUDES) $(GDAL_INCLUDE)
-!ENDIF
 
+!ELSE
+GDAL_HOME=""
+!MESSAGE *** Support of GDAL/OGR has been disabled (GDAL_HOME not set)
+!ENDIF
 
-# End of GeoTIFF Support
+###############################################################################
+# Distribution directories
 
 LAS_HOME=C:\cvs\liblas\trunk
 BINDIR=$(LAS_HOME)\bin
 OSGEO4W_DIR = $(LAS_HOME)\osgeo4w
 PYDLL_DIR = $(LAS_HOME)\python
 
+###############################################################################
+# Derive version of Visual C++ being used from NMAKE if not specified
+#
+# WARNING:
+# If we should expect variety of NMAKE build versions, tests below may fail
+# and we will need to fall back to setting MSVCVER as command line parameter.
+#
+!IF "$(_NMAKE_VER)" == ""
+MSVCVER = 4.0
+!ERROR *** Failed to determine version of Visual C++
+!ELSEIF "$(_NMAKE_VER)" == "162"
+MSVCVER = 5.0
+!ERROR *** Detected Visual C++ 5.0 - NOT SUPPORTED
+!ELSEIF "$(_NMAKE_VER)" == "6.00.8168.0"
+MSVCVER = 6.0
+!ERROR *** Detected Visual C++ 6.0 - NOT SUPPORTED
+!ELSEIF "$(_NMAKE_VER)" == "7.00.9466"
+MSVCVER = 7.0
+!ELSEIF "$(_NMAKE_VER)" == "7.10.3077"
+MSVCVER = 7.1
+!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.42"
+MSVCVER = 8.0
+!ELSEIF "$(_NMAKE_VER)" == "8.00.50727.762"
+MSVCVER = 8.0
+!ELSEIF "$(_NMAKE_VER)" == "9.00.30729.01"
+MSVCVER = 9.0
+!ELSE
+MSVCVER = 0.0
+!ENDIF
+
+!IF "$(MSVCVER)" == "0.0"
+!MESSAGE *** Cannot determined Visual C++ version
+!ERROR *** Aborting make job
+!ELSE
+!MESSAGE *** Using Microsoft NMAKE version $(_NMAKE_VER)
+!MESSAGE *** Using Microsoft Visual C++ version $(MSVCVER)
+!ENDIF
+
+###############################################################################
 # Compilation flags for Release and Debug modes
+
 !IF "$(BUILD_DEBUG)" == "YES"
 OPTFLAGS= /nologo /MDd /EHsc /Z7 /W4 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /DDEBUG /D_DEBUG /Fd$(LAS_ROOT)\las.pdb
 LAS_LIB = liblas_d.lib
@@ -72,20 +156,29 @@
 LAS_LIB_DLL = liblas_i.lib
 !ENDIF
 
-CFLAGS= $(OPTFLAGS) $(INCLUDES) 
+# Check if multiple process build available
+!IF "$(MSVCVER)" == "9.0"
+MPFLAGS=/MP
+!MESSAGE *** Using /MP flag with number of effective processors
+!ELSE
+MPFLAGS=""
+!ENDIF
+
+CFLAGS= $(MPFLAGS) $(OPTFLAGS) $(INCLUDES) 
 
-!IFDEF GEOTIFF_HOME
+!IF "$(GEOTIFF_HOME)" != "" && EXIST("$(GEOTIFF_HOME)")
 CFLAGS = $(CFLAGS) /DHAVE_LIBGEOTIFF=1
 !ENDIF
 
-!IFDEF GDAL_HOME
+!IF "$(GDAL_HOME)" != "" && EXIST("$(GDAL_HOME)")
 CFLAGS = $(CFLAGS) /DHAVE_GDAL=1
 !IF "$(USE_GDAL_SOURCE_TREE)" == "YES"
 CFLAGS = $(CFLAGS) /DHAVE_LIBGEOTIFF=1
 !ENDIF
 !ENDIF
 
-# End of compilation flags settings
+###############################################################################
+# Building toolset programs
 
 # Compiler executable
 CC = cl.exe


More information about the Liblas-commits mailing list