Warning, /graphics/kst-plot/cmake/3rdparty/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 cmake_minimum_required(VERSION 2.8)
0002 
0003 # figure out if we use MinGW with Ninja: call with -DCC=gcc
0004 if(WIN32 AND CMAKE_GENERATOR MATCHES Ninja AND CC MATCHES gcc)
0005         find_file(mingw_make mingw32-make.exe)
0006         get_filename_component(mingw_bin_dir ${mingw_make} PATH)
0007         set(CMAKE_RC_COMPILER ${mingw_bin_dir}/windres.exe)
0008         message("CMAKE_RC_COMPILER: ${CMAKE_RC_COMPILER}")
0009 endif()
0010 
0011 project(3rdparty)
0012 
0013 include(ExternalProject)
0014 
0015 set(build_dir ${CMAKE_BINARY_DIR}/3rdparty)
0016 if(kst_3rdparty_dir)
0017         set(install_dir ${kst_3rdparty_dir})
0018 else()
0019         set(install_dir ${build_dir}/installed)
0020 endif()
0021 set(generator -G${CMAKE_GENERATOR})
0022 set(install_prefix -DCMAKE_INSTALL_PREFIX=${install_dir})
0023 file(MAKE_DIRECTORY ${install_dir})
0024 
0025 if(CMAKE_BUILD_TYPE)
0026         set(build_type -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
0027 endif()
0028 message(STATUS "3rdparty build type: ${build_type}")
0029 if(MINGW AND CMAKE_GENERATOR MATCHES Ninja)
0030         set(rc_compiler -DCMAKE_RC_COMPILER=${CMAKE_RC_COMPILER})
0031         set(install_target install\\strip)
0032 else()
0033         set(install_target install/strip)
0034 endif()
0035 
0036 if(NOT kst_make_program)
0037         set(kst_make_program ${CMAKE_MAKE_PROGRAM})
0038 endif()
0039 
0040 # make dependencies visible for cmake
0041 # http://public.kitware.com/Bug/view.php?id=13538
0042 macro(kst_external_static_lib targetName name lib)
0043     add_library(${targetName} STATIC IMPORTED GLOBAL)
0044     set_target_properties(${targetName} PROPERTIES IMPORTED_LOCATION ${install_dir}/lib/${lib})
0045     add_dependencies(${targetName} ${name})
0046 endmacro()
0047 
0048 
0049 
0050 # GETDATA
0051 set(ext_src ${build_dir}/getdata/src/getdata)
0052 if(WIN32)
0053         set(ext_url http://sourceforge.net/projects/getdata/files/getdata/0.8.0/getdata_win-0.8.0.zip)
0054         set(ext_configure cmake ${ext_src}/cmake ${generator} ${rc_compiler} ${install_prefix} ${build_type})
0055         set(ext_install ${install_target})
0056         set(ext_make ${kst_make_program})
0057 else()
0058         set(ver 0.8.5)
0059         set(ext_url http://sourceforge.net/projects/getdata/files/getdata/${ver}/getdata-${ver}.tar.gz)
0060         set(ext_configure ${ext_src}/configure --with-pic --enable-static --disable-shared --disable-fortran --disable-legacy-api
0061                                                --prefix=${install_dir} --mandir=${install_dir}/man --disable-perl )
0062         set(ext_install install)
0063         set(ext_make ${CMAKE_MAKE_PROGRAM} CXXFLAGS=-fPIC CFLAGS=-fPIC)
0064 endif()
0065 ExternalProject_Add(getdata
0066                                         PREFIX ${build_dir}/getdata
0067                                         URL ${ext_url}
0068                                         SOURCE_DIR ${ext_src}
0069                                         CONFIGURE_COMMAND ${ext_configure}
0070                                         BUILD_IN_SOURCE OFF
0071                                         BUILD_COMMAND ${ext_make}
0072                                         INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} ${ext_install})
0073 
0074 if(APPLE)
0075         set(gddeps -lbz2 -lz)
0076 endif()
0077 set(GETDATA_INCLUDEDIR ${install_dir}/include PARENT_SCOPE)
0078 kst_external_static_lib(gdc_build   libgetdata libgetdata.a)
0079 kst_external_static_lib(gdcpp_build libgetdata libgetdata++.a)
0080 set(GETDATA_LIBRARIES gdcpp_build gdc_build ${gddeps} PARENT_SCOPE)
0081 
0082 
0083 # ZLIB needed by MATIO
0084 set(ext_src ${build_dir}/zlib/src/zlib)
0085 if(WIN32)
0086         set(ext_url http://sourceforge.net/projects/kst/files/3rdparty/zlib-develop-mingw-fixed.zip)
0087         set(ext_configure cmake ${ext_src} ${generator} -DBUILD_SHARED_LIBS=0 ${rc_compiler} ${install_prefix} ${build_type})
0088         set(ext_install ${install_target})
0089         set(ext_insource OFF )
0090                 set(zlib_library libzlibstatic.a)
0091         set(ext_make ${kst_make_program})
0092 else()
0093         set(ext_url http://zlib.net/zlib-1.2.8.tar.gz)
0094         set(ext_configure ${ext_src}/configure --static --prefix=${install_dir})
0095         set(ext_install install)
0096         set(ext_insource ON)
0097                 set(zlib_library libz.a)
0098         set(ext_make ${CMAKE_MAKE_PROGRAM} CXXFLAGS=-fPIC CFLAGS=-fPIC)
0099 endif()
0100 ExternalProject_Add(zlib
0101                                         PREFIX ${build_dir}/zlib
0102                                         URL ${ext_url}
0103                                         SOURCE_DIR ${ext_src}
0104                                         CONFIGURE_COMMAND ${ext_configure}
0105                                         BUILD_IN_SOURCE ${ext_insource}
0106                                         BUILD_COMMAND ${ext_make}
0107                                         INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} ${ext_install})
0108 
0109 kst_external_static_lib(zlib_build zlib ${zlib_library})
0110 
0111 # MATIO
0112 set(ext_src ${build_dir}/matio/src/matio)
0113 if(WIN32)
0114         set(ext_url http://sourceforge.net/projects/kst/files/3rdparty/matio-2012.03.14.zip)
0115         set(ext_configure cmake ${CMAKE_CURRENT_SOURCE_DIR}/matio
0116                                                                                         -Dmatio_dir=${ext_src}
0117                                                                                         -DZLIB_INCLUDE_DIR=${install_dir}/include
0118                                                                                         -DZLIB_LIBRARY=${zlib_library}
0119                                                                                         ${generator} ${rc_compiler}
0120                                                                                         ${install_prefix}
0121                                                                                         ${build_type})
0122         set(ext_install ${install_target})
0123         set(ext_insource OFF )
0124         set(ext_make ${kst_make_program})
0125 else()
0126         set(ext_url http://sourceforge.net/projects/matio/files/matio/1.5.2/matio-1.5.2.tar.gz)
0127         set(ext_configure ${ext_src}/configure --with-pic --enable-static --disable-shared --prefix=${install_dir} --with-zlib=${install_dir})
0128         set(ext_install install)
0129         set(ext_insource ON)
0130         set(ext_make ${CMAKE_MAKE_PROGRAM} CXXFLAGS=-fPIC CFLAGS=-fPIC)
0131 endif()
0132 ExternalProject_Add(matio
0133                                         PREFIX ${build_dir}/matio
0134                                         URL ${ext_url}
0135                                         CONFIGURE_COMMAND ${ext_configure}
0136                                         BUILD_IN_SOURCE OFF
0137                                         BUILD_COMMAND ${ext_make}
0138                                         INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} ${ext_install})
0139 add_dependencies(matio zlib)
0140 
0141 set(MATIO_INCLUDEDIR ${install_dir}/include PARENT_SCOPE)
0142 kst_external_static_lib(matio_build matio libmatio.a)
0143 set(MATIO_LIBRARIES matio_build zlib_build PARENT_SCOPE)
0144 
0145 
0146 # NETCDF
0147 set(ext_src ${build_dir}/netcdf/src/netcdf)
0148 if(WIN32)
0149         set(ext_url ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.1.1.tar.gz)
0150         set(ext_configure cmake ${CMAKE_CURRENT_SOURCE_DIR}/netcdf
0151                                                                                         -Dnetcdf_sources=${build_dir}/netcdf/src/netcdf
0152                                                                                         ${generator} ${rc_compiler}
0153                                                                                         ${install_prefix}
0154                                                                                         ${build_type})
0155         set(ext_install ${install_target})
0156         set(ext_insource OFF)
0157         set(ext_make ${kst_make_program})
0158 else()
0159         set(ext_url ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.1.3.tar.gz)
0160         set(ext_configure ${ext_src}/configure  --with-pic  --disable-netcdf-4
0161                                                                                         --enable-static --disable-shared   --disable-curl --disable-dap
0162                                                                                         --prefix=${install_dir} --with-zlib=${install_dir})
0163         set(ext_install install)
0164         set(ext_insource ON)
0165         set(ext_make ${CMAKE_MAKE_PROGRAM})
0166 endif()
0167 ExternalProject_Add(netcdf
0168                                         PREFIX ${build_dir}/netcdf
0169                                         URL ${ext_url}
0170                                         CONFIGURE_COMMAND ${ext_configure}
0171                                         BUILD_IN_SOURCE OFF
0172                                         BUILD_COMMAND ${ext_make}
0173                                         INSTALL_COMMAND ${ext_make} ${ext_install})
0174 
0175 set(NETCDF_INCLUDEDIR  ${install_dir}/include PARENT_SCOPE)
0176 kst_external_static_lib(netcdf_c_build netcdf libnetcdf.a)
0177 kst_external_static_lib(netcdf_cpp_build netcdf libnetcdf_c++.a)
0178 set(NETCDF_LIBRARY_C netcdf_c_build PARENT_SCOPE)
0179 set(NETCDF_LIBRARY_CPP netcdf_cpp_build PARENT_SCOPE)
0180 
0181 # CFITSIO
0182 set(ext_src ${build_dir}/cfitsio/src/cfitsio)
0183 if(WIN32)
0184         set(ext_url ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfit3250.zip)
0185         set(ext_configure  cmake ${CMAKE_CURRENT_SOURCE_DIR}/cfitsio
0186                                                                                         -DCFIT_DIR=${build_dir}/cfitsio/src/cfitsio
0187                                                                                         ${generator} ${rc_compiler}
0188                                                                                         ${install_prefix}
0189                                                                                         ${build_type})
0190         set(ext_install ${install_target})
0191         set(ext_insource OFF)
0192         set(ext_make ${kst_make_program})
0193 else()
0194         set(ext_url ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3360.tar.gz)
0195         set(ext_configure ${ext_src}/configure  --with-pic
0196                                                                                         --enable-static --disable-shared
0197                                                                                         --prefix=${install_dir} --with-zlib=${install_dir})
0198         set(ext_install install)
0199         set(ext_insource ON)
0200         set(ext_make ${CMAKE_MAKE_PROGRAM} CXXFLAGS=-fPIC CFLAGS=-fPIC)
0201 endif()
0202 ExternalProject_Add(cfitsio
0203                                         PREFIX ${build_dir}/cfitsio
0204                                         URL ${ext_url}
0205                                         CONFIGURE_COMMAND ${ext_configure}
0206                                         BUILD_IN_SOURCE ${ext_insource}
0207                                         BUILD_COMMAND ${ext_make}
0208                                         INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} ${ext_install})
0209 
0210 
0211 set(CFITSIO_INCLUDEDIR ${install_dir}/include/cfitsio PARENT_SCOPE)
0212 kst_external_static_lib(cfitsio_build cfitsio libcfitsio.a)
0213 set(CFITSIO_LIBRARIES cfitsio_build PARENT_SCOPE)
0214 
0215 
0216 
0217 # GSL
0218 set(ext_src ${build_dir}/gsl/src/gsl)
0219 if(WIN32)
0220         set(ext_url http://sourceforge.net/projects/kst/files/3rdparty/gsl-1.14-patched.zip)
0221         set(ext_configure cmake ${CMAKE_CURRENT_SOURCE_DIR}/gsl
0222                                                                                         -DGSL_DIR=${build_dir}/gsl/src/gsl
0223                                                                                         ${generator} ${rc_compiler}
0224                                                                                         ${install_prefix}
0225                                                                                         ${build_type})
0226         set(ext_install ${install_target})
0227         set(ext_insource OFF)
0228         set(ext_make ${kst_make_program})
0229 else()
0230         set(ext_url ftp://ftp.gnu.org/gnu/gsl/gsl-1.16.tar.gz)
0231         set(ext_configure ${ext_src}/configure  --with-pic
0232                                                                                         --enable-static --disable-shared
0233                                                                                         --prefix=${install_dir} --with-zlib=${install_dir})
0234         set(ext_install install)
0235         set(ext_insource ON)
0236         set(ext_make ${CMAKE_MAKE_PROGRAM})
0237 endif()
0238 ExternalProject_Add(gsl
0239                                         PREFIX ${build_dir}/gsl
0240                                         URL ${ext_url}
0241                                         CONFIGURE_COMMAND ${ext_configure}
0242                                         BUILD_IN_SOURCE OFF
0243                                         BUILD_COMMAND ${ext_make}
0244                                         INSTALL_COMMAND ${ext_make} ${ext_install})
0245 
0246 if(APPLE)
0247                 set(GSL_DEPS ${install_dir}/lib/libgslcblas.a)
0248 endif()
0249 set(GSL_INCLUDEDIR ${install_dir}/include PARENT_SCOPE)
0250 kst_external_static_lib(gsl_build gsl libgsl.a)
0251 set(GSL_LIBRARIES gsl_build ${GSL_DEPS} PARENT_SCOPE)
0252 
0253 
0254 
0255 
0256