PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_8/bindings/wxwidgets/CMakeLists.txt

#
CMake | 172 lines | 113 code | 18 blank | 41 comment | 6 complexity | 431b640e35a4bd82e82edde509a8c335 MD5 | raw file
Possible License(s): LGPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, Apache-2.0, GPL-2.0
  1. # bindings/wxwidgets/CMakeLists.txt
  2. ### Process this file with cmake to produce Makefile
  3. ###
  4. # Copyright (C) 2007 Werner Smekal
  5. #
  6. # This file is part of PLplot.
  7. #
  8. # PLplot is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU Library General Public License as published
  10. # by the Free Software Foundation; version 2 of the License.
  11. #
  12. # PLplot is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Library General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Library General Public License
  18. # along with PLplot; if not, write to the Free Software
  19. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. if(ENABLE_wxwidgets)
  21. set(plplotwxwidgets${LIB_TAG}_LIB_SRCS
  22. wxPLplotstream.cpp
  23. wxPLplotwindow.cpp
  24. )
  25. # configure header file - we need to make sure, that the user of the bindings
  26. # can't set the wrong options (use freetype/agg)
  27. CONFIGURE_FILE(
  28. ${CMAKE_CURRENT_SOURCE_DIR}/wxPLplotstream.h.in
  29. ${CMAKE_CURRENT_BINARY_DIR}/wxPLplotstream.h
  30. )
  31. set(plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS
  32. ${CMAKE_CURRENT_BINARY_DIR}/wxPLplotstream.h
  33. wxPLplotwindow.h
  34. )
  35. # Set the include path
  36. include_directories(
  37. ${CMAKE_SOURCE_DIR}/include
  38. ${CMAKE_SOURCE_DIR}/lib/qsastime
  39. ${CMAKE_SOURCE_DIR}/bindings/c++
  40. ${CMAKE_BINARY_DIR}
  41. ${CMAKE_BINARY_DIR}/include
  42. ${CMAKE_CURRENT_BINARY_DIR}
  43. )
  44. # Create plplotwxwidgets[d] library
  45. add_library(plplotwxwidgets${LIB_TAG} ${plplotwxwidgets${LIB_TAG}_LIB_SRCS})
  46. if(BUILD_SHARED_LIBS)
  47. SET_SOURCE_FILES_PROPERTIES(${plplotwxwidgets${LIB_TAG}_LIB_SRCS}
  48. PROPERTIES COMPILE_FLAGS "-DUSINGDLL" )
  49. endif(BUILD_SHARED_LIBS)
  50. INCLUDE_DIRECTORIES( ${wxWidgets_INCLUDE_DIRS} )
  51. IF(wxWidgets_DEFINITIONS)
  52. SET_PROPERTY(DIRECTORY APPEND
  53. PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
  54. ENDIF(wxWidgets_DEFINITIONS)
  55. IF(wxWidgets_DEFINITIONS_DEBUG)
  56. SET_PROPERTY(DIRECTORY APPEND
  57. PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
  58. ENDIF(wxWidgets_DEFINITIONS_DEBUG)
  59. target_link_libraries(
  60. plplotwxwidgets${LIB_TAG}
  61. plplotcxx${LIB_TAG}
  62. ${wxwidgets_LINK_FLAGS}
  63. )
  64. if(USE_RPATH)
  65. get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
  66. set_target_properties(plplotwxwidgets${LIB_TAG}
  67. PROPERTIES
  68. SOVERSION ${plplotwxwidgets_SOVERSION}
  69. VERSION ${plplotwxwidgets_VERSION}
  70. INSTALL_RPATH "${LIB_INSTALL_RPATH}"
  71. INSTALL_NAME_DIR "${LIB_DIR}"
  72. )
  73. else(USE_RPATH)
  74. set_target_properties(plplotwxwidgets${LIB_TAG}
  75. PROPERTIES
  76. SOVERSION ${plplotwxwidgets_SOVERSION}
  77. VERSION ${plplotwxwidgets_VERSION}
  78. INSTALL_NAME_DIR "${LIB_DIR}"
  79. )
  80. endif(USE_RPATH)
  81. # Install library in lib/
  82. install(TARGETS plplotwxwidgets${LIB_TAG}
  83. EXPORT export_plplot
  84. ARCHIVE DESTINATION ${LIB_DIR}
  85. LIBRARY DESTINATION ${LIB_DIR}
  86. RUNTIME DESTINATION ${BIN_DIR}
  87. )
  88. install(FILES
  89. ${plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS}
  90. DESTINATION ${INCLUDE_DIR}
  91. )
  92. # Configure pkg-config *.pc file corresponding to libplplotwxwidgets${LIB_TAG}
  93. if(PKG_CONFIG_EXECUTABLE)
  94. if(LIB_TAG)
  95. set(PC_PRECISION "double")
  96. else(LIB_TAG)
  97. set(PC_PRECISION "single")
  98. endif(LIB_TAG)
  99. # Determine libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  100. set(wxWidgets_DEFINITIONS_all "${wxWidgets_DEFINITIONS}")
  101. if(wxWidgets_DEFINITIONS_DEBUG)
  102. set(wxWidgets_DEFINITIONS_all "${wxWidgets_DEFINITIONS};${wxWidgets_DEFINITIONS_DEBUG}")
  103. endif(wxWidgets_DEFINITIONS_DEBUG)
  104. STRING(REGEX REPLACE ";" " -D"
  105. libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  106. "-D${wxWidgets_DEFINITIONS_all}"
  107. )
  108. STRING(REGEX REPLACE ";" " -I"
  109. wxWidgets_IFLAGS
  110. "-I${wxWidgets_INCLUDE_DIRS}"
  111. )
  112. set(libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  113. "${libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS} ${wxWidgets_IFLAGS}"
  114. )
  115. # Determine libplplotwxwidgets${LIB_TAG}_LINK_FLAGS
  116. pkg_config_link_flags(
  117. libplplotwxwidgets${LIB_TAG}_LINK_FLAGS
  118. "${wxwidgets_LINK_FLAGS}"
  119. )
  120. # Each list element must consist of a colon-separated string with the
  121. # following fields which are parsed out in the foreach loop below and
  122. # used to configure the corresponding pkg-config *.pc file.
  123. # BINDING - ENABLE_${BINDING} keeps track of whether a
  124. # binding has been enabled (ON) or not (OFF).
  125. # Also, ${BINDING} used to determine PC_FILE_SUFFIX
  126. # which helps to determine name of configured
  127. # *.pc file.
  128. # PC_SHORT_NAME - Used in *.pc NAME: field
  129. # PC_LONG_NAME - Used in *.pc Description: field
  130. # PC_LIBRARY_NAME - Used in *.pc Libs: field
  131. # Also used to determine PC_LINK_FLAGS and
  132. # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
  133. # fields.
  134. set(PC_DATA "wxwidgets:wxWidgets:wxWidgets bindings, :plplotwxwidgets${LIB_TAG}")
  135. string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
  136. set(PC_FILE_SUFFIX "-${BINDING}")
  137. set(PC_REQUIRES "plplot${LIB_TAG}-c++")
  138. string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
  139. string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
  140. string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
  141. set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
  142. set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
  143. set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
  144. set(PC_CONFIGURED_FILE
  145. ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
  146. )
  147. configure_file(
  148. ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
  149. ${PC_CONFIGURED_FILE}
  150. @ONLY
  151. )
  152. install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
  153. endif(PKG_CONFIG_EXECUTABLE)
  154. endif(ENABLE_wxwidgets)