Monday, April 1, 2013

Build libLAS for Windows 64 bit with GDAL and GeoTIFF support


In order to build 64 bit Windows binaries of liblas, the header files and 64 bit binaries for Boost must be accessible by Microsoft Visual Studio. The CMake utility from http://www.cmake.org needs to be used to configure and generate the Microsoft Visual Studio project files for liblas. The following illustrates how I build the liblas 64 bit binaries with GDAL and GeoTIFF support. Note that the 64-bit executables may not run successfully even though the compilation is successful depending on how the source code was written.
  1. Download the latest liblas source code from http://www.liblas.org/download.html. Extract the files to a folder e.g. E:\Work\src\liblas-1.7.0\.
  2. On the Windows Desktop, select Start | All Programs | CMake 2.8 | CMake (cmake-gui).

    The CMake application appears.
  3. In the Where is the source code field, click Browse Source.

    The Browse for Folder dialog box appears.
  4. Select the folder where the liblas archive was extracted, e.g. E:\Work\src\libLAS-1.7.0\. Click OK.
  5. In the Where to build the binaries field, click Browse Build.

    The Browse for Folder dialog box appears.
  6. Select or create the folder where the Microsoft Visual Studio solution project files will be created e.g. E:\Work\src\libLAS-1.7.0\bin\. Click OK.

  7. Click Configure.

    A prompt appears.
  8. In the combo box, choose a generator for this project e.g. Visual Studio 10 Win64. Click Finish.

    A Error message appears.
  9. Close the message.

  10. In the list box, select Boost_INCLUDE_DIR. Then click the browse [...] button.

    The Browse For Folder dialog box appears.
  11. Choose the root folder containing Boost e.g. E:\Work\src\boost_1_52_0\. Click OK.

    Note: the boost folder containing the header include files should be underneath the root folder.
  12. Click Configure again.

    The configuration files are created.
  13. Toggle on WITH_GDAL and WITH_GEOTIFF. Click Configure.

    An error message appears.
  14. Close the message. Select GDAL_INCLUDE_DIR. Click the browse [...] button.

    The Browse for Folder dialog box appears.
  15. Select the folder containing the GDAL header include files e.g. E:\Work\src\gdal-1.9.2\gcore\. Click OK.
  16. Select GDAL_LIBRARY. Click the browse [...] button.

    The Select File for GDAL_LIBRARY dialog box appears.
  17. Select the GDAL library e.g. E:\Work\src\gdal-1.9.2\gdal_i.lib. Click Open.
  18. Click GEOTIFF_INCLUDE_DIR. Click the browse [...] button.

    The Browse for Folder dialog box appears.
  19. Select the folder containing the libGeotiff header files e.g. E:\Work\src\libgeotiff-1.4.0\. Click OK.
  20. Select GEOTIFF_LIBRARY. Click the browse [...] button.

    The Select File for GEOTIFF_LIBRARY dialog box appears.
  21. Choose the GEOTIFF library file e.g. E:\Work\src\libgeotiff-1.4.0\geotiff_i.lib. Click Open.
  22. Click Generate.

    An error message appears.
  23. Close the message. Click TIFF_INCLUDE_DIR. Click the browse [...] button.

    The Browse for Folder dialog box appears.
  24. Select the folder containing the TIFF header files e.g. E:\Work\src\tiff-4.0.3\libtiff\. Click OK.
  25. Click TIFF_LIBRARY. Click the browse [...] button.

    The Select File for TIFF_LIBRARY dialog box appears.
  26. Select the TIFF library file e.g. E:\Work\src\tiff-4.0.3\libtiff\libtiff_i.lib. Click Open.
  27. Click Generate.

    The Microsoft Visual Studio project files are generated the specified destination build folder.
  28. Close CMake.
  29. Run Microsoft Visual Studio 2010. Open up the libLAS.sln file.
  30. Press F7 to build all the projects.

    Note: it might be necessary to add in the paths to the include files if the compiler cannot locate them in the build process.

    The 64 bit liblas binaries are generated.

No comments:

Related Posts with Thumbnails