1 Star 0 Fork 0

ylyhappy/安卓代码生产器

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMakeLists.txt 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
ylyhappy 提交于 2024-09-27 09:03 . init
cmake_minimum_required(VERSION 3.29)
project(sqlGen)
set(CMAKE_CXX_STANDARD 17)
set(FLEXCXX_EXECUTABLE flexc++)
set(BISONCPP_EXECUTABLE bisonc++)
set(FLEXCPP_INPUT ${CMAKE_SOURCE_DIR}/sqlG.l) # Update this with the correct path if necessary
set(FLEXCPP_OUTPUTDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(FLEXCPP_LEX_SOURCE ${FLEXCPP_OUTPUTDIR}/lex.cc)
# Copy SQL resources to the build directory
file(GLOB SQL_FILES ${CMAKE_SOURCE_DIR}/resources/*.sql)
# Specify the destination directory for SQL files in the build directory
set(DEST_DIR ${CMAKE_BINARY_DIR}/resources)
# Create a custom target to copy the SQL files
add_custom_target(copy_sql_files ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/resources ${DEST_DIR}
COMMENT "Copying SQL files to build directory"
)
# 手动生成 C++ 源文件
add_custom_command(
OUTPUT ${FLEXCPP_LEX_SOURCE}
#COMMAND ${FLEXCXX_EXECUTABLE} ${FLEXCPP_INPUT} --baseclass-header=FlexCppScannerBase.hpp --class-header=FlexCppScanner.hpp --class-name=FlexCppScanner --lex-source=flexcpplex.cpp --target-directory ${FLEXCPP_OUTPUTDIR}
COMMAND ${FLEXCXX_EXECUTABLE} ${FLEXCPP_INPUT} --target-directory ${FLEXCPP_OUTPUTDIR}
DEPENDS ${FLEXCPP_INPUT}
COMMENT "Generating lexer.cpp from lexer.l"
)
# Custom command to generate parser.cpp and parser.h from BisonC++
# add_custom_command(
# OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp ${CMAKE_CURRENT_BINARY_DIR}/parser.h
# COMMAND ${BISONCXX_EXECUTABLE} ${BISONCPP_INPUT} -o ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
# DEPENDS ${BISONCPP_INPUT}
# COMMENT "Generating parser.cpp and parser.h from sqlG.ypp"
# )
# 添加生成的源文件到项目中
add_executable(${PROJECT_NAME} # 可执行文件名称
${FLEXCPP_LEX_SOURCE}
main.cpp
create_tablt_sql_define.hpp
enum_classes.hpp
create_table_sql_define.cpp # 你的其他源文件
)
add_dependencies(${PROJECT_NAME} copy_sql_files)
# 连接 FlexC++ 生成的代码到你的可执行文件
target_link_libraries(${PROJECT_NAME} stdc++fs)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ylyhappy/android-code-producer.git
git@gitee.com:ylyhappy/android-code-producer.git
ylyhappy
android-code-producer
安卓代码生产器
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385