PageRenderTime 59ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_7_3/bindings/wxwidgets/CMakeLists.txt

#
CMake | 124 lines | 72 code | 13 blank | 39 comment | 4 complexity | 01bc669618f4582c1a9b0a34ebe40d30 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. get_target_property(LIB_INSTALL_RPATH plplot${LIB_TAG} INSTALL_RPATH)
  53. set_target_properties(plplotwxwidgets${LIB_TAG}
  54. PROPERTIES
  55. SOVERSION ${plplotwxwidgets_SOVERSION}
  56. VERSION ${plplotwxwidgets_VERSION}
  57. INSTALL_RPATH "${LIB_INSTALL_RPATH}"
  58. INSTALL_NAME_DIR "${LIB_DIR}"
  59. )
  60. # Install library in lib/
  61. install(TARGETS plplotwxwidgets${LIB_TAG}
  62. ARCHIVE DESTINATION ${LIB_DIR}
  63. LIBRARY DESTINATION ${LIB_DIR}
  64. RUNTIME DESTINATION ${BIN_DIR}
  65. )
  66. install(FILES
  67. ${plplotwxwidgets${LIB_TAG}_INSTALLED_HEADERS}
  68. DESTINATION ${INCLUDE_DIR}
  69. )
  70. # Configure pkg-config *.pc file corresponding to libplplotwxwidgets${LIB_TAG}
  71. if(PKGCONFIG_EXECUTABLE)
  72. if(LIB_TAG)
  73. set(PC_PRECISION "double")
  74. else(LIB_TAG)
  75. set(PC_PRECISION "single")
  76. endif(LIB_TAG)
  77. # Each list element must consist of a colon-separated string with the
  78. # following fields which are parsed out in the foreach loop below and
  79. # used to configure the corresponding pkg-config *.pc file.
  80. # BINDING - ENABLE_${BINDING} keeps track of whether a
  81. # binding has been enabled (ON) or not (OFF).
  82. # Also, ${BINDING} used to determine PC_FILE_SUFFIX
  83. # which helps to determine name of configured
  84. # *.pc file.
  85. # PC_SHORT_NAME - Used in *.pc NAME: field
  86. # PC_LONG_NAME - Used in *.pc Description: field
  87. # PC_LIBRARY_NAME - Used in *.pc Libs: field
  88. # Also used to determine PC_LINK_FLAGS and
  89. # PC_COMPILE_FLAGS used in *.pc Libs: and Cflags:
  90. # fields.
  91. set(PC_DATA "wxwidgets:wxWidgets:wxWidgets bindings, :plplotwxwidgets${LIB_TAG}")
  92. string(REGEX REPLACE "^(.*):.*:.*:.*$" "\\1" BINDING ${PC_DATA})
  93. set(PC_FILE_SUFFIX "-${BINDING}")
  94. set(PC_REQUIRES "plplot${LIB_TAG}-c++")
  95. string(REGEX REPLACE "^.*:(.*):.*:.*$" "\\1" PC_SHORT_NAME ${PC_DATA})
  96. string(REGEX REPLACE "^.*:.*:(.*):.*$" "\\1" PC_LONG_NAME ${PC_DATA})
  97. string(REGEX REPLACE "^.*:.*:.*:(.*)$" "\\1" PC_LIBRARY_NAME ${PC_DATA})
  98. set(PC_LINK_FLAGS "${lib${PC_LIBRARY_NAME}_LINK_FLAGS}")
  99. set(PC_COMPILE_FLAGS "${lib${PC_LIBRARY_NAME}_COMPILE_FLAGS}")
  100. set(PC_LINK_FLAGS "-l${PC_LIBRARY_NAME} ${PC_LINK_FLAGS}")
  101. set(PC_CONFIGURED_FILE
  102. ${CMAKE_BINARY_DIR}/pkgcfg/plplot${LIB_TAG}${PC_FILE_SUFFIX}.pc
  103. )
  104. configure_file(
  105. ${CMAKE_SOURCE_DIR}/pkgcfg/plplot-template.pc.cmake
  106. ${PC_CONFIGURED_FILE}
  107. @ONLY
  108. )
  109. install(FILES ${PC_CONFIGURED_FILE} DESTINATION ${PKG_CONFIG_DIR})
  110. endif(PKGCONFIG_EXECUTABLE)
  111. endif(ENABLE_wxwidgets)