CMakeLists.txt 2.39 KB
Newer Older
1 2 3 4
PROJECT(lis)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

5
include_directories(src)
6

7
# Find necessary packages
8

9 10
find_package(GDAL REQUIRED)

11

Manuel Grizonnet's avatar
Manuel Grizonnet committed
12 13 14 15
if(NOT GDAL_FOUND)
 message(FATAL_ERROR "Cannot find GDAL. Set GDAL_INCLUDE_DIR and GDAL_LIBRARY")
endif()

16 17 18 19 20 21 22 23 24 25 26 27 28 29
if (GDAL_CONFIG) 
  ## extract gdal version 
  exec_program(${GDAL_CONFIG}
    ARGS --version
    OUTPUT_VARIABLE GDAL_VERSION )
  string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
  string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
  
  #MESSAGE("DBG GDAL_VERSION ${GDAL_VERSION}")
  #MESSAGE("DBG GDAL_VERSION_MAJOR ${GDAL_VERSION_MAJOR}")
  #MESSAGE("DBG GDAL_VERSION_MINOR ${GDAL_VERSION_MINOR}")
  
  # check for gdal version
  if (GDAL_VERSION_MAJOR LESS 2)
30
    message (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.1 or higher.")
31 32 33
  endif ()
endif()

34 35 36
#Set python home (needed on the cnes cluster)
set(PYTHON_INCLUDE_DIRS $ENV{PYTHONHOME}/include)

37 38
find_package(PythonInterp REQUIRED)

39
find_package( PythonLibs 2.7 REQUIRED)
40 41 42
include_directories( ${PYTHON_INCLUDE_DIRS} )
 
find_package( Boost COMPONENTS python REQUIRED )
43

44 45
include_directories( ${Boost_INCLUDE_DIR} )

46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
# Link to the Orfeo ToolBox
FIND_PACKAGE(OTB)
IF(OTB_FOUND)
  INCLUDE(${OTB_USE_FILE})
ELSE(OTB_FOUND)
  MESSAGE(FATAL_ERROR
          "OTB not found. Please set OTB_DIR")
ENDIF(OTB_FOUND)


# Output directories
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all ARCHIVE products (static libs, import libs)")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all LIBRARY products (so, modules)")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${lis_BINARY_DIR}/bin CACHE INTERNAL "Single output directory for all RUNTIME products (executables, dlls)")

# Install dirs
if(NOT lis_INSTALL_BIN_DIR)
  set(lis_INSTALL_BIN_DIR "bin")
endif(NOT lis_INSTALL_BIN_DIR)

if(NOT lis_INSTALL_LIB_DIR)
  set(lis_INSTALL_LIB_DIR "lib")
endif(NOT lis_INSTALL_LIB_DIR)

if(NOT lis_INSTALL_INCLUDE_DIR)
  set(lis_INSTALL_INCLUDE_DIR "include")
endif(NOT lis_INSTALL_INCLUDE_DIR)

SET(BUILD_SHARED_LIBS ON)

76
add_subdirectory(src)
77
add_subdirectory(python)
78
add_subdirectory(app)
79 80
# Add Testing subdirectory
option(BUILD_TESTING  "Build testing." OFF)
81

82
if(BUILD_TESTING)
83 84
    ENABLE_TESTING()
    INCLUDE(Dart)
85 86
    add_subdirectory(test)
endif()