PageRenderTime 37ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_8_0_RC1/bindings/wxwidgets/CMakeLists.txt

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