mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-24 06:59:07 +08:00
[libodb-mysql] init
This commit is contained in:
parent
0e254766fd
commit
7cc75cea73
44
ports/libodb-mysql/CMakeLists.txt
Normal file
44
ports/libodb-mysql/CMakeLists.txt
Normal file
@ -0,0 +1,44 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(libodb-mysql VERSION 2.4.0 LANGUAGES CXX)
|
||||
find_package(odb 2.4.0 REQUIRED COMPONENTS libodb)
|
||||
INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
|
||||
set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
|
||||
file(GLOB_RECURSE libodb_src
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
*.cxx)
|
||||
add_library(libodb-mysql ${libodb_src})
|
||||
target_include_directories(libodb-mysql
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:include>
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
|
||||
)
|
||||
|
||||
target_link_libraries(libodb-mysql PRIVATE odb::libodb ${MYSQL_LIB})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(libodb-mysql PRIVATE
|
||||
-DLIBODB_MYSQL_DYNAMIC_LIB
|
||||
-DLIBODB_MYSQL_HAVE_UNLOCK_NOTIFY)
|
||||
else()
|
||||
target_compile_definitions(libodb-mysql PRIVATE
|
||||
-DLIBODB_MYSQL_STATIC_LIB
|
||||
-DLIBODB_MYSQL_HAVE_UNLOCK_NOTIFY)
|
||||
endif()
|
||||
install(TARGETS libodb-mysql EXPORT odb_mysqlConfig
|
||||
COMPONENT mysql
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
if(LIBODB_INSTALL_HEADERS)
|
||||
install(DIRECTORY odb DESTINATION include/
|
||||
COMPONENT mysql
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
PATTERN "*.hxx"
|
||||
PATTERN "*.ixx"
|
||||
PATTERN "*.txx"
|
||||
)
|
||||
endif()
|
||||
install(EXPORT odb_mysqlConfig NAMESPACE odb:: COMPONENT mysql DESTINATION share/odb)
|
||||
export(TARGETS libodb-mysql NAMESPACE odb:: FILE odb_mysqlConfig.cmake)
|
4
ports/libodb-mysql/CONTROL
Normal file
4
ports/libodb-mysql/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: libodb-mysql
|
||||
Version: 2.4.0-1
|
||||
Description: MySQL support for the ODB ORM library
|
||||
Build-Depends: libodb, libmysql
|
45
ports/libodb-mysql/portfile.cmake
Normal file
45
ports/libodb-mysql/portfile.cmake
Normal file
@ -0,0 +1,45 @@
|
||||
# Common Ambient Variables:
|
||||
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
|
||||
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
|
||||
# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT}
|
||||
# PORT = current port name (zlib, etc)
|
||||
# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc)
|
||||
# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic)
|
||||
# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic)
|
||||
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
|
||||
# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm)
|
||||
#
|
||||
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libodb-mysql-2.4.0)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://www.codesynthesis.com/download/odb/2.4/libodb-mysql-2.4.0.tar.gz"
|
||||
FILENAME "libodb-mysql-2.4.0.tar.gz"
|
||||
SHA512 c27b73c3f61dccdd149c11c122185f645a00d5bc346b366ee65b738f8719c39d03fad07a0d55b62b3db9e3ad2507679c24ddda331e5d110f367ad32f7cf8b910
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
set(MYSQL_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include/mysql")
|
||||
set(MYSQL_LIB "${CURRENT_INSTALLED_DIR}/lib/libmysql.lib")
|
||||
set(MYSQL_LIB_DEBUG "${CURRENT_INSTALLED_DIR}/debug/lib/libmysql.lib")
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS
|
||||
-DMYSQL_INCLUDE_DIR=${MYSQL_INCLUDE_DIR}
|
||||
OPTIONS_RELEASE
|
||||
-DMYSQL_LIB=${MYSQL_LIB}
|
||||
OPTIONS_DEBUG
|
||||
-DLIBODB_INSTALL_HEADERS=OFF
|
||||
-DMYSQL_LIB=${MYSQL_LIB_DEBUG}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/odb/odb_mysqlConfig-debug.cmake LIBODB_DEBUG_TARGETS)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LIBODB_DEBUG_TARGETS "${LIBODB_DEBUG_TARGETS}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/odb/odb_mysqlConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libodb-mysql)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libodb-mysql/LICENSE ${CURRENT_PACKAGES_DIR}/share/libodb-mysql/copyright)
|
||||
vcpkg_copy_pdbs()
|
Loading…
Reference in New Issue
Block a user