PageRenderTime 45ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/v5_9_4/bindings/wxwidgets/CMakeLists.txt

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