1 # cmake <http://www.cmake.org> build file for Gammu
2 # Copyright (c) 2007 - 2010 Michal Cihar
3 # vim: expandtab sw=4 ts=4 sts=4:
5 project (python-gammu-module C)
7 if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
8 CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX)
9 # Needed for Python at least for PyObject and PyTypeObject handling
10 MACRO_TUNE_COMPILER("-fno-strict-aliasing")
11 endif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_MINGW OR
12 CMAKE_COMPILER_IS_CYGWIN OR CMAKE_COMPILER_IS_GNUCXX)
14 # Python has defined these functions, but MinGW does also have them...
16 check_symbol_exists (acosh "math.h" HAVE_ACOSH)
18 add_definitions(-DHAVE_ACOSH)
20 check_symbol_exists (asinh "math.h" HAVE_ASINH)
22 add_definitions(-DHAVE_ASINH)
24 check_symbol_exists (atanh "math.h" HAVE_ATANH)
26 add_definitions(-DHAVE_ATANH)
28 check_symbol_exists (log1p "math.h" HAVE_LOG1P)
30 add_definitions(-DHAVE_LOG1P)
36 ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=1,prefix='${CMAKE_INSTALL_EXEC_PREFIX}'))"
37 OUTPUT_VARIABLE PYTHON_SITEDIR
38 OUTPUT_STRIP_TRAILING_WHITESPACE
47 src/convertors/backup.c
49 src/convertors/bitmap.c
50 src/convertors/calendar.c
52 src/convertors/diverts.c
54 src/convertors/memory.c
56 src/convertors/ringtone.c
58 src/convertors/string.c
66 ${PYTHON_EXECUTABLE} -c "import sys
67 if hasattr(sys, 'pydebug'):
69 OUTPUT_VARIABLE PYTHON_DEBUG
70 OUTPUT_STRIP_TRAILING_WHITESPACE
74 "${CMAKE_CURRENT_BINARY_DIR}/../../include"
75 "${CMAKE_CURRENT_SOURCE_DIR}/../../python/include"
76 ${PYTHON_INCLUDE_PATH}
77 ${CMAKE_CURRENT_SOURCE_DIR}
80 add_library(python_gammu MODULE ${PYTHON_GAMMU_SRC})
81 set_target_properties (python_gammu PROPERTIES
84 INSTALL_RPATH_USE_LINK_PATH OFF
87 if (PYTHON_DEBUG STREQUAL True)
88 set_target_properties (python_gammu PROPERTIES
90 endif (PYTHON_DEBUG STREQUAL True)
92 if (WIN32 AND NOT CYGWIN)
93 set_target_properties (python_gammu PROPERTIES
96 endif (WIN32 AND NOT CYGWIN)
97 target_link_libraries (python_gammu libGammu)
98 target_link_libraries (python_gammu gsmsd)
99 target_link_libraries (python_gammu ${PYTHON_LIBRARIES})
100 target_link_libraries (python_gammu string)
101 install(TARGETS python_gammu LIBRARY DESTINATION "${PYTHON_SITEDIR}/gammu/" COMPONENT "python")
103 file(GLOB PYFILES "*.py")
104 foreach(PYFILE ${PYFILES})
105 get_filename_component(FILENAME "${PYFILE}" NAME)
106 configure_file("${PYFILE}" "${CMAKE_CURRENT_BINARY_DIR}/${FILENAME}" COPY_ONLY)
108 install(FILES ${PYFILES} DESTINATION "${PYTHON_SITEDIR}/gammu/" COMPONENT "python")