File: CMakeLists.txt

package info (click to toggle)
ecbuild 3.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,068 kB
  • sloc: sh: 1,404; perl: 732; f90: 472; cpp: 466; python: 383; ansic: 304; fortran: 43; makefile: 15
file content (61 lines) | stat: -rw-r--r-- 2,235 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# (C) Copyright 2011- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

cmake_minimum_required( VERSION 3.18 FATAL_ERROR )

find_package(ecbuild REQUIRED)
project( mypython VERSION 0.10.0 LANGUAGES CXX )

###############################################################################
# find extra packages

# Python
# Can specify non-default distribution with CMake variable PYTHON_EXECUTABLE
ecbuild_find_python()
ecbuild_info("PYTHON_EXECUTABLE    : ${PYTHON_EXECUTABLE}")
ecbuild_info("PYTHON_INCLUDE_DIRS  : ${PYTHON_INCLUDE_DIRS}")
ecbuild_info("PYTHON_LIBRARIES     : ${PYTHON_LIBRARIES}")

# Boost
# Can specify non-default distribution with CMake variable BOOST_ROOT
set( Boost_MINIMUM_VERSION "1.47" )
find_package( Boost ${Boost_MINIMUM_VERSION} REQUIRED
              COMPONENTS python )
ecbuild_info("Boost_LIBRARIES     : ${Boost_LIBRARIES}" )

###############################################################################
# Contents

ecbuild_add_library( TARGET       mypython
                     INCLUDES     ${Boost_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS}
                     PRIVATE_LIBS ${Boost_LIBRARIES} ${PYTHON_LIBRARIES}
                     SOURCES      pythonlib.hpp pythonlib.cpp )
configure_file( mypython.py       ${CMAKE_BINARY_DIR}/lib COPYONLY )

############################################################################################
# Installation

ecbuild_install_project( NAME python_project )

###############################################################################
# Summary

ecbuild_print_summary()



ecbuild_info( "" )
ecbuild_info( "To test the library:" )
ecbuild_info( "--------------------" )
ecbuild_info( "make" )
ecbuild_info( "cd ${CMAKE_CURRENT_BINARY_DIR}/lib" )
ecbuild_info( "python" )
ecbuild_info( ">>> import libmypython" )
ecbuild_info( ">>> help(libmypython)" )
ecbuild_info( "" )
ecbuild_info( "---------------------------------------------------------" )