summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/CMakeLists.txt41
-rw-r--r--cmake/modules/FindKDEWIN.cmake56
-rw-r--r--cmake/modules/FindKDEWIN_Packager.cmake156
-rw-r--r--cmake/modules/Win32Macros.cmake44
4 files changed, 264 insertions, 33 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 1eef28e0..3728aba0 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -11,9 +11,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.4 FATAL_ERROR)
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
-find_package(KDEWIN_INSTALLER)
-
-
#enable building of shared library
SET(BUILD_SHARED_LIBS ON)
@@ -21,10 +18,13 @@ if (CYGWIN)
set (WIN32)
endif (CYGWIN)
-# search packages used by KDE
+# search for required packages
if (WIN32)
- find_package(GNUWIN32)
+ find_package(KDEWIN)
+ find_package(KDEWIN_Packager)
find_package(LibIconv)
+ include(Win32Macros)
+ addExplorerWrapper(${PACKAGE})
endif (WIN32)
find_package(LibXml2)
find_package(LibExpat)
@@ -538,33 +538,8 @@ if (DBUS_DISABLE_CHECKS)
endif(DBUS_DISABLE_CHECKS)
MESSAGE(" ")
-
INCLUDE(modules/CPackInstallConfig.cmake)
-if (KDEWIN_INSTALLER_FOUND)
- if (MSVC)
- add_custom_target(kdewinpackage
- COMMAND ${KDEWIN_PACKAGER}
- -name dbus
- -root ${CMAKE_INSTALL_PREFIX}
- -srcroot ${CMAKE_SOURCE_DIR}/..
- -version ${VERSION}
- -notes "ipc service"
- -type msvc
- -strip
- -complete
- )
- else (MSVC)
- add_custom_target(kdewinpackage
- COMMAND ${KDEWIN_PACKAGER}
- -name dbus
- -root ${CMAKE_INSTALL_PREFIX}
- -srcroot ${CMAKE_SOURCE_DIR}/..
- -version ${VERSION}
- -notes "ipc service"
- -strip
- -type mingw
- -complete
- )
- endif (MSVC)
-endif (KDEWIN_INSTALLER_FOUND)
+if (KDEWIN_PACKAGER_FOUND)
+ KDEWIN_PACKAGER(${PACKAGE} ${VERSION} "ipc library" "")
+endif (KDEWIN_PACKAGER_FOUND)
diff --git a/cmake/modules/FindKDEWIN.cmake b/cmake/modules/FindKDEWIN.cmake
new file mode 100644
index 00000000..3e40fd37
--- /dev/null
+++ b/cmake/modules/FindKDEWIN.cmake
@@ -0,0 +1,56 @@
+# - Try to find the KDEWIN library
+#
+# used environment vars
+# KDEWIN_DIR - kdewin root dir
+#
+# this will define
+# KDEWIN_FOUND - system has KDEWIN
+# KDEWIN_DIR - the KDEWIN root installation dir
+#
+# Copyright (c) 2007, Ralf Habacker, <ralf.habacker@freenet.de>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+if (WIN32)
+ IF (NOT KDEWIN_DIR)
+ # check for enviroment variable
+ file(TO_CMAKE_PATH "$ENV{KDEWIN_DIR}" KDEWIN_DIR)
+ if(NOT KDEWIN_DIR)
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
+ if (MINGW)
+ set (DIR "kdewin-mingw")
+ else (MINGW)
+ set (DIR "kdewin-msvc")
+ endif (MINGW)
+
+ # search in the default program install folder
+ find_file(KDEWIN_DIR_tmp ${DIR} kdewin kdewin32 gnuwin32
+ PATHS
+ "${_progFiles}"
+ )
+ set (KDEWIN_DIR ${KDEWIN_DIR_tmp})
+ endif (NOT KDEWIN_DIR)
+ if (KDEWIN_DIR)
+ message(STATUS "Found windows supplementary package location: ${KDEWIN_DIR}")
+ endif (KDEWIN_DIR)
+ endif (NOT KDEWIN_DIR)
+
+ # this must be set every time
+ if (KDEWIN_DIR)
+ # add include path and library to all targets, this is required because
+ # cmake's 2.4.6 FindZLib.cmake does not use CMAKE_REQUIRED... vars
+ set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${KDEWIN_DIR}/include)
+ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} ${KDEWIN_DIR}/lib)
+
+ set (KDEWIN_FOUND 1)
+ else(KDEWIN_DIR)
+ message(STATUS "Could not find the location of the windows supplementary packages which is \n"
+ "\t\tenvironment variable KDEWIN_DIR\n"
+ "\t\t<ProgramFiles>/${DIR}\n"
+ "\t\t<ProgramFiles>/kdewin\n"
+ "\t\t<ProgramFiles>/kdewin32\n"
+ "\t\t<ProgramFiles>/gnuwin32\n")
+ endif(KDEWIN_DIR)
+
+endif (WIN32)
diff --git a/cmake/modules/FindKDEWIN_Packager.cmake b/cmake/modules/FindKDEWIN_Packager.cmake
new file mode 100644
index 00000000..d4b6328b
--- /dev/null
+++ b/cmake/modules/FindKDEWIN_Packager.cmake
@@ -0,0 +1,156 @@
+#
+# KDEWIN packager support http://download.cegit.de/kde-windows/installer
+#
+# The kdewin packager is searched in the following pathes and order
+#
+# path specified by the environment dir KDEWIN_PACKAGER_DIR
+# <ProgramFiles>/kdewin-packager
+# <ProgramFiles>/kdewin-installer
+#
+# The macro KDEWIN_PACKAGER provides package building support and should be
+# added to the top level CMakeLists.txt as shown below
+#
+# if (KDEWIN_PACKAGER_FOUND)
+# KDEWIN_PACKAGER(
+# "projectname"
+# "version"
+# "description"
+# "additional options"
+# )
+# endif (KDEWIN_PACKAGER_FOUND)
+
+# The macro KDEWIN_PACKAGER adds three additional makefile targets, which could be
+# called using the regular make tool
+#
+# kdewin_package
+# - build kdewin package with currently used compiler and build type
+# kdewin_package_debug_and_release
+# - build kdewin debug and release package with currently used compiler
+# kdewin_package_debug_and_release_mingw_and_msvc
+# - build kdewin debug and release package with mingw and msvc compiler
+#
+#
+#
+# Copyright (c) 2006-2007, Ralf Habacker
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+
+if (WIN32)
+ if(NOT KDEWIN_PACKAGER_DIR)
+ # check for enviroment variable
+ file(TO_CMAKE_PATH "$ENV{KDEWIN_PACKAGER_DIR}" KDEWIN_PACKAGER_DIR)
+ if(NOT KDEWIN_PACKAGER_DIR)
+ # search in the default program install folder
+ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _progFiles)
+ find_file(KDEWIN_PACKAGER_DIR_tmp kdewin-packager kdewin-installer
+ PATHS
+ "${_progFiles}"
+ )
+ set(KDEWIN_PACKAGER_DIR ${KDEWIN_PACKAGER_DIR_tmp})
+ endif(NOT KDEWIN_PACKAGER_DIR)
+ endif(NOT KDEWIN_PACKAGER_DIR)
+
+ if (KDEWIN_PACKAGER_DIR)
+
+ find_program(KDEWIN_PACKAGER_EXECUTABLE kdewin-packager
+ PATHS
+ ${KDEWIN_PACKAGER_DIR}/bin
+ )
+
+ set(KDEWIN_PACKAGER_FOUND TRUE)
+ else (KDEWIN_PACKAGER_DIR)
+ set(KDEWIN_PACKAGER_FOUND)
+ endif (KDEWIN_PACKAGER_DIR)
+
+ if (KDEWIN_PACKAGER_FOUND)
+ if (NOT KDEWIN_PACKAGER_FIND_QUIETLY)
+ message(STATUS "Found KDEWIN Packager: ${KDEWIN_PACKAGER_DIR}")
+ endif (NOT KDEWIN_PACKAGER_FIND_QUIETLY)
+ else (KDEWIN_PACKAGER_FOUND)
+ if (KDEWIN_PACKAGER_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find KDEWIN PAckager")
+ endif (KDEWIN_PACKAGER_FIND_REQUIRED)
+ endif (KDEWIN_PACKAGER_FOUND)
+
+endif (WIN32)
+
+MACRO (KDEWIN_PACKAGER _name _version _notes _options)
+ if (KDEWIN_PACKAGER_FOUND)
+ if (MSVC)
+ set (type "msvc")
+ else (MSVC)
+ set (type "mingw")
+ endif (MSVC)
+
+ add_custom_target(kdewin_package
+ COMMAND ${CMAKE_COMMAND}
+ -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ COMMAND ${KDEWIN_PACKAGER_EXECUTABLE}
+ -name ${_name}
+ -root ${CMAKE_BINARY_DIR}/temp
+ -srcroot ${CMAKE_SOURCE_DIR}
+ -version ${_version}
+ -notes "${_notes}"
+ -type ${type}
+ ${_options}
+ # FIXME: cleanup does not work
+ #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp
+ )
+ add_custom_target(kdewin_package_debug_and_release
+ COMMAND ${CMAKE_COMMAND}
+ -H$(CMAKE_SOURCE_DIR)
+ -B$(CMAKE_BINARY_DIR)
+ -DCMAKE_BUILD_TYPE=Release
+ COMMAND ${CMAKE_MAKE_PROGRAM}
+ clean
+ COMMAND ${CMAKE_MAKE_PROGRAM}
+ install/local
+ COMMAND ${CMAKE_COMMAND}
+ -H$(CMAKE_SOURCE_DIR)
+ -B$(CMAKE_BINARY_DIR)
+ -DCMAKE_BUILD_TYPE=Debug
+ COMMAND ${CMAKE_MAKE_PROGRAM}
+ clean
+ COMMAND ${CMAKE_MAKE_PROGRAM}
+ install/local
+ COMMAND ${KDEWIN_PACKAGER_EXECUTABLE}
+ -name ${_name}
+ -root ${CMAKE_BINARY_DIR}/temp
+ -srcroot ${CMAKE_SOURCE_DIR}
+ -version ${_version}
+ -notes "${_notes}"
+ -type ${type}
+ ${_options}
+ # FIXME: cleanup does not work
+ #COMMAND rmdir /Q /S ${CMAKE_BINARY_DIR}\temp
+ )
+set (CONTENT "
+if \"%1\" == \"package_only\" goto package_only
+
+del CMakeCache.txt
+rmdir /Q /S ${CMAKE_BINARY_DIR}/temp
+${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Release
+mingw32-make
+${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
+${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"MinGW Makefiles\" -DCMAKE_BUILD_TYPE=Debug
+mingw32-make
+${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
+del CMakeCache.txt
+${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Release
+nmake
+${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
+${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR} -G \"NMake Makefiles\" -DCMAKE_BUILD_TYPE=Debug
+nmake
+${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/temp -P cmake_install.cmake
+:package_only
+${KDEWIN_PACKAGER_EXECUTABLE} -name ${_name} -root ${CMAKE_BINARY_DIR}/temp -srcroot ${CMAKE_SOURCE_DIR} -version ${_version} -notes \"${_notes}\" ${_options}
+"
+)
+ write_file(${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat "${CONTENT}")
+ add_custom_target(kdewin_package_debug_and_release_mingw_and_msvc
+ COMMAND ${CMAKE_BINARY_DIR}/kdewin_package_debug_and_release_mingw_and_msvc.bat
+ )
+ endif (KDEWIN_PACKAGER_FOUND)
+ENDMACRO (KDEWIN_PACKAGER)
+
diff --git a/cmake/modules/Win32Macros.cmake b/cmake/modules/Win32Macros.cmake
new file mode 100644
index 00000000..4385cc97
--- /dev/null
+++ b/cmake/modules/Win32Macros.cmake
@@ -0,0 +1,44 @@
+#
+# win32 macros
+#
+# Copyright (c) 2006-2007, Ralf Habacker
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+#
+
+if (WIN32)
+ #
+ # addExplorerWrapper creates batch files for fast access
+ # to the build environment from the win32 explorer.
+ #
+ # For mingw and nmake projects it's opens a command shell,
+ # for Visual Studio IDE's (at least tested with VS 8 2005) it
+ # opens the related .sln file with paths setting specified at
+ # configure time.
+ #
+ MACRO (addExplorerWrapper _projectname)
+ # write explorer wrappers
+ get_filename_component(CMAKE_BIN_PATH ${CMAKE_COMMAND} PATH)
+ set (ADD_PATH "${CMAKE_BIN_PATH}")
+
+ if (QT_QMAKE_EXECUTABLE)
+ get_filename_component(QT_BIN_PATH ${QT_QMAKE_EXECUTABLE} PATH)
+ set (ADD_PATH "${ADD_PATH};${QT_BIN_PATH}")
+ endif (QT_QMAKE_EXECUTABLE)
+
+ # add here more pathes
+
+ if (MINGW)
+ get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
+ set (ADD_PATH "${ADD_PATH};${MINGW_BIN_PATH}")
+ write_file (${CMAKE_BINARY_DIR}/${_projectname}-shell.bat "set PATH=${ADD_PATH};%PATH%\ncmd.exe")
+ else (MINGW)
+ if (CMAKE_BUILD_TOOL STREQUAL "nmake")
+ get_filename_component(VC_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
+ write_file (${CMAKE_BINARY_DIR}/${_projectname}-shell.bat "set PATH=${ADD_PATH};%PATH%\ncall \"${VC_BIN_PATH}\\vcvars32.bat\"\ncmd.exe")
+ else (CMAKE_BUILD_TOOL STREQUAL "nmake")
+ write_file (${CMAKE_BINARY_DIR}/${_projectname}-sln.bat "set PATH=${ADD_PATH};%PATH%\nstart ${_projectname}.sln")
+ endif (CMAKE_BUILD_TOOL STREQUAL "nmake")
+ endif (MINGW)
+ ENDMACRO (addExplorerWrapper)
+endif(WIN32)