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

/tags/v5_9_5/bindings/wxwidgets/CMakeLists.txt

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