复现已有算法
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# ##############################################################################
|
||||
# function drogon_create_views(target source_path output_path
|
||||
# [TRUE to use_path_as_namespace] [prefixed namespace])
|
||||
# ##############################################################################
|
||||
function(drogon_create_views arg)
|
||||
if(ARGC LESS 3)
|
||||
message(STATUS "arguments error when calling drogon_create_views")
|
||||
return()
|
||||
endif()
|
||||
file(MAKE_DIRECTORY ${ARGV2})
|
||||
file(GLOB_RECURSE SCP_LIST ${ARGV1}/*.csp)
|
||||
foreach(cspFile ${SCP_LIST})
|
||||
file(RELATIVE_PATH
|
||||
inFile
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${cspFile})
|
||||
if(ARGC GREATER 3 AND ARGV3)
|
||||
string(REPLACE "/"
|
||||
"_"
|
||||
f1
|
||||
${inFile})
|
||||
string(REPLACE "\\"
|
||||
"_"
|
||||
f2
|
||||
${f1})
|
||||
string(REPLACE ".csp"
|
||||
""
|
||||
outputFile
|
||||
${f2})
|
||||
set(p2ns "")
|
||||
if("${ARGV3}" STREQUAL "TRUE")
|
||||
set(p2ns "--path-to-namespace")
|
||||
endif()
|
||||
if ( (ARGC EQUAL 5) AND ( NOT "${ARGV4}" STREQUAL "") )
|
||||
string(REPLACE "::" "_" nSpace ${ARGV4})
|
||||
set(outputFile "${nSpace}_${outputFile}")
|
||||
set(ns -n ${ARGV4})
|
||||
else()
|
||||
set(ns "")
|
||||
endif()
|
||||
add_custom_command(OUTPUT ${ARGV2}/${outputFile}.h ${ARGV2}/${outputFile}.cc
|
||||
COMMAND drogon_ctl
|
||||
ARGS
|
||||
create
|
||||
view
|
||||
${inFile}
|
||||
${p2ns}
|
||||
-o
|
||||
${ARGV2}
|
||||
${ns}
|
||||
DEPENDS ${cspFile}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM)
|
||||
set(VIEWSRC ${VIEWSRC} ${ARGV2}/${outputFile}.cc)
|
||||
else()
|
||||
get_filename_component(classname ${cspFile} NAME_WE)
|
||||
add_custom_command(OUTPUT ${ARGV2}/${classname}.h ${ARGV2}/${classname}.cc
|
||||
COMMAND drogon_ctl
|
||||
ARGS
|
||||
create
|
||||
view
|
||||
${inFile}
|
||||
-o
|
||||
${ARGV2}
|
||||
DEPENDS ${cspFile}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM)
|
||||
set(VIEWSRC ${VIEWSRC} ${ARGV2}/${classname}.cc)
|
||||
endif()
|
||||
endforeach()
|
||||
target_sources(${ARGV0} PRIVATE ${VIEWSRC})
|
||||
endfunction(drogon_create_views)
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||
set(CPACK_PACKAGE_CONTACT "https://github.com/drogonframework/drogon")
|
||||
|
||||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_PACKAGE_VERSION "${DROGON_VERSION}")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows")
|
||||
|
||||
# DEB
|
||||
# Figure out dependencies automatically.
|
||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||
|
||||
# Should be set automatically, but it is not.
|
||||
execute_process(COMMAND dpkg --print-architecture
|
||||
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
# The default does not produce valid Debian package names.
|
||||
set(CPACK_DEBIAN_FILE_NAME
|
||||
"${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-0_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb")
|
||||
|
||||
# RPM
|
||||
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
|
||||
|
||||
# Figure out dependencies automatically.
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQ ON)
|
||||
|
||||
# Should be set automatically, but it is not.
|
||||
execute_process(COMMAND uname -m
|
||||
OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-0.${CPACK_RPM_PACKAGE_ARCHITECTURE}")
|
||||
|
||||
include(CPack)
|
||||
@@ -0,0 +1,79 @@
|
||||
#==================================================================================================#
|
||||
# Adapted and re-written from Catch2 to work with Drogon Test #
|
||||
# #
|
||||
# Usage #
|
||||
# 1. make sure this module is in the path or add this otherwise: #
|
||||
# set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules/") #
|
||||
# 2. make sure that you've enabled testing option for the project by the call: #
|
||||
# enable_testing() #
|
||||
# 3. add the lines to the script for testing target (sample CMakeLists.txt): #
|
||||
# project(testing_target) #
|
||||
# enable_testing() #
|
||||
# #
|
||||
# file(GLOB SOURCE_FILES "*.cpp") #
|
||||
# add_executable(${PROJECT_NAME} ${SOURCE_FILES}) #
|
||||
# #
|
||||
# include(ParseAndAddDrogonTests) #
|
||||
# ParseAndAddDrogonTests(${PROJECT_NAME}) #
|
||||
#==================================================================================================#
|
||||
|
||||
cmake_minimum_required(VERSION 3.5...3.31)
|
||||
|
||||
# This removes the contents between
|
||||
# - block comments (i.e. /* ... */)
|
||||
# - full line comments (i.e. // ... )
|
||||
# contents have been read into '${CppCode}'.
|
||||
# !keep partial line comments
|
||||
function(RemoveComments CppCode)
|
||||
string(ASCII 2 CMakeBeginBlockComment)
|
||||
string(ASCII 3 CMakeEndBlockComment)
|
||||
string(REGEX REPLACE "/\\*" "${CMakeBeginBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\\*/" "${CMakeEndBlockComment}" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "${CMakeBeginBlockComment}[^${CMakeEndBlockComment}]*${CMakeEndBlockComment}" "" ${CppCode} "${${CppCode}}")
|
||||
string(REGEX REPLACE "\n[ \t]*//+[^\n]+" "\n" ${CppCode} "${${CppCode}}")
|
||||
|
||||
set(${CppCode} "${${CppCode}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Worker function
|
||||
function(ParseFile SourceFile TestTarget)
|
||||
set(FullSourcePath ${CMAKE_CURRENT_SOURCE_DIR}/${SourceFile})
|
||||
if(NOT EXISTS ${FullSourcePath})
|
||||
return()
|
||||
endif()
|
||||
file(STRINGS ${FullSourcePath} Contents NEWLINE_CONSUME)
|
||||
|
||||
# Remove block and fullline comments
|
||||
RemoveComments(Contents)
|
||||
|
||||
# Find definition of test names
|
||||
string(REGEX MATCHALL "[ \t]*DROGON_TEST[ \t]*\\\([a-zA-Z0-9_]+\\\)" Tests "${Contents}")
|
||||
|
||||
foreach(TestLine ${Tests})
|
||||
# Strip newlines
|
||||
string(REGEX REPLACE "\\\\\n|\n" "" TestLine "${TestLine}")
|
||||
|
||||
# Get the name of the test
|
||||
string(REGEX REPLACE "[ \t]*DROGON_TEST[ \t]*" "" TestLine "${TestLine}")
|
||||
string(REGEX MATCHALL "[a-zA-Z0-9_]+" TestName "${TestLine}")
|
||||
|
||||
# Validate that a test name and tags have been provided
|
||||
list(LENGTH TestName TestNameLength)
|
||||
if(NOT TestNameLength EQUAL 1)
|
||||
message(FATAL_ERROR "${TestName} in ${SourceFile} is not a valid test name."
|
||||
" Either a bug in the Drogon Test CMake parser or a bug in the test itself")
|
||||
endif()
|
||||
|
||||
# Add the test and set its properties
|
||||
add_test(NAME "${TestName}" COMMAND ${TestTarget} -r ${TestName} ${AdditionalCatchParameters})
|
||||
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
# entry point
|
||||
function(ParseAndAddDrogonTests TestTarget)
|
||||
get_target_property(SourceFiles ${TestTarget} SOURCES)
|
||||
foreach(SourceFile ${SourceFiles})
|
||||
ParseFile(${SourceFile} ${TestTarget})
|
||||
endforeach()
|
||||
endfunction()
|
||||
@@ -0,0 +1,62 @@
|
||||
# - Config file for the Drogon package
|
||||
# It defines the following variables
|
||||
# DROGON_INCLUDE_DIRS - include directories for Drogon
|
||||
# DROGON_LIBRARIES - libraries to link against
|
||||
# DROGON_EXECUTABLE - the drogon_ctl executable
|
||||
# Drogon_FOUND
|
||||
# This module defines the following IMPORTED target:
|
||||
# Drogon::Drogon
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
find_dependency(Jsoncpp REQUIRED)
|
||||
find_dependency(Trantor REQUIRED)
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32)
|
||||
find_dependency(UUID REQUIRED)
|
||||
endif(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" AND NOT WIN32)
|
||||
find_dependency(ZLIB REQUIRED)
|
||||
if(@pg_FOUND@)
|
||||
find_dependency(pg)
|
||||
endif()
|
||||
if(@SQLite3_FOUND@)
|
||||
find_dependency(SQLite3)
|
||||
endif()
|
||||
if(@MySQL_FOUND@)
|
||||
find_dependency(MySQL)
|
||||
endif()
|
||||
if(@Brotli_FOUND@)
|
||||
find_dependency(Brotli)
|
||||
endif()
|
||||
if(@COZ-PROFILER_FOUND@)
|
||||
find_dependency(coz-profiler)
|
||||
endif()
|
||||
if(@Hiredis_FOUND@)
|
||||
find_dependency(Hiredis)
|
||||
endif()
|
||||
if(@yaml-cpp_FOUND@)
|
||||
find_dependency(yaml-cpp)
|
||||
endif()
|
||||
if(@BUILD_SHARED_LIBS@)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
if(@HAS_STD_FILESYSTEM_PATH@)
|
||||
find_dependency(Filesystem)
|
||||
find_package(Filesystem COMPONENTS Final REQUIRED)
|
||||
endif()
|
||||
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
|
||||
get_filename_component(DROGON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
if(NOT TARGET Drogon::Drogon)
|
||||
include("${DROGON_CMAKE_DIR}/DrogonTargets.cmake")
|
||||
include("${DROGON_CMAKE_DIR}/DrogonUtilities.cmake")
|
||||
include("${DROGON_CMAKE_DIR}/ParseAndAddDrogonTests.cmake")
|
||||
endif()
|
||||
|
||||
get_target_property(DROGON_INCLUDE_DIRS Drogon::Drogon INTERFACE_INCLUDE_DIRECTORIES)
|
||||
set(DROGON_LIBRARIES Drogon::Drogon)
|
||||
set(DROGON_EXECUTABLE drogon_ctl)
|
||||
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#cmakedefine01 USE_POSTGRESQL
|
||||
#cmakedefine01 LIBPQ_SUPPORTS_BATCH_MODE
|
||||
#cmakedefine01 USE_MYSQL
|
||||
#cmakedefine01 USE_SQLITE3
|
||||
#cmakedefine01 HAS_STD_FILESYSTEM_PATH
|
||||
#cmakedefine OpenSSL_FOUND
|
||||
#cmakedefine Boost_FOUND
|
||||
|
||||
#cmakedefine COMPILATION_FLAGS "@COMPILATION_FLAGS@@DROGON_CXX_STANDARD@"
|
||||
#cmakedefine COMPILER_COMMAND "@COMPILER_COMMAND@"
|
||||
#cmakedefine COMPILER_ID "@COMPILER_ID@"
|
||||
|
||||
#cmakedefine INCLUDING_DIRS "@INCLUDING_DIRS@"
|
||||
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define MAJOR @DROGON_MAJOR_VERSION@
|
||||
#define MINOR @DROGON_MINOR_VERSION@
|
||||
#define PATCH @DROGON_PATCH_VERSION@
|
||||
#define DROGON_VERSION "@DROGON_VERSION_STRING@"
|
||||
#define DROGON_VERSION_SHA1 "@GIT_SHA1@"
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
#include <filesystem>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::filesystem::path aPath("../");
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#include <uuid.h>
|
||||
int main()
|
||||
{
|
||||
uuid_t uu;
|
||||
uuid_generate(uu);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <uuid.h>
|
||||
int main()
|
||||
{
|
||||
uuid_t *uuid;
|
||||
uuid_create(&uuid);
|
||||
uuid_make(uuid, UUID_MAKE_V1);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
#include <libpq-fe.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
PQenterPipelineMode(NULL);
|
||||
PQexitPipelineMode(NULL);
|
||||
PQpipelineSync(NULL);
|
||||
PQpipelineStatus(NULL);
|
||||
}
|
||||
Reference in New Issue
Block a user