mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
build demo-01 is ok
This commit is contained in:
parent
e0f9de3d97
commit
493502a0dc
@ -1,7 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
project(msc VERSION 0.1.0)
|
||||
project(pikascript VERSION 0.1.0)
|
||||
|
||||
include_directories(src/package/pikascript-core)
|
||||
include_directories(src/boot/demo01-led)
|
||||
|
||||
add_subdirectory(src/package/pikascript-core)
|
||||
add_subdirectory(src/boot/demo01-led)
|
||||
|
||||
|
@ -1,43 +1,8 @@
|
||||
# 获得当前目录名
|
||||
string(REGEX REPLACE "/$" "" CURRENT_FOLDER_ABSOLUTE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
string(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CURRENT_FOLDER_ABSOLUTE})
|
||||
|
||||
|
||||
# 获取 main.c 文件
|
||||
file(GLOB_RECURSE main_file ./*main.c*)
|
||||
|
||||
# 获取.a文件
|
||||
file(GLOB_RECURSE lib_file ${PROJECT_SOURCE_DIR}/lib/*.a)
|
||||
|
||||
# 添加头文件路径
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
# 添加第三方库(add)头文件路径
|
||||
link_directories(${PROJECT_SOURCE_DIR}/lib)
|
||||
|
||||
#生成可执行文件
|
||||
ADD_EXECUTABLE(${CURRENT_FOLDER}.bin ${main_file})
|
||||
|
||||
# ---------------------------------------> START support clang
|
||||
llvm_map_components_to_libnames(llvm_libs support core irreader)
|
||||
# Link against LLVM libraries
|
||||
target_link_libraries(${CURRENT_FOLDER}.bin ${llvm_libs})
|
||||
# ---------------------------------------> START support clang
|
||||
|
||||
TARGET_LINK_LIBRARIES(${CURRENT_FOLDER}.bin
|
||||
-Wl,--start-group
|
||||
${lib_file}
|
||||
-Wl,--end-group
|
||||
)
|
||||
|
||||
# 添加链接库
|
||||
#execute_process(
|
||||
#COMMAND ls ${PROJECT_SOURCE_DIR}/lib
|
||||
#OUTPUT_VARIABLE libs
|
||||
# )
|
||||
#string(REPLACE "\n" ";" libList ${libs})
|
||||
#foreach(item ${libList})
|
||||
#message("add lib: ${item}")
|
||||
#TARGET_LINK_LIBRARIES(${CURRENT_FOLDER}_exe ${PROJECT_SOURCE_DIR}/lib/${item})
|
||||
#endforeach()
|
||||
|
||||
set(BINARY ${CMAKE_PROJECT_NAME}_demo01-led)
|
||||
file(GLOB_RECURSE THIS_SOURCES LIST_DIRECTORIES false *.h *.cpp *.c)
|
||||
set(SOURCES ${THIS_SOURCES})
|
||||
add_executable(${BINARY} ${THIS_SOURCES})
|
||||
# 链接src生成的lib库和gtest库
|
||||
target_link_libraries(${BINARY} PUBLIC
|
||||
${CMAKE_PROJECT_NAME}-core
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user