mirror of
https://gitee.com/TarsCloud/TarsCpp.git
synced 2024-12-22 22:16:38 +08:00
fix cmakelist, open mysql in windows
This commit is contained in:
parent
39abedb07c
commit
22c4187e19
121
CMakeLists.txt
121
CMakeLists.txt
@ -5,11 +5,16 @@ project(tars_cpp)
|
||||
set(TARS_VERSION "2.0.0")
|
||||
add_definitions(-DTARS_VERSION="${TARS_VERSION}")
|
||||
|
||||
if(WIN32)
|
||||
option(TARS_MYSQL "option for mysql" OFF)
|
||||
else()
|
||||
option(TARS_MYSQL "option for mysql" ON)
|
||||
endif()
|
||||
|
||||
option(TARS_SSL "option for ssl" OFF)
|
||||
option(TARS_HTTP2 "option for http2" OFF)
|
||||
option(TARS_PROTOBUF "option for protocol" OFF)
|
||||
option(TARS_ZLIB "option for zip" OFF)
|
||||
#option(TARS_ZLIB "option for zip" OFF)
|
||||
|
||||
if(TARS_MYSQL)
|
||||
add_definitions(-DTARS_MYSQL=1)
|
||||
@ -27,9 +32,9 @@ if(TARS_PROTOBUF)
|
||||
add_definitions(-DTARS_PROTOBUF=1)
|
||||
endif()
|
||||
|
||||
if(TARS_ZLIB)
|
||||
add_definitions(-DTARS_ZLIB=1)
|
||||
endif()
|
||||
#if(TARS_ZLIB)
|
||||
#add_definitions(-DTARS_ZLIB=1)
|
||||
#endif()
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE off)
|
||||
|
||||
@ -85,12 +90,12 @@ if(TARS_PROTOBUF)
|
||||
link_directories(${PROTOBUF_DIR_LIB})
|
||||
endif()
|
||||
|
||||
if(TARS_ZLIB)
|
||||
set(ZLIB_DIR_INC "${THIRDPARTY_PATH}/z-lib")
|
||||
set(ZLIB_DIR_LIB "${THIRDPARTY_PATH}/z-lib")
|
||||
include_directories(${ZLIB_DIR_INC})
|
||||
link_directories(${ZLIB_DIR_LIB})
|
||||
endif()
|
||||
#if(TARS_ZLIB)
|
||||
# set(ZLIB_DIR_INC "${THIRDPARTY_PATH}/z-lib")
|
||||
# set(ZLIB_DIR_LIB "${THIRDPARTY_PATH}/z-lib")
|
||||
# include_directories(${ZLIB_DIR_INC})
|
||||
# link_directories(${ZLIB_DIR_LIB})
|
||||
#endif()
|
||||
|
||||
if(TARS_HTTP2)
|
||||
set(NGHTTP2_DIR_INC "${THIRDPARTY_PATH}/nghttp2-lib/lib/includes/")
|
||||
@ -112,43 +117,44 @@ set(LIB_MYSQL)
|
||||
set(LIB_HTTP2)
|
||||
set(LIB_SSL)
|
||||
set(LIB_CRYPTO)
|
||||
set(LIB_ZLIB)
|
||||
#set(LIB_ZLIB)
|
||||
set(LIB_PROTOBUF)
|
||||
|
||||
IF (WIN32)
|
||||
if(TARS_MYSQL)
|
||||
set(LIB_MYSQL "libmysql")
|
||||
endif()
|
||||
if(TARS_HTTP2)
|
||||
set(LIB_HTTP2 "libnghttp2_static")
|
||||
endif()
|
||||
if(TARS_SSL)
|
||||
set(LIB_SSL "libssl")
|
||||
set(LIB_CRYPTO "libcrypto")
|
||||
endif()
|
||||
if(TARS_ZLIB)
|
||||
set(LIB_ZLIB "libz")
|
||||
endif()
|
||||
if(TARS_MYSQL)
|
||||
set(LIB_MYSQL "libmysql")
|
||||
endif()
|
||||
if(TARS_HTTP2)
|
||||
set(LIB_HTTP2 "libnghttp2_static")
|
||||
endif()
|
||||
if(TARS_SSL)
|
||||
set(LIB_SSL "libssl")
|
||||
set(LIB_CRYPTO "libcrypto")
|
||||
endif()
|
||||
#if(TARS_ZLIB)
|
||||
# set(LIB_ZLIB "libz")
|
||||
#endif()
|
||||
|
||||
if(TARS_PROTOBUF)
|
||||
set(LIB_PROTOBUF "libprotoc")
|
||||
endif()
|
||||
#if(TARS_PROTOBUF)
|
||||
# set(LIB_PROTOBUF "libprotoc")
|
||||
#endif()
|
||||
ELSE()
|
||||
link_libraries(pthread dl)
|
||||
if(TARS_MYSQL)
|
||||
if(TARS_MYSQL)
|
||||
set(LIB_MYSQL "mysqlclient")
|
||||
endif()
|
||||
if(TARS_HTTP2)
|
||||
set(LIB_HTTP2 "nghttp2_static")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARS_SSL)
|
||||
set(LIB_SSL "ssl")
|
||||
set(LIB_CRYPTO "crypto")
|
||||
endif()
|
||||
if(TARS_ZLIB)
|
||||
set(LIB_ZLIB "z")
|
||||
endif()
|
||||
if(TARS_HTTP2)
|
||||
set(LIB_HTTP2 "nghttp2_static")
|
||||
endif()
|
||||
#
|
||||
#if(TARS_SSL)
|
||||
# set(LIB_SSL "ssl")
|
||||
# set(LIB_CRYPTO "crypto")
|
||||
#endif()
|
||||
#if(TARS_ZLIB)
|
||||
# set(LIB_ZLIB "z")
|
||||
#endif()
|
||||
if(TARS_PROTOBUF)
|
||||
set(LIB_PROTOBUF "protoc")
|
||||
endif()
|
||||
@ -215,22 +221,22 @@ ExternalProject_Add(${LIB_MYSQL}
|
||||
URL_MD5 c537c08c1276abc79d76e8e562bbcea5
|
||||
)
|
||||
endif()
|
||||
|
||||
if(TARS_ZLIB)
|
||||
ExternalProject_Add(${LIB_ZLIB}
|
||||
URL http://cdn.tarsyun.com/src/zlib-1.2.11.tar.gz
|
||||
PREFIX ${CMAKE_BINARY_DIR}
|
||||
INSTALL_DIR ${CMAKE_SOURCE_DIR}
|
||||
CONFIGURE_COMMAND cmake .
|
||||
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/z-lib
|
||||
BUILD_IN_SOURCE 1
|
||||
BUILD_COMMAND make zlibstatic
|
||||
LOG_CONFIGURE 1
|
||||
LOG_BUILD 1
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
|
||||
URL_MD5 1c9f62f0778697a09d36121ead88e08e
|
||||
)
|
||||
endif()
|
||||
#
|
||||
#if(TARS_ZLIB)
|
||||
#ExternalProject_Add(${LIB_ZLIB}
|
||||
# URL http://cdn.tarsyun.com/src/zlib-1.2.11.tar.gz
|
||||
# PREFIX ${CMAKE_BINARY_DIR}
|
||||
# INSTALL_DIR ${CMAKE_SOURCE_DIR}
|
||||
# CONFIGURE_COMMAND cmake .
|
||||
# SOURCE_DIR ${CMAKE_BINARY_DIR}/src/z-lib
|
||||
# BUILD_IN_SOURCE 1
|
||||
# BUILD_COMMAND make zlibstatic
|
||||
# LOG_CONFIGURE 1
|
||||
# LOG_BUILD 1
|
||||
# INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "install"
|
||||
# URL_MD5 1c9f62f0778697a09d36121ead88e08e
|
||||
# )
|
||||
#endif()
|
||||
|
||||
if(TARS_HTTP2)
|
||||
ExternalProject_Add(${LIB_HTTP2}
|
||||
@ -303,9 +309,8 @@ ENDIF (UNIX)
|
||||
|
||||
#-------------------------------------------------------------
|
||||
IF(WIN32)
|
||||
#set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe")
|
||||
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp.exe")
|
||||
|
||||
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/${CMAKE_BUILD_TYPE}/tars2cpp.exe")
|
||||
#set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp.exe")
|
||||
ELSE()
|
||||
set(TARS2CPP "${CMAKE_BINARY_DIR}/bin/tars2cpp")
|
||||
ENDIF()
|
||||
|
@ -513,7 +513,7 @@ int yy_flex_debug = 0;
|
||||
#define YY_MORE_ADJ 0
|
||||
#define YY_RESTORE_YY_MORE_OFFSET
|
||||
char *yytext;
|
||||
#line 1 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 1 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
/**
|
||||
* Tencent is pleased to support the open source community by making Tars available.
|
||||
*
|
||||
@ -529,7 +529,7 @@ char *yytext;
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
#line 20 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 20 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
@ -742,7 +742,7 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 67 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 67 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
|
||||
|
||||
#line 749 "tars.lex.cpp"
|
||||
@ -840,12 +840,12 @@ do_action: /* This label is used only to access EOF actions. */
|
||||
|
||||
case 1:
|
||||
YY_RULE_SETUP
|
||||
#line 69 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 69 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{ BEGIN(INCL); }
|
||||
YY_BREAK
|
||||
case 2:
|
||||
YY_RULE_SETUP
|
||||
#line 71 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 71 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if ( include_file_stack_ptr >= MAX_INCLUDE_DEPTH )
|
||||
{
|
||||
@ -878,7 +878,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
case YY_STATE_EOF(INCL):
|
||||
#line 101 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 101 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
--include_file_stack_ptr;
|
||||
if ( include_file_stack_ptr < 0 )
|
||||
@ -897,14 +897,14 @@ case YY_STATE_EOF(INCL):
|
||||
YY_BREAK
|
||||
case 3:
|
||||
YY_RULE_SETUP
|
||||
#line 117 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 117 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
return TARS_SCOPE_DELIMITER;
|
||||
}
|
||||
YY_BREAK
|
||||
case 4:
|
||||
YY_RULE_SETUP
|
||||
#line 121 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 121 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
// C++ comment
|
||||
bool e = false;
|
||||
@ -925,7 +925,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 5:
|
||||
YY_RULE_SETUP
|
||||
#line 139 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 139 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
// C comment
|
||||
bool e = false;
|
||||
@ -976,7 +976,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 6:
|
||||
YY_RULE_SETUP
|
||||
#line 187 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 187 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr ident = new StringGrammar;
|
||||
ident->v = yytext;
|
||||
@ -987,7 +987,7 @@ YY_RULE_SETUP
|
||||
case 7:
|
||||
/* rule 7 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 194 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 194 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr ident = new StringGrammar;
|
||||
ident->v = yytext;
|
||||
@ -1000,7 +1000,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 8:
|
||||
YY_RULE_SETUP
|
||||
#line 204 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 204 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
StringGrammarPtr str = new StringGrammar;
|
||||
bool e = false;
|
||||
@ -1115,7 +1115,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 9:
|
||||
YY_RULE_SETUP
|
||||
#line 316 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 316 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
errno = 0;
|
||||
IntergerGrammarPtr ptr = new IntergerGrammar;
|
||||
@ -1140,7 +1140,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 10:
|
||||
YY_RULE_SETUP
|
||||
#line 338 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 338 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
errno = 0;
|
||||
FloatGrammarPtr ptr = new FloatGrammar;
|
||||
@ -1175,7 +1175,7 @@ YY_RULE_SETUP
|
||||
case 11:
|
||||
/* rule 11 can match eol */
|
||||
YY_RULE_SETUP
|
||||
#line 369 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 369 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if(yytext[0] == '\n')
|
||||
{
|
||||
@ -1185,7 +1185,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 12:
|
||||
YY_RULE_SETUP
|
||||
#line 376 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 376 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
{
|
||||
if(yytext[0] < 32 || yytext[0] > 126)
|
||||
{
|
||||
@ -1204,7 +1204,7 @@ YY_RULE_SETUP
|
||||
YY_BREAK
|
||||
case 13:
|
||||
YY_RULE_SETUP
|
||||
#line 392 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 1211 "tars.lex.cpp"
|
||||
@ -2214,7 +2214,7 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 392 "/Volumes/MyData/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
#line 392 "/Users/jarod/centos/TarsCpp/tools/tarsgrammar/tars.l"
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user