Skip to content

Fix MinGW cross-compilation #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Merge remote-tracking branch 'upstream/master'
  • Loading branch information
SaiyanRiku committed Jul 16, 2020
commit 12ef4a9c28f0ffe0d9dc9ae620cf724d67e3f7aa
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/INFO_SRC
/CMakeSettings.json
.vs
out
128 changes: 40 additions & 88 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

PROJECT(MySQL_CONCPP)

include(version.cmake)

# Load cmake modules

include(cdk/cmake/setup.cmake)
Expand All @@ -77,6 +75,26 @@ include(dependency) # find_dependency()
include(config_options) # add_config_option()
include(libutils) # merge_libraries()

#
# Detect if we are configured as stand-alone project, or sub-project.
#

if(PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME)

SET(concpp_stand_alone 1)

else()

MESSAGE("Building Connector/C++ as part of ${CMAKE_PROJECT_NAME} project")
SET(concpp_stand_alone 0)
set(WITH_TESTS OFF)
set(WITH_DOC OFF)
set(WITH_HEADER_CHECKS OFF)

endif()

include(version.cmake)

message("Building on system: ${CMAKE_SYSTEM} (${CMAKE_SYSTEM_PROCESSOR})")
message("Using cmake generator: ${CMAKE_GENERATOR}")
#message("Compiler identification: ${CMAKE_CXX_COMPILER_ID}")
Expand Down Expand Up @@ -105,12 +123,6 @@ else()
endif()


#
# Connector System Configuration
#
include(config.cmake)


#
# Install settings
# ================
Expand Down Expand Up @@ -336,6 +348,17 @@ add_config_option(WITH_JDBC BOOL DEFAULT OFF

if(WITH_JDBC)
add_subdirectory(jdbc)

# Note: These include paths are to be used in a build tree. In
# this situation the jdbc public headers are not installed yet and
# we use a copy of them placed inside the build tree.

target_include_directories(connector-jdbc
PUBLIC "${PROJECT_BINARY_DIR}/jdbc/cppconn"
PUBLIC "${PROJECT_SOURCE_DIR}/include"
PUBLIC "${PROJECT_BINARY_DIR}/jdbc/include/jdbc"
)

endif()


Expand Down Expand Up @@ -367,12 +390,6 @@ if(MAINTAINER_MODE)
endif(MAINTAINER_MODE)


#
# We use UUID generator taken from server sources.
#

add_subdirectory(cdk/extra/uuid uuid)

#
# Connector/C++ components
#
Expand Down Expand Up @@ -428,6 +445,13 @@ add_custom_command(TARGET libconcpp POST_BUILD
)
endif()

#
# Stop here if this is a sub-project of a bigger project.
#

if (NOT concpp_stand_alone)
return()
endif()

#
# Install specifications
Expand Down Expand Up @@ -500,18 +524,6 @@ if(BUILD_STATIC)
add_definitions(-DSTATIC_CONCPP)
endif()


# Auto-generated test targets

IF (WITH_TESTS)
# Unit tests declared with ADD_NG_TEST() (see cdk/cmake/testing.cmake)
ADD_TEST_TARGET()

# Test for public headers declared with ADD_HEADERS()
# (see cdk/cmake/headers.cmake)
ADD_HEADERS_TEST()
ENDIF (WITH_TESTS)

#
# Sample code to try things out
#
Expand All @@ -524,10 +536,6 @@ if(WITH_JDBC)

add_executable(try_jdbc EXCLUDE_FROM_ALL try_jdbc.cc)
target_link_libraries(try_jdbc connector-jdbc)
target_include_directories(try_jdbc
PRIVATE "${PROJECT_BINARY_DIR}/include/mysql"
PRIVATE "${PROJECT_BINARY_DIR}/include/jdbc/cppconn"
)

endif()

Expand Down Expand Up @@ -567,67 +575,11 @@ endif()
endif()

#
# Linking test
# ------------
#
# This test compiles test application using internal installation of built
# connector. It is important to work with installed files because otherwise
# cmake does its magic to resolve missing dependencies when building test code.
# We don't want this to happen to make sure that test code can be built with
# connector library only, as we distribute it.
# Other tests.
#
# Note: internal installation into <binary_dir>/install is done by directly
# executing cmake_install.cmake script which is generated by cmake.
#
# TODO: Also test dynamic linking (requires adopting test app project)
#

file(REMOVE_RECURSE ${PROJECT_BINARY_DIR}/link_test)
file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/link_test)

unset(jdbc_options)
if(WITH_JDBC)
#message("-- BOOST_ROOT: ${BOOST_ROOT}")
list(APPEND jdbc_options -DWITH_JDBC=ON -DWITH_BOOST=${BOOST_ROOT})
endif()
include(testing/tests.cmake)

add_custom_target(link_test
COMMAND ${CMAKE_COMMAND} -E remove_directory ${PROJECT_BINARY_DIR}/install
COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/install
COMMAND ${CMAKE_COMMAND}
-D CMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/install
-D CMAKE_INSTALL_CONFIG_NAME=$<$<BOOL:$<CONFIGURATION>>:$<CONFIGURATION>>$<$<NOT:$<BOOL:$<CONFIGURATION>>>:Release>
-P ${PROJECT_BINARY_DIR}/cmake_install.cmake
COMMAND ${CMAKE_COMMAND} -E remove -f ${PROJECT_BINARY_DIR}/link_test/CMakeCache.txt
COMMAND ${CMAKE_COMMAND}
-G "${CMAKE_GENERATOR}"
-D WITH_CONCPP=${PROJECT_BINARY_DIR}/install
-D WITH_SSL="${WITH_SSL}"
-D BUILD_STATIC=${BUILD_STATIC}
-D STATIC_MSVCRT=${STATIC_MSVCRT}
${jdbc_options}
${PROJECT_SOURCE_DIR}/testapp
COMMAND ${CMAKE_COMMAND} --build . --config $<CONFIGURATION> --clean-first
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/link_test
VERBATIM
)

set_target_properties(link_test PROPERTIES FOLDER "Tests")

add_dependencies(link_test connector)
#if(TARGET connector-merge)
# add_dependencies(link_test connector-merge)
#endif()
#if(WITH_JDBC)
# add_dependencies(link_test build_jdbc)
#endif()

# TDOD: Use ${CMAKE_COMMAND}, but evaluated at test time, not here.

add_test(NAME Link_test
COMMAND cmake --build . --target link_test --config $<CONFIGURATION>
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)

#
# Create the INFO_SRC and INFO_BIN files
Expand Down
44 changes: 0 additions & 44 deletions CTestConfig.cmake

This file was deleted.

64 changes: 34 additions & 30 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Introduction
third-party software which may be included in this distribution of
MySQL Connector/C++ 8.0.

Last updated: March 2020
Last updated: June 2020

Licensing Information

Expand All @@ -33,8 +33,7 @@ Licensing Information
a copy of which is reproduced below and can also be found along with
its FAQ at http://oss.oracle.com/licenses/universal-foss-exception.

Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights
reserved.
Copyright (c) 2008, 2020, Oracle and/or its affiliates.

Election of GPLv2

Expand Down Expand Up @@ -921,33 +920,38 @@ zlib
Oracle gratefully acknowledges the contributions of Jean-loup Gailly
and Mark Adler in creating the zlib general purpose compression library
which is used in this product.
zlib.h -- interface of the 'zlib' general purpose compression library
Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler

zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.3, July 18th, 2005
Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler

zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.5, April 19th, 2010
Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software. Permission is granted to anyone to use this software
for any purpose,including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would
be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly [email protected]
Mark Adler [email protected]
(C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:


1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.

2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.

3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
[email protected] [email protected]

If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code.

If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
the FAQ for more information on the distribution of modified source versions.

ZSTD

Expand Down
2 changes: 1 addition & 1 deletion buildinfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ FUNCTION(GENERATE_INFO_SRC)
MESSAGE("Generating INFO_SRC")

IF (NOT EXISTS INFO_SRC)
SET(INFO_VERSION "${CONCPP_PACKAGE_VERSION}")
SET(INFO_VERSION "${CONCPP_VERSION}")

find_program(GIT_FOUND NAMES git)

Expand Down
13 changes: 7 additions & 6 deletions cdk/extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ endif()
enable_pic()
add_subdirectory(zlib)

# Note: zlib writes configuration header into build location
# and this location needs to be added to include path when
# using zlib.

target_include_directories(zlib PUBLIC
${PROJECT_BINARY_DIR}/extra/zlib
${PROJECT_SOURCE_DIR}/extra/zlib
${CMAKE_CURRENT_BINARY_DIR}/zlib
zlib
)


Expand All @@ -55,7 +59,4 @@ target_include_directories(lz4 PUBLIC lz4)

add_subdirectory(zstd)

target_include_directories(zstd PUBLIC
${PROJECT_BINARY_DIR}/extra/zstd/lib
${PROJECT_SOURCE_DIR}/extra/zstd/lib
)
target_include_directories(zstd PUBLIC zstd/lib)
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.