From b577883841c960bdaf32e7bdd70b49adedb0d478 Mon Sep 17 00:00:00 2001 From: Zhuo Yang Date: Mon, 11 Apr 2022 21:15:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9LIB=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ofCmakeConfig | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ofCmakeConfig b/ofCmakeConfig index 3bdacaf..7318863 100755 --- a/ofCmakeConfig +++ b/ofCmakeConfig @@ -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}