-
Notifications
You must be signed in to change notification settings - Fork 104
MINIFICPP-2866 Add Conan support for SOCI and iODBC libraries #2218
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
Open
lordgamez
wants to merge
1
commit into
apache:MINIFICPP-2861
Choose a base branch
from
lordgamez:MINIFICPP-2866
base: MINIFICPP-2861
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+588
−187
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # Define byproducts | ||
| set(IODBC_BYPRODUCT "lib/libiodbc.a") | ||
|
|
||
| set(IODBC_BYPRODUCT_DIR "${CMAKE_BINARY_DIR}/thirdparty/iodbc-install/") | ||
|
|
||
| set(IODBC_PC "${Patch_EXECUTABLE}" -p1 -i "${CMAKE_SOURCE_DIR}/thirdparty/iodbc/all/patches/GCC-15-needs-typedef-SQLRETURN-HPROC.patch") | ||
| # Build project | ||
| ExternalProject_Add( | ||
| iodbc-external | ||
| URL "https://github.com/openlink/iODBC/archive/v3.52.16.tar.gz" | ||
| URL_HASH "SHA256=a0cf0375b462f98c0081c2ceae5ef78276003e57cdf1eb86bd04508fb62a0660" | ||
| BUILD_IN_SOURCE true | ||
| SOURCE_DIR "${CMAKE_BINARY_DIR}/thirdparty/iodbc-src" | ||
| PATCH_COMMAND "${IODBC_PC}" | ||
| BUILD_COMMAND make | ||
| CMAKE_COMMAND "" | ||
| UPDATE_COMMAND "" | ||
| INSTALL_COMMAND make install | ||
| CONFIGURE_COMMAND bash "-c" "./autogen.sh && ./configure --prefix=${IODBC_BYPRODUCT_DIR} --with-pic CFLAGS='${CMAKE_C_FLAGS} -std=gnu17'" | ||
| STEP_TARGETS build | ||
| BUILD_BYPRODUCTS "${IODBC_BYPRODUCT_DIR}/${IODBC_BYPRODUCT}" | ||
| EXCLUDE_FROM_ALL TRUE | ||
| ) | ||
|
|
||
| # Set variables | ||
| set(IODBC_FOUND "YES" CACHE STRING "" FORCE) | ||
| set(IODBC_INCLUDE_DIRS "${IODBC_BYPRODUCT_DIR}/include" CACHE STRING "" FORCE) | ||
| set(IODBC_LIBRARIES "${IODBC_BYPRODUCT_DIR}/${IODBC_BYPRODUCT}" CACHE STRING "" FORCE) | ||
|
|
||
| # Set exported variables for FindPackage.cmake | ||
| set(EXPORTED_IODBC_INCLUDE_DIRS "${IODBC_INCLUDE_DIRS}" CACHE STRING "" FORCE) | ||
| set(EXPORTED_IODBC_LIBRARIES "${IODBC_LIBRARIES}" CACHE STRING "" FORCE) | ||
|
|
||
| # Create imported targets | ||
| add_library(ODBC::ODBC STATIC IMPORTED) | ||
| set_target_properties(ODBC::ODBC PROPERTIES IMPORTED_LOCATION "${IODBC_LIBRARIES}") | ||
| add_dependencies(ODBC::ODBC iodbc-external) | ||
| file(MAKE_DIRECTORY ${IODBC_INCLUDE_DIRS}) | ||
| set_property(TARGET ODBC::ODBC APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${IODBC_INCLUDE_DIRS}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| if(MINIFI_IODBC_SOURCE STREQUAL "CONAN") | ||
| message("Using Conan to install iODBC") | ||
| find_package(ODBC REQUIRED) | ||
| elseif(MINIFI_IODBC_SOURCE STREQUAL "BUILD") | ||
| message("Using CMake to build iODBC from source") | ||
| include(BundledIodbc) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| if(MINIFI_SOCI_SOURCE STREQUAL "CONAN") | ||
| message("Using Conan to install SOCI") | ||
| find_package(SOCI REQUIRED) | ||
| if(NOT TARGET SOCI::SOCI) | ||
| add_library(SOCI::SOCI INTERFACE IMPORTED) | ||
| target_link_libraries(SOCI::SOCI INTERFACE SOCI::soci_core_static SOCI::soci_odbc_static) | ||
| endif() | ||
| elseif(MINIFI_SOCI_SOURCE STREQUAL "BUILD") | ||
| message("Using CMake to build SOCI from source") | ||
| include(Soci) | ||
| endif() | ||
|
lordgamez marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| include(FetchContent) | ||
|
|
||
| include(fmt) | ||
|
|
||
| set(PATCH_FILE1 "${CMAKE_SOURCE_DIR}/thirdparty/soci/all/patches/disable-sqlwchar-support.patch") | ||
| set(PATCH_FILE2 "${CMAKE_SOURCE_DIR}/thirdparty/soci/all/patches/odbc-get-parameter-name-bounds-safe.patch") | ||
| set(PC ${Bash_EXECUTABLE} -c "set -x &&\ | ||
| (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE1}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE1}\\\") &&\ | ||
| (\\\"${Patch_EXECUTABLE}\\\" -p1 -R -s -f --dry-run -i \\\"${PATCH_FILE2}\\\" || \\\"${Patch_EXECUTABLE}\\\" -p1 -N -i \\\"${PATCH_FILE2}\\\")") | ||
|
lordgamez marked this conversation as resolved.
|
||
|
|
||
| set(SOCI_TESTS OFF CACHE BOOL "" FORCE) | ||
| set(SOCI_SHARED OFF CACHE BOOL "" FORCE) | ||
| set(SOCI_ODBC ON CACHE BOOL "" FORCE) | ||
| set(SOCI_SQLITE3 OFF CACHE BOOL "" FORCE) | ||
| set(SOCI_LTO OFF CACHE BOOL "" FORCE) | ||
| set(WITH_BOOST OFF CACHE BOOL "" FORCE) | ||
|
|
||
| FetchContent_Declare( | ||
| soci | ||
| URL "https://github.com/SOCI/soci/archive/refs/tags/v4.1.4.tar.gz" | ||
| URL_HASH "SHA256=144f017cccc2e2d806badb3313d6ab3c67a1925bccaa747a46fb3907108a615d" | ||
| PATCH_COMMAND "${PC}" | ||
| SYSTEM | ||
| ) | ||
|
lordgamez marked this conversation as resolved.
|
||
|
|
||
| FetchContent_MakeAvailable(soci) | ||
|
|
||
| if(NOT WIN32) | ||
| add_dependencies(soci_core ODBC::ODBC) | ||
| endif() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.