You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Visual Studio中编译zed-oculus项目的Oculus SDK CMake路径配置求助

How to Configure Oculus SDK Paths in CMake for ZED-Oculus Project (Visual Studio)

Hey there! I totally get it—jumping from manually setting include directories in VS to wrangling CMake for external SDKs can feel like a whole new world when you're just starting out. Let's walk through exactly how to set up the Oculus SDK path for your zed-oculus project step by step.

Step 1: Locate Your Oculus SDK Installation Path

First, find where your Oculus SDK is installed. By default, it's usually at:
C:\Program Files\Oculus\Support\oculus_sdk\OVR
If you chose a custom install location, navigate to the folder that contains the Include and Lib subdirectories (you should see OVR.h inside the Include folder).

Step 2: Modify the Project's CMakeLists.txt

The zed-oculus project uses CMake to generate the VS solution, so we need to tell CMake where to find the Oculus SDK. Open the root CMakeLists.txt file in the cloned repository and add these lines (you can place them near the top, after any existing SDK setup for ZED):

# Set your Oculus SDK root path here (replace with your actual path)
set(OCULUS_SDK_PATH "C:/Program Files/Oculus/Support/oculus_sdk/OVR")

# Add Oculus SDK include directories so the compiler can find header files
include_directories(${OCULUS_SDK_PATH}/Include)

# Add Oculus SDK library directories for linking (use x64 since Oculus is 64-bit)
link_directories(${OCULUS_SDK_PATH}/Lib/Windows/x64/Release)

Next, find the target_link_libraries section in the CMakeLists.txt (it should be linking to ZED libraries already). Add the Oculus library to it:

# Replace "zed-oculus" with the actual target name if it's different in the project
target_link_libraries(zed-oculus PRIVATE ovr.lib)

Step 3: Generate the Visual Studio Solution with CMake

If you're using the CMake GUI (which is easier for beginners):

  • Set the "Where is the source code" field to the root directory of your cloned zed-oculus repo.
  • Set the "Where to build the binaries" field to a new folder (like build inside the repo) to keep build files separate.
  • Click Configure, then select your Visual Studio version (make sure to pick the x64 architecture—Oculus SDK doesn't support x86).
  • If CMake prompts for the OCULUS_SDK_PATH (if it didn't pick up the path you set), manually enter your SDK path and click Configure again.
  • Once there are no more red errors, click Generate to create the VS solution.

Step 4: Build and Run in Visual Studio

Open the generated .sln file from your build folder. Set the correct startup project (it should be the zed-oculus target), then build and run as usual.

Quick Troubleshooting Tips

  • Make sure your ZED SDK is also properly installed—CMake should automatically detect it, but if not, you may need to set ZED_SDK_PATH in the same way as the Oculus SDK.
  • Double-check that the link_directories path points to the correct architecture (x64) and build type (Release/Debug) matching your VS build configuration.
  • If you get linker errors about missing ovr.lib, verify the library exists in the path you specified.

内容的提问来源于stack exchange,提问作者Quit007

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:38:58