删除冗余代码;添加occ脚本

This commit is contained in:
2022-08-29 00:10:53 +08:00
parent b577883841
commit cca0de5e85
6 changed files with 23 additions and 65 deletions

View File

@ -3,12 +3,6 @@ Script="${0##*/}" # Need 'Script' for wmakeFunctions messages
scriptsDir="${0%/*}"/scripts # wmake/scripts directory
. "$scriptsDir"/wmakeFunctions # Source wmake functions
# TODO: 检查当前路径是否是CMAKE_SOURCE_DIR
# 其中包含.vscode, CMakeLists.txt
# ...
# TODO: 根据OF环境变量设置安装目录
printInfo() {
if [ -f "$WM_DIR"/makefiles/info ]
@ -40,8 +34,6 @@ link_flags_extra="-Xlinker $link_flags_extra"
OF_compile_flags=`printInfo "cxxflags"`
OF_compile_flags="$OF_compile_flags -iquote."
OF_link_flags="$OF_compile_flags $link_flags_extra"
# echo OF_compile_flags: $OF_compile_flags
# echo OF_link_flags: $OF_link_flags
OF_project_name=`cat Make/files | grep EXE | grep -oP '(?<=/).*$'`
OF_typestr="add_executable"
@ -51,10 +43,7 @@ then
OF_typestr="add_library"
fi
# echo OF_testCaseDir: '${CMAKE_SORCE_DIR}/testCase'
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})"
@ -79,57 +68,6 @@ 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
# 写入文件 .vscode/of-gdb.sh
mkdir -p .vscode
cat > .vscode/of-gdb.sh <<EOF
#!/bin/bash
source $FOAM_ETC/bashrc WM_MPLIB=$WM_MPLIB WM_COMPILE_OPTION=$WM_COMPILE_OPTION WM_COMPILER=$WM_COMPILER
/usr/bin/gdb "\$@"
EOF
# 写入文件 .vscode/launch.json
cat > .vscode/launch.json << EOF
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
// Resolved by CMake Tools:
"program": "\${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": true,
"cwd": "\${workspaceFolder}/testCase",
"environment": [
{
// add the directory where our target was built to the PATHs
// it gets resolved by CMake Tools:
"name": "PATH",
"value": "\${env:PATH}:\${command:cmake.getLaunchTargetDirectory}"
},
{
"name": "OTHER_VALUE",
"value": "Something something"
}
],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "\${workspaceFolder}/.vscode/of-gdb.sh",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
EOF
chmod +x .vscode/of-gdb.sh
# 写入文件 CMakeLists.txt
cat > CMakeLists.txt <<EOF