[Kst] branches/work/kst/portto4/kst/cmake
Peter Kümmel
syntheticpp at gmx.net
Fri Jan 7 21:51:24 CET 2011
SVN commit 1212662 by kuemmel:
cnake: add install rules, tested only with msvc and mingw
M +54 -15 CMakeLists.txt
M +11 -2 modules/KstMacros.cmake
M +33 -2 src/kst/CMakeLists.txt
M +1 -2 src/plugins/CMakeLists.txt
--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1212661:1212662
@@ -2,19 +2,49 @@
project(Kst)
+set(KST_VERSION 2.0.3)
+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
include(KstMacros)
-message(STATUS "")
+message(STATUS)
message(STATUS "Build options:")
-message(STATUS "")
+message(STATUS)
+
kst_option(release "Build release version" OFF all)
kst_option(merge_files "Merge files to speedup build" OFF all)
kst_option(merge_rebuild "Rebuild generated files from merged files build" OFF all)
kst_option(verbose "Make verbose makefiles" OFF all)
-message(STATUS "")
+kst_option(install_prefix "Install path for Kst, using a default if not set" OFF all)
+kst_option(console "Open console on Windows" OFF win)
+message(STATUS)
+# Find 3rd party libraries
+find_package(Qt4 REQUIRED)
+include(${QT_USE_FILE})
+if(MINGW)
+ # seems there is a bug in FindQt4
+ macro(fix_it)
+ foreach(_it ${ARGN})
+ if (QT_${_it}_LIBRARY_DEBUG AND QT_${_it}_LIBRARY_RELEASE)
+ set(QT_${_it}_LIBRARY debug ${QT_${_it}_LIBRARY_DEBUG} optimized ${QT_${_it}_LIBRARY_RELEASE} CACHE STRING "Fixed ${_it}" FORCE)
+ endif()
+ endforeach()
+ endmacro()
+ fix_it(QTCORE QTGUI QTXML QTSVG QTOPENGL)
+endif()
+
+message(STATUS)
+message(STATUS "3rd party libs for plugins--------------------")
+find_package(Getdata)
+find_package(Gsl)
+find_package(Netcdf)
+message(STATUS "----------------------------------------------")
+message(STATUS)
+
+
+# React on options
if(kst_release)
set(CMAKE_BUILD_TYPE Release)
else()
@@ -27,19 +57,21 @@
set(CMAKE_VERBOSE_MAKEFILE 0)
endif()
-find_package(Qt4 REQUIRED)
-include(${QT_USE_FILE})
+if(kst_install_prefix)
+ set(CMAKE_INSTALL_PREFIX ${install_prefix} CACHE PATH "User's choice for install prefix" FORCE)
+ set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+endif()
+if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/INSTALLED CACHE PATH "Kst's default install prefix" FORCE)
+endif()
-message(STATUS "")
-message(STATUS "3rd party libs for plugins:")
-message(STATUS "")
-find_package(Getdata)
-find_package(Gsl)
-find_package(Netcdf)
-message(STATUS "")
+if(NOT kst_console)
+ set(kst_win32 WIN32)
+ set(kst_qtmain_library ${QT_QTMAIN_LIBRARY})
+endif()
-set(KST_VERSION 2.0.3)
+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -53,8 +85,8 @@
add_definitions(-D_USE_MATH_DEFINES)
endif()
-if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/INSTALLED)
+if(WIN32)
+ set(CMAKE_DEBUG_POSTFIX d)
endif()
configure_file(${KST_DIR}/cmake/config.h.cmake ${CMAKE_BINARY_DIR}/config.h)
@@ -65,5 +97,12 @@
)
+message(STATUS "Build summary----------------------------------")
+message(STATUS "Version : ${KST_VERSION}")
+message(STATUS "Path to source : ${KST_DIR}")
+message(STATUS "Installation path: ${CMAKE_INSTALL_PREFIX}")
+message(STATUS "-----------------------------------------------")
+message(STATUS)
+
add_subdirectory(src)
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1212661:1212662
@@ -61,6 +61,12 @@
add_library(${kst_name} ${type} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
endif()
target_link_libraries(${kst_name} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY})
+ if(WIN32)
+ install(TARGETS ${kst_name} RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib)
+ else()
+ install(TARGETS ${kst_name} RUNTIME DESTINATION lib)
+ endif()
endmacro()
@@ -75,15 +81,16 @@
macro(kst_add_plugin folder name)
- set(_name kstplugin_${kst_plugin_prefix}_${folder}_${name})
+ set(_name kst_${kst_plugin_prefix}_${folder}_${name})
string(REPLACE . _ _name ${_name})
string(REPLACE / _ _name ${_name})
string(REPLACE __ _ _name ${_name})
string(REPLACE __ _ _name ${_name})
kst_init(${_name})
kst_files_find(${kst_plugin_dir}/${folder}/${name})
- add_library(${kst_name} SHARED ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
+ add_library(${kst_name} MODULE ${kst_${kst_name}_sources} ${kst_${kst_name}_headers})
kst_link(kstcore kstmath kstwidgets)
+ install(TARGETS ${kst_name} LIBRARY DESTINATION plugin)
endmacro()
@@ -124,6 +131,8 @@
set(_msg OFF)
if(${_sys} MATCHES "gcc")
set(_system CMAKE_COMPILER_IS_GNUCXX)
+ elseif(${_sys} MATCHES "win")
+ set(_system WIN32)
else()
set(_system ${_sys})
endif()
--- branches/work/kst/portto4/kst/cmake/src/kst/CMakeLists.txt #1212661:1212662
@@ -20,6 +20,37 @@
${KST_DIR}/NEWS
${KST_DIR}/README)
-add_executable(kst ${kst_kst_sources} ${rc_file} ${kst_kst_info_files})
+add_executable(kst ${kst_win32} ${kst_kst_sources} ${rc_file} ${kst_kst_info_files})
-kst_link(kstcore kstmath kstapp kstwidgets ${QT_QTOPENGL_LIBRARY} ${QT_QTSVG_LIBRARY})
+kst_link(kstcore kstmath kstapp kstwidgets ${QT_QTOPENGL_LIBRARY} ${QT_QTSVG_LIBRARY} ${kst_qtmain_library})
+
+install(TARGETS kst RUNTIME DESTINATION bin)
+
+if(WIN32)
+ install(FILES
+ ${QT_BINARY_DIR}/QtCore4.dll
+ ${QT_BINARY_DIR}/QtGui4.dll
+ ${QT_BINARY_DIR}/QtXml4.dll
+ ${QT_BINARY_DIR}/QtOpenGL4.dll
+ ${QT_BINARY_DIR}/QtSvg4.dll
+ DESTINATION bin
+ CONFIGURATIONS Release)
+ install(FILES
+ ${QT_BINARY_DIR}/QtCored4.dll
+ ${QT_BINARY_DIR}/QtGuid4.dll
+ ${QT_BINARY_DIR}/QtXmld4.dll
+ ${QT_BINARY_DIR}/QtOpenGLd4.dll
+ ${QT_BINARY_DIR}/QtSvgd4.dll
+ DESTINATION bin
+ CONFIGURATIONS Debug)
+endif()
+
+if(MINGW)
+ get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
+ install(FILES
+ ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll
+ ${MINGW_BIN_PATH}/mingwm10.dll
+ DESTINATION bin)
+endif()
+
+
--- branches/work/kst/portto4/kst/cmake/src/plugins/CMakeLists.txt #1212661:1212662
@@ -21,11 +21,10 @@
kst_add_plugin(filters differentiation)
if(gsl)
-
include_directories(${GSL_INCLUDE_DIR})
macro(kst_add_gsl_plugin dir name)
kst_add_plugin(${dir} ${name})
- kst_link(${GSL_LIBRARY})
+ kst_link(${GSL_LIBRARIES})
endmacro()
kst_add_gsl_plugin(dataobject/convolution convolve)
More information about the Kst
mailing list