CMakeLists.txt 2.65 KB
Newer Older
1
2
3
set(SRC
  ncDataDz.cpp
  slimDate.cpp
4
  slimFunction.cpp
5
  slimGebco.cpp
6
  slimIterateHelper.cpp
7
8
9
10
  slimLonLat.cpp
  slimStructData.cpp
  slimTemporalSerie.cpp
  slimTpxo.cpp
11
  slimFES.cpp
12
  slimExportNetCDF.cpp
13
14
)

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
15
16
set(LIBS "")

17
18
19
20
21
22
option(ENABLE_NETCDF "Enable NETCDF" ON)
if(ENABLE_NETCDF)
  find_library (NETCDF_LIB netcdf)
  if (NETCDF_LIB)
    find_path (NETCDF_INC "netcdf.h" PATH_SUFFIXES include)
    if (NETCDF_INC)
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
23
24
      message("slimFunction configured with Netcdf")
      add_definitions("-DHAVE_NETCDF")
25
      include_directories(${NETCDF_INC})
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
26
      list(APPEND LIBS ${NETCDF_LIB})
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
27
      dg_add_swig_module(slimNetCDFWrap slimNetCDFWrap.i "dgSlimFunction")
28
29
30
31
    endif(NETCDF_INC)
  endif(NETCDF_LIB)
endif(ENABLE_NETCDF)

32
33
34
35
option(ENABLE_FES "Enable using FES tidal solution" ON)
if(ENABLE_FES)
  find_library (FES_LIB fes)
  if (FES_LIB)
36
37
    find_path(FES_INC "fes.h" PATH_SUFFIXES include)
    find_path(FES_DATA "fes.ini" PATH_SUFFIXES "share/fes_data" HINTS "${FES_INC}/../share/fes_data")
38
    if (FES_INC AND FES_DATA)
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
39
40
41
42
      message("slimFunction configured with FES")
      add_definitions("-DHAVE_FES")
      add_definitions("-DFES_DATA \"${FES_DATA}\"")
      list(APPEND LIBS ${FES_LIB})
43
      include_directories(${FES_INC})
44
    endif(FES_INC AND FES_DATA)
45
46
47
  endif(FES_LIB)
endif(ENABLE_FES)

Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
48
49
option(ENABLE_PROJ "Enable PROJ" ON)
if(ENABLE_PROJ)
50
51
52
53
54
55
56
57
58
  if(WIN32)
  set (PROJ_LIB ${CMAKE_CURRENT_BINARY_DIR}/libproj/build/lib/libproj_4_9.a)
    set(PROJ_FPIC "")
  else()
  set (PROJ_LIB ${CMAKE_CURRENT_BINARY_DIR}/libproj/build/lib/libproj.a)
    set(PROJ_FPIC -DCMAKE_C_FLAGS="-fPIC")
  endif(WIN32)
  ExternalProject_Add(
    libproj 
59
60
    URL http://download.osgeo.org/proj/proj-4.9.2.tar.gz
    URL_MD5 9843131676e31bbd903d60ae7dc76cf9
61
62
63
64
65
66
67
68
69
70
71
    PATCH_COMMAND ${CMAKE_COMMAND} -E remove <SOURCE_DIR>/nad/CMakeLists.txt
    INSTALL_COMMAND ""
    PREFIX libproj
    BINARY_DIR libproj/build
    CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -DBUILD_CS2CS=NO -DBUILD_PROJ=NO -DBUILD_GEOD=NO -DBUILD_NAD2BIN=NO -DPROJ4_TESTS=NO -DBUILD_LIBPROJ_SHARED=NO  ${PROJ_FPIC}
  )
  set (PROJ_INC ${CMAKE_CURRENT_BINARY_DIR}/libproj/src/libproj/src)
  message("slimFunction configured with PROJ")
  add_definitions("-DHAVE_PROJ")
  include_directories(${PROJ_INC})
  list(APPEND LIBS ${PROJ_LIB})
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
72
73
74
endif(ENABLE_PROJ)

dg_add_module(dgSlimFunction "${SRC}" "${LIBS}")
Jonathan Lambrechts's avatar
Jonathan Lambrechts committed
75
dg_add_swig_module(slimFunction slimFunction.i dgSlimFunction)
76
if(ENABLE_PROJ)
77
78
79
  set(SWIG_MODULE_proj_EXTRA_DEPS "libproj;dg")
  dg_add_swig_module(proj proj.i "${PROJ_LIB};dg")
  add_dependencies(dgSlimFunction libproj)
80
endif(ENABLE_PROJ)
81
dg_add_test_directory(tests valentin.vallaeys@uclouvain.be)