blob: d4b6328b0181198f4b02efaddc92f5c828edf493 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
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)
|