1 Star 2 Fork 0

WXQ / TMCC

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CMakeLists.txt 2.78 KB
一键复制 编辑 原始数据 按行查看 历史
WXQ 提交于 2023-10-02 17:28 . First Commit, Version 0.1.0
#------------------------------------------------------------------------------
# Copyright (c) [2023] [Xianqing Wang at XiDian Univ.]
# [XD-TMCC] is licensed under Mulan PSL v2.
#
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#
# See the Mulan PSL v2 for more details.
#------------------------------------------------------------------------------
#
# This file was auto-included by ../CMakeLists.txt
#
include (../CMake.utils.txt)
# Initialized by the CFLAGS environment variable
#set(CMAKE_C_FLAGS "-Wall -Wno-builtin-macro-redefined")
set(CMAKE_C_FLAGS "-Wall")
if (ENABLE_ASAN)
message(STATUS "build with ASAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
endif ()
#
# local library of TMCC
#
# targetName of tmcc library
set(LIB_TMCC libtmcc)
# core modules as a library
include_directories(libtmcc/include)
file(GLOB_RECURSE libtmcc_h libtmcc/*.h)
file(GLOB_RECURSE libtmcc_c libtmcc/*.c)
# using hard-coded algorithm to scan tokens
#add_compile_definitions(SCAN_BY_HARDCODE=1)
add_library(${LIB_TMCC} STATIC ${libtmcc_c} ${libtmcc_h})
redefine_file_macro(${LIB_TMCC})
add_definitions(-Wno-builtin-macro-redefined)
# output file name is libtmcc.a(gcc) or tmcc.lib(MSVC)
set_target_properties(${LIB_TMCC} PROPERTIES OUTPUT_NAME "tmcc")
#tell following EXE, find library files from here:
link_directories(${LIBRARY_OUTPUT_DIRECTORY})
#
# Lexer Main, only for study, test the lexer of TMCC
#
set(LEXER_EXE lexer-main)
file(GLOB_RECURSE lexer_main_c ${LEXER_EXE}/*.c)
file(GLOB_RECURSE lexer_main_h ${LEXER_EXE}/*.h)
add_executable(${LEXER_EXE} ${lexer_main_c} ${lexer_main_h})
redefine_file_macro(${LEXER_EXE})
target_link_libraries(${LEXER_EXE} ${LIB_TMCC})
add_dependencies(${LEXER_EXE} ${LIB_TMCC})
#
# Parser Main, only for study, test the parser of TMCC
#
set(PARSER_MAIN parser-main)
file(GLOB_RECURSE parser_main_c ${PARSER_MAIN}/*.c)
file(GLOB_RECURSE parser_main_h ${PARSER_MAIN}/*.h)
add_executable(${PARSER_MAIN} ${parser_main_c} ${parser_main_h})
redefine_file_macro(${PARSER_MAIN})
target_link_libraries(${PARSER_MAIN} ${LIB_TMCC})
add_dependencies(${PARSER_MAIN} ${LIB_TMCC})
#
# TMCC Main
#
set(EXE_TMCC xdtmcc)
file(GLOB_RECURSE tmcc_main_c tmcc-main/*.c)
file(GLOB_RECURSE tmcc_main_h tmcc-main/*.h)
add_executable(${EXE_TMCC} ${tmcc_main_c} ${tmcc_main_h})
redefine_file_macro(${EXE_TMCC})
target_link_libraries(${EXE_TMCC} ${LIB_TMCC})
add_dependencies(${EXE_TMCC} ${LIB_TMCC})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/hapywxq/tmcc.git
git@gitee.com:hapywxq/tmcc.git
hapywxq
tmcc
TMCC
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891