添加对LIB项目的支持

This commit is contained in:
Zhuo Yang 2022-04-11 21:15:18 +08:00
parent 3a5f44b810
commit b577883841
1 changed files with 16 additions and 4 deletions

View File

@ -44,10 +44,23 @@ OF_link_flags="$OF_compile_flags $link_flags_extra"
# echo OF_link_flags: $OF_link_flags
OF_project_name=`cat Make/files | grep EXE | grep -oP '(?<=/).*$'`
OF_typestr="add_executable"
if [ -z $OF_project_name ]
then
OF_project_name=`cat Make/files | grep LIB | grep -oP '(?<=/).*$'`
OF_typestr="add_library"
fi
# echo OF_testCaseDir: '${CMAKE_SORCE_DIR}/testCase'
OF_sources=`cat Make/files | grep -oP '.*.C'`
OF_sources=`cat Make/files | grep -oP '.*\.C'`
# echo OF_sources: $OF_sources
# update OF_typestr
if [ $OF_typestr = "add_executable" ]
then
OF_typestr="$OF_typestr(\${project_name} \${OF_sources})"
else
OF_typestr="$OF_typestr(\${project_name} SHARED \${OF_sources})"
fi
str_inc=`echo $s | sed 's/ /\n/g' | grep -E '^-I' | sort | uniq |grep -oP '(?<=-I).*'`
OF_includeDir_tmp=${str_inc/%lnInclude/}
@ -65,6 +78,7 @@ OF_includeDir=`echo $OF_includeDir | sed 's/ /\n/g'`
OF_linkLib=`echo $s | sed 's/ /\n/g' | grep -E '^-l' | sort | uniq |grep -oP '(?<=-l).*'`
OF_linkDir=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
OF_linkDir=`echo "$OF_linkDir $FOAM_USER_LIBBIN" | sed 's/ /\n/g'`
# echo OF_linkLib: $OF_linkLib
# echo OF_linkDir: $OF_linkDir
@ -161,9 +175,7 @@ include_directories(
\${CMAKE_SOURCE_DIR}
)
add_executable(\${project_name}
\${OF_sources}
)
${OF_typestr}
target_link_libraries(
\${project_name}