PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/v5_9_2/bindings/wxwidgets/CMakeLists.txt

#
CMake | 157 lines | 100 code | 16 blank | 41 comment | 5 complexity | ad9d738bfdbe3b06d5f521e892a36e9d 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}/bindings/c++
  39. ${CMAKE_BINARY_DIR}
  40. ${CMAKE_BINARY_DIR}/include
  41. ${CMAKE_CURRENT_BINARY_DIR}
  42. )
  43. # Create plplotwxwidgets[d] library
  44. add_library(plplotwxwidgets${LIB_TAG} ${plplotwxwidgets${LIB_TAG}_LIB_SRCS})
  45. if(BUILD_SHARED_LIBS)
  46. SET_SOURCE_FILES_PROPERTIES(${plplotwxwidgets${LIB_TAG}_LIB_SRCS}
  47. PROPERTIES COMPILE_FLAGS "-DUSINGDLL" )
  48. endif(BUILD_SHARED_LIBS)
  49. INCLUDE_DIRECTORIES( ${wxWidgets_INCLUDE_DIRS} )
  50. ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} )
  51. target_link_libraries(
  52. plplotwxwidgets${LIB_TAG}
  53. plplotcxx${LIB_TAG}
  54. ${wxwidgets_LINK_FLAGS}
  55. )
  56. if(USE_RPATH)
  57. get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
  58. set_target_properties(plplotwxwidgets${LIB_TAG}
  59. PROPERTIES
  60. SOVERSION ${plplotwxwidgets_SOVERSION}
  61. VERSION ${plplotwxwidgets_VERSION}
  62. INSTALL_RPATH "${LIB_INSTALL_RPATH}"
  63. INSTALL_NAME_DIR "${LIB_DIR}"
  64. )
  65. else(USE_RPATH)
  66. set_target_properties(plplotwxwidgets${LIB_TAG}
  67. PROPERTIES
  68. SOVERSION ${plplotwxwidgets_SOVERSION}
  69. VERSION ${plplotwxwidgets_VERSION}
  70. INSTALL_NAME_DIR "${LIB_DIR}"
  71. )
  72. endif(USE_RPATH)
  73. # Install library in lib/
  74. install(TARGETS plplotwxwidgets${LIB_TAG}
  75. ARCHIVE DESTINATION ${LIB_DIR}
  76. LIBRARY DESTINATION ${LIB_DIR}
  77. RUNTIME DESTINATION ${BIN_DIR}
  78. )
  79. install(FILES
  80. ${plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS}
  81. DESTINATION ${INCLUDE_DIR}
  82. )
  83. # Configure pkg-config *.pc file corresponding to libplplotwxwidgets${LIB_TAG}
  84. if(PKG_CONFIG_EXECUTABLE)
  85. if(LIB_TAG)
  86. set(PC_PRECISION "double")
  87. else(LIB_TAG)
  88. set(PC_PRECISION "single")
  89. endif(LIB_TAG)
  90. # Determine libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  91. STRING(REGEX REPLACE ";" " "
  92. libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  93. "${wxWidgets_DEFINITIONS}"
  94. )
  95. STRING(REGEX REPLACE ";" " -I"
  96. wxWidgets_IFLAGS
  97. "-I${wxWidgets_INCLUDE_DIRS}"
  98. )
  99. set(libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS
  100. "${libplplotwxwidgets${LIB_TAG}_COMPILE_FLAGS} ${wxWidgets_IFLAGS}"
  101. )
  102. # Determine libplplotwxwidgets${LIB_TAG}_LINK_FLAGS
  103. pkg_config_link_flags(
  104. libplplotwxwidgets${LIB_TAG}_LINK_FLAGS
  105. "${wxwidgets_LINK_FLAGS}"
  106. )
  107. # Each list element must consist of a colon-separated string with the
  108. # following fields which are parsed out in the foreach loop below and
  109. # used to configure the corresponding pkg-config *.pc file.
  110. # BINDING - ENABLE_${BINDING} keeps track of whether a
  111. # binding has been enabled (ON) or not (OFF).
  112. # Also, ${BINDING} used to determine PC_FILE_SUFFIX
  113. # which helps to determine name of configured
  114. # *.pc file.
  115. # PC_SHORT_NAME - Used in *.pc NAME: field
  116. # PC_LONG_NAME - Used in *.pc Description: field
  117. # PC_LIBRARY_NAME - Used in *.pc Libs: field
  118. # Also used to determine PC_LINK_FLAGS and
  119. # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
  120. # fields.
  121. set(PC_DATA "wxwidgets:wxWidgets:wxWidgets bindings, :plplotwxwidgets${LIB_TAG}")
  122. string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
  123. set(PC_FILE_SUFFIX "-${BINDING}")
  124. set(PC_REQUIRES "plplot${LIB_TAG}-c++")
  125. string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
  126. string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
  127. string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
  128. set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
  129. set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
  130. set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
  131. set(PC_CONFIGURED_FILE
  132. ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
  133. )
  134. configure_file(
  135. ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
  136. ${PC_CONFIGURED_FILE}
  137. @ONLY
  138. )
  139. install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
  140. endif(PKG_CONFIG_EXECUTABLE)
  141. endif(ENABLE_wxwidgets)