From 54ed76ec2d47596f5a8eb672bf6708d0cc9b1de7 Mon Sep 17 00:00:00 2001 From: freemine Date: Mon, 26 Oct 2020 08:22:48 +0800 Subject: [PATCH] start to enable build in windows --- src/connector/odbc/CMakeLists.txt | 9 +++++++++ src/connector/odbc/src/CMakeLists.txt | 18 ++++++++++++++++++ src/connector/odbc/src/todbc_log.h | 4 ++++ src/connector/odbc/tests/CMakeLists.txt | 6 ++++++ 4 files changed, 37 insertions(+) diff --git a/src/connector/odbc/CMakeLists.txt b/src/connector/odbc/CMakeLists.txt index 3a179fc175..1480a0af73 100644 --- a/src/connector/odbc/CMakeLists.txt +++ b/src/connector/odbc/CMakeLists.txt @@ -26,3 +26,12 @@ IF (TD_LINUX_64) ENDIF () ENDIF () +IF (TD_WINDOWS_64) + find_package(FLEX) + if(NOT FLEX_FOUND) + message(FATAL_ERROR "you need to install flex first") + else () + ADD_SUBDIRECTORY(src) + ADD_SUBDIRECTORY(tests) + endif() +ENDIF () diff --git a/src/connector/odbc/src/CMakeLists.txt b/src/connector/odbc/src/CMakeLists.txt index d8438e9817..19ee23b19f 100644 --- a/src/connector/odbc/src/CMakeLists.txt +++ b/src/connector/odbc/src/CMakeLists.txt @@ -22,3 +22,21 @@ IF (TD_LINUX_64) install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/install.sh ${CMAKE_BINARY_DIR})") ENDIF () +IF (TD_WINDOWS_64) + FLEX_TARGET(todbcFlexScanner + todbc_scanner.l + ${CMAKE_CURRENT_BINARY_DIR}/todbc_scanner.c + ) + set(todbc_flex_scanner_src + ${FLEX_todbcFlexScanner_OUTPUTS} + ) + AUX_SOURCE_DIRECTORY(. SRC) + + # generate dynamic library (*.so) + ADD_LIBRARY(todbc SHARED ${SRC} ${todbc_flex_scanner_src}) + SET_TARGET_PROPERTIES(todbc PROPERTIES CLEAN_DIRECT_OUTPUT 1) + SET_TARGET_PROPERTIES(todbc PROPERTIES VERSION ${TD_VER_NUMBER} SOVERSION 1) + TARGET_LINK_LIBRARIES(todbc taos_static) + target_include_directories(todbc PUBLIC + .) +ENDIF () diff --git a/src/connector/odbc/src/todbc_log.h b/src/connector/odbc/src/todbc_log.h index ff0409fef6..4f5b008d05 100644 --- a/src/connector/odbc/src/todbc_log.h +++ b/src/connector/odbc/src/todbc_log.h @@ -16,7 +16,11 @@ #ifndef _todbc_log_h_ #define _todbc_log_h_ +#ifdef _MSC_VER +#include "msvcLibgen.h" +#else #include +#endif #include #include diff --git a/src/connector/odbc/tests/CMakeLists.txt b/src/connector/odbc/tests/CMakeLists.txt index ac57a5647f..1649b45e02 100644 --- a/src/connector/odbc/tests/CMakeLists.txt +++ b/src/connector/odbc/tests/CMakeLists.txt @@ -5,3 +5,9 @@ IF (TD_LINUX) ADD_EXECUTABLE(tcodbc main.c) TARGET_LINK_LIBRARIES(tcodbc odbc) ENDIF () + +IF (TD_WINDOWS_64) + AUX_SOURCE_DIRECTORY(. SRC) + ADD_EXECUTABLE(tcodbc main.c) + TARGET_LINK_LIBRARIES(tcodbc odbc) +ENDIF () -- GitLab