bakaid commented on a change in pull request #656: MINIFI-1013 Used soci library. URL: https://github.com/apache/nifi-minifi-cpp/pull/656#discussion_r331522372
########## File path: extensions/sql/CMakeLists.txt ########## @@ -0,0 +1,148 @@ +# +# 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(${CMAKE_SOURCE_DIR}/extensions/ExtensionHeader.txt) +include_directories(../../thirdparty/rapidjson-1.1.0/include/ ../../thirdparty/rapidjson-1.1.0/include/rapidjson) +set(EXTRA_SOURCES "") +if (WIN32) +# set(EXTRA_SOURCES "win/*.cpp") +endif() + +file(GLOB SOURCES "*.cpp" "services/*.cpp" "processors/*.cpp" "data/*.cpp" ${EXTRA_SOURCES} ) + +add_library(minifi-sql STATIC ${SOURCES}) +set_property(TARGET minifi-sql PROPERTY POSITION_INDEPENDENT_CODE ON) +if(THREADS_HAVE_PTHREAD_ARG) + target_compile_options(PUBLIC minifi-sql "-pthread") +endif() +if(CMAKE_THREAD_LIBS_INIT) + target_link_libraries(minifi-sql "${CMAKE_THREAD_LIBS_INIT}") +endif() + +find_package(Patch) + +if(NOT WIN32) +set(ODBC_BYPRODUCT_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/iodbc-install/" CACHE STRING "iODBC install directory") + + ExternalProject_Add( + iodbc-external + GIT_REPOSITORY "https://github.com/openlink/iODBC.git" + GIT_TAG "d9293505804e775488582321420e427464e6c3ce" + BUILD_IN_SOURCE true + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/iodbc-src" + BUILD_COMMAND make + CMAKE_COMMAND "" + UPDATE_COMMAND "" + INSTALL_COMMAND make install + CONFIGURE_COMMAND "" + PATCH_COMMAND ./autogen.sh && ./configure --prefix=${ODBC_BYPRODUCT_DIR} + STEP_TARGETS build + EXCLUDE_FROM_ALL TRUE + BUILD_BYPRODUCTS ${ODBC_BYPRODUCT} + ) + + endif() +set(SOCI_BYPRODUCT_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty/soci-install" CACHE STRING "SOCI install directory") +if(WIN32) + set(BYPRODUCT "${SOCI_BYPRODUCT_DIR}/lib/libsoci_core_4_0.lib") + set(ODBC_BYPRODUCT "${SOCI_BYPRODUCT_DIR}/lib/libsoci_odbc_4_0.lib") + set(ODBC_OPTION "") + set(CMAKE_MODULE "") +else() + set(BYPRODUCT "${SOCI_BYPRODUCT_DIR}/lib64/libsoci_core.a") + set(ODBC_OPTION "-DODBC_BYPRODUCT_DIR=${ODBC_BYPRODUCT_DIR}") + set(ODBC_BYPRODUCT "${SOCI_BYPRODUCT_DIR}/lib64/libsoci_odbc.a") + set(CMAKE_MODULE "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/cmake/") +endif() + + + + ExternalProject_Add( + sql-external + GIT_REPOSITORY "https://github.com/SOCI/soci.git" + GIT_TAG "04e1870294918d20761736743bb6136314c42dd5" Review comment: I would prefer a released version here as well, but as I see there have been a lot of work on master since the last release, so if we need that, using a commit from master would be justifiable, but please add a comment to that effect. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services