Skip to content

Resolve sibling component paths relative to the current directory - #205

Open
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/cmake-sibling-paths
Open

Resolve sibling component paths relative to the current directory#205
Sinan-Karakaya wants to merge 1 commit into
ran-j:mainfrom
Sinan-Karakaya:fix/cmake-sibling-paths

Conversation

@Sinan-Karakaya

Copy link
Copy Markdown
Contributor

ps2xRecomp and ps2xAnalyzer reach ps2xRuntime through CMAKE_SOURCE_DIR, which is the top-level source directory of whatever build is running. That holds only when this repository is itself the top level.

Adding the project to another one with add_subdirectory() makes both components look for ps2xRuntime/cmake/ReleaseMode.cmake under the consuming project, and configure fails:

CMake Error at ps2xRecomp/CMakeLists.txt:133 (include):
CMake Error at ps2xAnalyzer/CMakeLists.txt:53 (include):

This switches them to CMAKE_CURRENT_SOURCE_DIR-relative paths, matching what ps2xRecomp already does for its ps2xRuntime include directory (line 101) and what ps2xRuntime does for its own cmake include.

Note that PROJECT_SOURCE_DIR is not an alternative here: each component calls project() itself, so it resolves to the component directory rather than the repository root.

Verified by embedding the project as a submodule and configuring with -DPS2X_BUILD_RUNTIME=OFF -DPS2X_BUILD_STUDIO=OFF -DPS2X_BUILD_TEST=OFF, which previously failed at configure time and now succeeds. Standalone builds are unaffected.

Copilot AI lite review requested due to automatic review settings August 17, 2026 16:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes configuration failures when ps2xRecomp and ps2xAnalyzer are consumed via add_subdirectory() by resolving sibling component paths relative to the component directory (instead of the top-level build’s CMAKE_SOURCE_DIR).

Changes:

  • Update ps2xRecomp to include ps2xRuntime/cmake/ReleaseMode.cmake via a CMAKE_CURRENT_SOURCE_DIR-relative path.
  • Update ps2xAnalyzer to reference ps2xRecomp and ps2xRuntime headers via CMAKE_CURRENT_SOURCE_DIR-relative paths.
  • Update ps2xAnalyzer to include ps2xRuntime/cmake/ReleaseMode.cmake via a CMAKE_CURRENT_SOURCE_DIR-relative path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ps2xRecomp/CMakeLists.txt Switches the ReleaseMode.cmake include to be relative to ps2xRecomp’s directory for correct subproject builds.
ps2xAnalyzer/CMakeLists.txt Switches sibling include paths and ReleaseMode.cmake include to be relative to ps2xAnalyzer’s directory for correct subproject builds.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

ps2xRecomp and ps2xAnalyzer reached ps2xRuntime through CMAKE_SOURCE_DIR,
which is the top-level source directory of whatever build is running. That
holds only when this repository is itself the top level; adding it to another
project with add_subdirectory() made both components look for
ps2xRuntime/cmake/ReleaseMode.cmake under the consuming project and fail at
configure time.

Use CMAKE_CURRENT_SOURCE_DIR-relative paths, as ps2xRecomp already does for
its ps2xRuntime include directory and ps2xRuntime does for its own cmake
include. Note that each component declares its own project(), so
PROJECT_SOURCE_DIR is not an alternative here.
@Sinan-Karakaya
Sinan-Karakaya force-pushed the fix/cmake-sibling-paths branch from e85094d to fa7e45a Compare August 17, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants