@echo off
Setlocal EnableDelayedExpansion
rem Setup environment
rem 配置相应参数,%3默认是release 可手动修改为debug
call "%~dp0env.bat" vc141 win64 %3
rem Define path to project file
rem 修改项目名称
set "PRJFILE=QtWidgetsApplication1.sln"
rem Launch Visual Studio - either professional (devenv) or Express, as available
if exist "%DevEnvDir%\devenv.exe" (
start "" "%DevEnvDir%\devenv.exe" "%PRJFILE%"
) else if exist "%DevEnvDir%\%VisualStudioExpressName%.exe" (
start "" "%DevEnvDir%\%VisualStudioExpressName%.exe" "%PRJFILE%"
) else (
echo Error: Could not find MS Visual Studio ^(%VCFMT%^)
echo Check relevant environment variable ^(e.g. VS100COMNTOOLS for vc10^)
)
rem 定义变量,指向occ安装路径
SET "OCC_PATH=F:\OpenCASCADE-7.4.0-vc14-64\opencascade-7.4.0"
rem 使用变量
call "%OCC_PATH%\env.bat" %1 %2 %3
set "BIN_DIR=win%ARCH%\%VCVER%\bind"
set "LIB_DIR=win%ARCH%\%VCVER%\libd"
if ["%CASDEB%"] == [""] (
set "BIN_DIR=win%ARCH%\%VCVER%\bin"
set "LIB_DIR=win%ARCH%\%VCVER%\lib"
)
set "PATH=%~dp0%LIB_DIR%;%~dp0%BIN_DIR%;%PATH%"
这一步可能会失败,失败的话将echo %OCC_PATH%\env.bat
加到call下面,结尾用pause
确认是否成功:项目属性>c/c++>附加包含目录>宏 里面有大量以CSF为前缀的宏,这些宏其实对应的就是各种OCC的路径,之后直接引用宏即可,不必再去写路径
$(CSF_OCCTIncludePath)
$(CSF_OCCTLibPath)
#OCC路径设置
OCCPath = F:\OpenCASCADE-7.4.0-vc14-64\opencascade-7.4.0
OCCIncludePath = $$OCCPath/inc
win32:CONFIG(release,debug|release):OCCLibPath = $$OCCPath\win64\vc14\lib
else:CONFIG(debug,debug|release):OCCLibPath = $$OCCPath\win64\vc14\libd
INCLUDEPATH += $$OCCIncludePath
win32:LIBS+= -L$$OCCLibPath -lTKBin
win32:LIBS+= -L$$OCCLibPath -lTKBinL
win32:LIBS+= -L$$OCCLibPath -lTKBinTObj
win32:LIBS+= -L$$OCCLibPath -lTKBinXCAF
win32:LIBS+= -L$$OCCLibPath -lTKBO
win32:LIBS+= -L$$OCCLibPath -lTKBool
win32:LIBS+= -L$$OCCLibPath -lTKBRep
win32:LIBS+= -L$$OCCLibPath -lTKCAF
win32:LIBS+= -L$$OCCLibPath -lTKCDF
win32:LIBS+= -L$$OCCLibPath -lTKD3DHost
win32:LIBS+= -L$$OCCLibPath -lTKDCAF
win32:LIBS+= -L$$OCCLibPath -lTKDFBrowser
win32:LIBS+= -L$$OCCLibPath -lTKDraw
win32:LIBS+= -L$$OCCLibPath -lTKernel
win32:LIBS+= -L$$OCCLibPath -lTKFeat
win32:LIBS+= -L$$OCCLibPath -lTKFillet
win32:LIBS+= -L$$OCCLibPath -lTKG2d
win32:LIBS+= -L$$OCCLibPath -lTKG3d
win32:LIBS+= -L$$OCCLibPath -lTKGeomAlgo
win32:LIBS+= -L$$OCCLibPath -lTKGeomBase
win32:LIBS+= -L$$OCCLibPath -lTKHLR
win32:LIBS+= -L$$OCCLibPath -lTKIGES
win32:LIBS+= -L$$OCCLibPath -lTKIVtk
win32:LIBS+= -L$$OCCLibPath -lTKIVtkDraw
win32:LIBS+= -L$$OCCLibPath -lTKLCAF
win32:LIBS+= -L$$OCCLibPath -lTKMath
win32:LIBS+= -L$$OCCLibPath -lTKMesh
win32:LIBS+= -L$$OCCLibPath -lTKMeshVS
win32:LIBS+= -L$$OCCLibPath -lTKOffset
win32:LIBS+= -L$$OCCLibPath -lTKOpenGl
win32:LIBS+= -L$$OCCLibPath -lTKPrim
win32:LIBS+= -L$$OCCLibPath -lTKQADraw
win32:LIBS+= -L$$OCCLibPath -lTKRWMesh
win32:LIBS+= -L$$OCCLibPath -lTKService
win32:LIBS+= -L$$OCCLibPath -lTKShapeView
win32:LIBS+= -L$$OCCLibPath -lTKShHealing
win32:LIBS+= -L$$OCCLibPath -lTKStd
win32:LIBS+= -L$$OCCLibPath -lTKStdL
win32:LIBS+= -L$$OCCLibPath -lTKSTEP
win32:LIBS+= -L$$OCCLibPath -lTKSTEP209
win32:LIBS+= -L$$OCCLibPath -lTKSTEPAttr
win32:LIBS+= -L$$OCCLibPath -lTKSTEPBase
win32:LIBS+= -L$$OCCLibPath -lTKSTL
win32:LIBS+= -L$$OCCLibPath -lTKTInspector
win32:LIBS+= -L$$OCCLibPath -lTKTInspectorAPI
win32:LIBS+= -L$$OCCLibPath -lTKTObj
win32:LIBS+= -L$$OCCLibPath -lTKTObjDRAW
win32:LIBS+= -L$$OCCLibPath -lTKToolsDraw
win32:LIBS+= -L$$OCCLibPath -lTKTopAlgo
win32:LIBS+= -L$$OCCLibPath -lTKTopTest
win32:LIBS+= -L$$OCCLibPath -lTKTreeModel
win32:LIBS+= -L$$OCCLibPath -lTKV3d
win32:LIBS+= -L$$OCCLibPath -lTKVCAF
win32:LIBS+= -L$$OCCLibPath -lTKView
win32:LIBS+= -L$$OCCLibPath -lTKViewerTest
win32:LIBS+= -L$$OCCLibPath -lTKVInspector
win32:LIBS+= -L$$OCCLibPath -lTKVRML
win32:LIBS+= -L$$OCCLibPath -lTKXCAF
win32:LIBS+= -L$$OCCLibPath -lTKXDEDRAW
win32:LIBS+= -L$$OCCLibPath -lTKXDEIGES
win32:LIBS+= -L$$OCCLibPath -lTKXDESTEP
win32:LIBS+= -L$$OCCLibPath -lTKXMesh
win32:LIBS+= -L$$OCCLibPath -lTKXml
win32:LIBS+= -L$$OCCLibPath -lTKXmlL
win32:LIBS+= -L$$OCCLibPath -lTKXmlTObj
win32:LIBS+= -L$$OCCLibPath -lTKXmlXCAF
win32:LIBS+= -L$$OCCLibPath -lTKXSBase
win32:LIBS+= -L$$OCCLibPath -lTKXSDRAW
RESOURCES += *.pri
@echo off
Setlocal EnableDelayedExpansion
rem Setup environment
rem 配置相应参数,%3默认是release 可手动修改为debug
call "%~dp0env.bat" vc141 win64 %3
rem 修改项目名称
call "%~dp0ProjectName.pro"