Skip to content

Commit 72379df

Browse files
committed
cmake: Move PackageSpecs.cmake to packaging/
1 parent 82f0392 commit 72379df

File tree

4 files changed

+97
-94
lines changed

4 files changed

+97
-94
lines changed

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,7 @@ message("Connector libraries will be installed at: ${INSTALL_LIB_DIR}")
648648
option(WITH_PACKAGES "Configure for building binary/source packages" OFF)
649649

650650
if(WITH_PACKAGES)
651-
include(PackageSpecs.cmake)
652651
ADD_SUBDIRECTORY(packaging)
653-
ADD_SUBDIRECTORY(packaging/WiX)
654652
endif()
655653

656654

packaging/CMakeLists.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,89 @@
2727
# along with this program; if not, write to the Free Software Foundation, Inc.,
2828
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2929

30+
31+
# ======================================================================
32+
# Licenses for binary packages
33+
# ======================================================================
34+
35+
if(EXISTS "${CMAKE_SOURCE_DIR}/LICENSE.mysql.txt")
36+
set(LIC_FILE "LICENSE.mysql") # Without ".txt" extension
37+
else()
38+
set(LIC_FILE "LICENSE") # Without ".txt" extension
39+
endif()
40+
41+
if(WIN32)
42+
set(info_ext ".txt")
43+
set(newline WIN32)
44+
else()
45+
set(info_ext "")
46+
set(newline UNIX)
47+
endif()
48+
49+
set(info_files README ${LIC_FILE})
50+
51+
foreach(file ${info_files})
52+
53+
set(file_src "${CMAKE_SOURCE_DIR}/${file}.txt")
54+
set(file_bin "${CMAKE_BINARY_DIR}/${file}${info_ext}")
55+
56+
configure_file("${file_src}" "${file_bin}" NEWLINE_STYLE ${newline})
57+
install(FILES "${file_bin}" DESTINATION ${INSTALL_DOC_DIR} COMPONENT Readme)
58+
59+
endforeach()
60+
61+
set(CPACK_RESOURCE_FILE_README "${CMAKE_BINARY_DIR}/README${info_ext}")
62+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/${LIC_FILE}${info_ext}")
63+
#set(CPACK_RESOURCE_FILE_INSTALL "...") # FIXME
64+
65+
66+
# ======================================================================
67+
# Package specifications
68+
# ======================================================================
69+
70+
if(APPLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
71+
message(FATAL_ERROR "To create packages for OSX, build with clang compiler.")
72+
endif()
73+
74+
75+
include(PackageSpecs.cmake)
76+
3077
CONFIGURE_FILE(mysql-connector-c++.spec.in ${CMAKE_CURRENT_BINARY_DIR}/mysql-connector-c++.spec @ONLY)
3178
ADD_SUBDIRECTORY(deb-in)
79+
80+
81+
# ======================================================================
82+
# Custom target to build packages.
83+
# ======================================================================
84+
#
85+
# Note: target build_packages builds TGZ/ZIP packages using cpack.
86+
# Other package types are built outside of cmake/cpack, cmake is only
87+
# used to prepare information necessary to build them.
88+
#
89+
# Note: For information on building MSI packages look at WiX/CMakeLists.txt
90+
#
91+
92+
93+
add_custom_target(build_packages
94+
COMMAND cpack --config CPackConfig.cmake --verbose -C $<CONFIGURATION>
95+
COMMAND cpack --config CPackSourceConfig.cmake
96+
DEPENDS clean_source_tree
97+
)
98+
99+
add_custom_target(clean_source_tree
100+
COMMAND git clean -x -d -f
101+
COMMAND git submodule foreach --recursive git clean -x -d -f
102+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
103+
COMMENT "Cleaning source tree"
104+
)
105+
106+
set_property(TARGET clean_source_tree build_packages
107+
PROPERTY EXCLUDE_FROM_ALL 1
108+
)
109+
110+
set_property(TARGET clean_source_tree build_packages
111+
PROPERTY EXCLUDE_FROM_DEFAULT_BUILD 1
112+
)
113+
114+
115+
include(CPack)

PackageSpecs.cmake renamed to packaging/PackageSpecs.cmake

Lines changed: 8 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@
2929
#
3030
# Specifications for Connector/C++ binary and source packages
3131
#
32-
# TODO
33-
# - Generate HTML docs with Doxygen and include in bin packages
34-
#
3532
# Note: CPACK_XXX variables must be set before include(CPack)
3633
#
3734

35+
set(CONCPP_PACKAGE_BASE_VERSION
36+
"${CONCPP_VERSION_MAJOR}.${CONCPP_VERSION_MINOR}")
37+
set(CONCPP_PACKAGE_NUMERIC_VERSION
38+
"${CONCPP_PACKAGE_BASE_VERSION}.${CONCPP_VERSION_MICRO}")
39+
set(CONCPP_PACKAGE_VERSION
40+
"${CONCPP_PACKAGE_NUMERIC_VERSION}${CONCPP_VERSION_LEVEL}")
41+
3842
# ======================================================================
3943
# Set some initial CPack variables
4044
# ======================================================================
@@ -75,8 +79,7 @@ if(PLATFORM_NAME)
7579

7680
elseif(WIN32)
7781

78-
include(CheckTypeSize)
79-
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
82+
if(IS64BIT)
8083
set(CPACK_SYSTEM_NAME "winx64")
8184
else()
8285
set(CPACK_SYSTEM_NAME "win32")
@@ -118,46 +121,6 @@ endif()
118121

119122
message("Binary package name: ${CPACK_PACKAGE_FILE_NAME}")
120123

121-
# FIXME maybe place elsewhere?
122-
if(APPLE AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
123-
message(FATAL_ERROR "To create packages for OSX, build with clang compiler.")
124-
endif()
125-
126-
127-
# ======================================================================
128-
# Licenses for binary packages
129-
# ======================================================================
130-
131-
if(EXISTS "${CMAKE_SOURCE_DIR}/LICENSE.mysql.txt")
132-
set(LIC_FILE "LICENSE.mysql") # Without ".txt" extension
133-
else()
134-
set(LIC_FILE "LICENSE") # Without ".txt" extension
135-
endif()
136-
137-
if(WIN32)
138-
set(info_ext ".txt")
139-
set(newline WIN32)
140-
else()
141-
set(info_ext "")
142-
set(newline UNIX)
143-
endif()
144-
145-
set(info_files README ${LIC_FILE})
146-
147-
foreach(file ${info_files})
148-
149-
set(file_src "${CMAKE_SOURCE_DIR}/${file}.txt")
150-
set(file_bin "${CMAKE_BINARY_DIR}/${file}${info_ext}")
151-
152-
configure_file("${file_src}" "${file_bin}" NEWLINE_STYLE ${newline})
153-
install(FILES "${file_bin}" DESTINATION ${INSTALL_DOC_DIR} COMPONENT Readme)
154-
155-
endforeach()
156-
157-
set(CPACK_RESOURCE_FILE_README "README${info_ext}")
158-
set(CPACK_RESOURCE_FILE_LICENSE "${LIC_FILE}${info_ext}")
159-
#set(CPACK_RESOURCE_FILE_INSTALL "...") # FIXME
160-
161124

162125
# ======================================================================
163126
# Specs for source package
@@ -179,30 +142,4 @@ list(APPEND CPACK_SOURCE_IGNORE_FILES "\\\\.git.*")
179142
list(APPEND CPACK_SOURCE_IGNORE_FILES "/jenkins/")
180143
list(APPEND CPACK_SOURCE_IGNORE_FILES "CTestConfig.cmake")
181144

182-
include(CPack)
183-
184-
185-
# ======================================================================
186-
# Custom target to build packages.
187-
# ======================================================================
188145

189-
add_custom_target(build_packages
190-
COMMAND cpack --config CPackConfig.cmake --verbose -C $<CONFIGURATION>
191-
COMMAND cpack --config CPackSourceConfig.cmake
192-
DEPENDS clean_source_tree
193-
)
194-
195-
add_custom_target(clean_source_tree
196-
COMMAND git clean -x -d -f
197-
COMMAND git submodule foreach --recursive git clean -x -d -f
198-
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
199-
COMMENT "Cleaning source tree"
200-
)
201-
202-
set_property(TARGET clean_source_tree build_packages
203-
PROPERTY EXCLUDE_FROM_ALL 1
204-
)
205-
206-
set_property(TARGET clean_source_tree build_packages
207-
PROPERTY EXCLUDE_FROM_DEFAULT_BUILD 1
208-
)

version.cmake

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,9 @@ set(
6262
CACHE INTERNAL "version info"
6363
)
6464

65-
# **** IMPORTANT ****
66-
#
67-
# The code below needs to be replaced when moving from one version
68-
# series to another. I.e. when moving from 4.0 to 4.1, from 4.13 to
69-
# 5.0 and so on.
70-
#
71-
# You DON'T change this code for patchlevel version changes, i.e.
72-
# when only the third part of the version is changed.
73-
#
74-
# You can use any GUID generator that produces random GUID codes. You
75-
# can also or invent a code of your own if you follow the syntax rules.
76-
77-
set(CONCPP_MINORMAJOR_UPGRADE_CODE "a1195164-bc2d-45fb-a5e5-1ba834771ce8")
7865

79-
set(CONCPP_PACKAGE_BASE_VERSION
80-
"${CONCPP_VERSION_MAJOR}.${CONCPP_VERSION_MINOR}")
81-
set(CONCPP_PACKAGE_NUMERIC_VERSION
82-
"${CONCPP_PACKAGE_BASE_VERSION}.${CONCPP_VERSION_MICRO}")
83-
set(CONCPP_PACKAGE_VERSION
84-
"${CONCPP_PACKAGE_NUMERIC_VERSION}${CONCPP_VERSION_LEVEL}")
85-
86-
message("Building version ${CONCPP_PACKAGE_VERSION}")
66+
message(
67+
"Building version "
68+
"${CONCPP_VERSION_MAJOR}.${CONCPP_VERSION_MINOR}.${CONCPP_VERSION_MICRO}"
69+
"${CONCPP_VERSION_LEVEL}"
70+
)

0 commit comments

Comments
 (0)