2017-10-26 02:51:21 +08:00
if ( EXISTS "${CURRENT_INSTALLED_DIR}/include/mysql/mysql.h" )
message ( FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible." )
endif ( )
2018-03-08 03:10:12 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
message ( FATAL_ERROR "libmysql cannot currently be cross-compiled for UWP" )
endif ( )
2018-03-14 17:56:49 +08:00
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" AND NOT CMAKE_SYSTEM_NAME OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" )
message ( FATAL_ERROR "Oracle has dropped support in libmysql for 32-bit Windows." )
2018-03-13 23:14:58 +08:00
endif ( )
2019-06-12 05:41:02 +08:00
if ( VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" )
message ( WARNING "libmysql needs ncurses on LINUX, please install ncurses first.\nOn Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel." )
endif ( )
2017-10-26 02:51:21 +08:00
include ( vcpkg_common_functions )
2018-03-03 04:28:34 +08:00
vcpkg_from_github (
O U T _ S O U R C E _ P A T H S O U R C E _ P A T H
R E P O m y s q l / m y s q l - s e r v e r
2018-03-13 23:14:58 +08:00
R E F m y s q l - 8 . 0 . 4
S H A 5 1 2 8 d 9 1 2 9 e 7 6 7 0 e 8 8 d f 1 4 2 3 8 2 9 9 0 5 2 a 5 f e 6 d 4 f 3 e 4 0 b f 2 7 e f 7 a 3 c a 8 f 4 f 9 1 f b 4 0 5 0 7 b 1 3 4 6 3 e 9 b d 2 4 4 3 5 b 3 4 e 5 d 0 6 c 5 d 0 5 6 d f b 2 5 9 f b 0 4 e 7 7 c c 2 5 1 b 1 8 8 e e a 7 3 4 d b 5 6 4 2 b e
2018-03-03 04:28:34 +08:00
H E A D _ R E F m a s t e r
2018-03-20 01:30:33 +08:00
P A T C H E S
2019-06-12 05:41:02 +08:00
i g n o r e - b o o s t - v e r s i o n . p a t c h
s y s t e m - l i b s . p a t c h
l i n u x _ l i b m y s q l . p a t c h
2017-10-26 02:51:21 +08:00
)
2018-03-13 23:14:58 +08:00
file ( REMOVE_RECURSE ${ SOURCE_PATH } /include/boost_1_65_0 )
2018-03-08 03:10:12 +08:00
set ( STACK_DIRECTION )
if ( VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64" )
set ( STACK_DIRECTION -DSTACK_DIRECTION=-1 )
endif ( )
2017-10-26 02:51:21 +08:00
vcpkg_configure_cmake (
S O U R C E _ P A T H $ { S O U R C E _ P A T H }
2018-03-13 23:14:58 +08:00
P R E F E R _ N I N J A
2017-10-26 02:51:21 +08:00
O P T I O N S
- D W I T H O U T _ S E R V E R = O N
- D W I T H _ U N I T _ T E S T S = O F F
- D E N A B L E D _ P R O F I L I N G = O F F
- D W I X _ D I R = O F F
2018-03-08 03:10:12 +08:00
- D H A V E _ L L V M _ L I B C P P _ E X I T C O D E = 1
$ { S T A C K _ D I R E C T I O N }
2017-10-26 02:51:21 +08:00
- D W I N D O W S _ R U N T I M E _ M D = O N # Note: this disables _replacement_ of /MD with /MT. If /MT is specified, it will be preserved.
2018-03-13 23:14:58 +08:00
- D I G N O R E _ B O O S T _ V E R S I O N = O N
2018-03-20 01:30:33 +08:00
- D W I T H _ S S L = s y s t e m
- D W I T H _ I C U = s y s t e m
- D W I T H _ L I B E V E N T = s y s t e m
- D W I T H _ L Z M A = s y s t e m
- D W I T H _ L Z 4 = s y s t e m
- D W I T H _ Z L I B = s y s t e m
2017-10-26 02:51:21 +08:00
)
2018-03-20 01:30:33 +08:00
vcpkg_install_cmake ( ADD_BIN_TO_PATH )
2017-10-26 02:51:21 +08:00
# delete debug headers
file ( REMOVE_RECURSE
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / i n c l u d e )
# switch mysql into /mysql
file ( RENAME ${ CURRENT_PACKAGES_DIR } /include ${ CURRENT_PACKAGES_DIR } /include2 )
file ( MAKE_DIRECTORY ${ CURRENT_PACKAGES_DIR } /include )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /include2 ${ CURRENT_PACKAGES_DIR } /include/mysql )
## delete useless vcruntime/scripts/bin/msg file
file ( REMOVE_RECURSE
$ { C U R R E N T _ P A C K A G E S _ D I R } / s h a r e
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / s h a r e
$ { C U R R E N T _ P A C K A G E S _ D I R } / b i n
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / b i n
$ { C U R R E N T _ P A C K A G E S _ D I R } / d o c s
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / d o c s
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / d e b u g )
# remove misc files
file ( REMOVE
2018-03-13 23:14:58 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / L I C E N S E
2017-10-26 02:51:21 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / R E A D M E
2018-03-13 23:14:58 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / L I C E N S E
2017-10-26 02:51:21 +08:00
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / R E A D M E )
# remove not-related libs
file ( REMOVE
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / m y s q l s e r v i c e s . l i b
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / m y s q l s e r v i c e s . l i b )
if ( VCPKG_LIBRARY_LINKAGE STREQUAL "static" )
file ( REMOVE
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / l i b m y s q l . l i b
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / l i b m y s q l . d l l
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / l i b m y s q l . p d b
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / l i b m y s q l . l i b
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / l i b m y s q l . d l l
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / l i b m y s q l . p d b )
else ( )
file ( REMOVE
$ { C U R R E N T _ P A C K A G E S _ D I R } / l i b / m y s q l c l i e n t . l i b
$ { C U R R E N T _ P A C K A G E S _ D I R } / d e b u g / l i b / m y s q l c l i e n t . l i b )
2019-06-12 05:41:02 +08:00
# correct the dll directory
2018-10-04 14:09:42 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release" )
file ( MAKE_DIRECTORY ${ CURRENT_PACKAGES_DIR } /bin )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /lib/libmysql.dll ${ CURRENT_PACKAGES_DIR } /bin/libmysql.dll )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /lib/libmysql.pdb ${ CURRENT_PACKAGES_DIR } /bin/libmysql.pdb )
endif ( )
2019-06-12 05:41:02 +08:00
2018-10-04 14:09:42 +08:00
if ( NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug" )
file ( MAKE_DIRECTORY ${ CURRENT_PACKAGES_DIR } /debug/bin )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /debug/lib/libmysql.dll ${ CURRENT_PACKAGES_DIR } /debug/bin/libmysql.dll )
file ( RENAME ${ CURRENT_PACKAGES_DIR } /debug/lib/libmysql.pdb ${ CURRENT_PACKAGES_DIR } /debug/bin/libmysql.pdb )
endif ( )
2017-10-26 02:51:21 +08:00
endif ( )
2018-03-20 04:17:59 +08:00
file ( READ ${ CURRENT_PACKAGES_DIR } /include/mysql/mysql_com.h _contents )
string ( REPLACE "#include <mysql/udf_registration_types.h>" "#include \" mysql/udf_registration_types.h\ "" _contents "${_contents}" )
file ( WRITE ${ CURRENT_PACKAGES_DIR } /include/mysql/mysql_com.h "${_contents}" )
2017-10-26 02:51:21 +08:00
# copy license
2018-03-13 23:14:58 +08:00
file ( COPY ${ SOURCE_PATH } /LICENSE DESTINATION ${ CURRENT_PACKAGES_DIR } /share/libmysql )
2019-06-12 05:41:02 +08:00
file ( RENAME ${ CURRENT_PACKAGES_DIR } /share/libmysql/LICENSE ${ CURRENT_PACKAGES_DIR } /share/libmysql/copyright )