Update the drogon_ctl command to support sqlite3

This commit is contained in:
antao 2018-12-27 17:45:15 +08:00
parent 6db8df6bc0
commit 9ee1ee929c
4 changed files with 54 additions and 3 deletions

View File

@ -97,7 +97,7 @@ if (SQLITE3_FOUND)
link_libraries(${SQLITE3_LIBRARIES})
aux_source_directory(${PROJECT_SOURCE_DIR}/orm_lib/src/sqlite3_impl DIR_SRCS)
set(USE_ORM TRUE)
endif (SQLITE3_FOUND)
endif()
message(STATUS ${DIR_SRCS})

View File

@ -62,12 +62,17 @@ static void newJsonFindFile(std::ofstream &jsonFile)
jsonFile << templ->genText();
}
static void newMySQLFindFile(std::ofstream &jsonFile)
static void newMySQLFindFile(std::ofstream &mysqlFile)
{
auto templ = DrTemplateBase::newTemplate("FindMySQL.csp");
jsonFile << templ->genText();
mysqlFile << templ->genText();
}
static void newSQLite3FindFile(std::ofstream &sqlite3File)
{
auto templ = DrTemplateBase::newTemplate("FindSQLite3.csp");
sqlite3File << templ->genText();
}
static void newConfigFile(std::ofstream &configFile)
{
@ -108,6 +113,8 @@ void create_project::createProject(const std::string &projectName)
newUuidFindFile(uuidFile);
std::ofstream mysqlFile("cmake_modules/FindMySQL.cmake", std::ofstream::out);
newMySQLFindFile(mysqlFile);
std::ofstream sqlite3File("cmake_modules/FindSQLite3.cmake", std::ofstream::out);
newSQLite3FindFile(sqlite3File);
std::ofstream gitFile(".gitignore", std::ofstream::out);
newGitIgFile(gitFile);

View File

@ -0,0 +1,37 @@
# Copyright (C) 2007-2009 LuaDist.
# Created by Peter Kapec <kapecp@gmail.com>
# Redistribution and use of this file is allowed according to the terms of the MIT license.
# For details see the COPYRIGHT file distributed with LuaDist.
# Note:
# Searching headers and libraries is very simple and is NOT as powerful as scripts
# distributed with CMake, because LuaDist defines directories to search for.
# Everyone is encouraged to contact the author with improvements. Maybe this file
# becomes part of CMake distribution sometimes.
# - Find sqlite3
# Find the native SQLITE3 headers and libraries.
#
# SQLITE3_INCLUDE_DIRS - where to find sqlite3.h, etc.
# SQLITE3_LIBRARIES - List of libraries when using sqlite.
# SQLITE3_FOUND - True if sqlite found.
# Look for the header file.
FIND_PATH(SQLITE3_INCLUDE_DIR NAMES sqlite3.h)
# Look for the library.
FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3)
# Handle the QUIETLY and REQUIRED arguments and set SQLITE3_FOUND to TRUE if all listed variables are TRUE.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR)
# Copy the results to the output variables.
IF(SQLITE3_FOUND)
SET(SQLITE3_LIBRARIES ${SQLITE3_LIBRARY})
SET(SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDE_DIR})
ELSE(SQLITE3_FOUND)
SET(SQLITE3_LIBRARIES)
SET(SQLITE3_INCLUDE_DIRS)
ENDIF(SQLITE3_FOUND)
MARK_AS_ADVANCED(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)

View File

@ -75,6 +75,13 @@ if(MYSQL_FOUND)
endif()
endif()
#Find sqlite3.
find_package (SQLite3)
if (SQLITE3_FOUND)
include_directories(${SQLITE3_INCLUDE_DIRS})
link_libraries(${SQLITE3_LIBRARIES})
endif()
AUX_SOURCE_DIRECTORY(./ SRC_DIR)
AUX_SOURCE_DIRECTORY(controllers CTL_SRC)
AUX_SOURCE_DIRECTORY(filters FILTER_SRC)