P4: The OpenGL ES option stays on when OpenGL is off ("OFF FORCE" without CACHE)

クローズ 初心者向け
#7,984 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #7489 @Shivansps による — マージ済み

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cmake, cpp
領域
build-system

調査の方向性

問題のある代入は、CMakeLists.txt にある set(FSO_BUILD_WITH_OPENGL_ES OFF FORCE) です。issue では CMakeLists.txt:272 の要約行の近くにあるとされています。小さなスクリプトで cmake -P を使って評価を再現し、数行下にある、すでにキャッシュ型を使っている OpenXR の行と比較してください。OpenGL を無効、ES を有効にしたときに ES オプションが false になり、USE_OPENGL_ES が定義されず、要約に OFF と表示されれば完了です。issue には修正案が3つあるため、どれを使うかはメンテナーに確認してください。

索引モデルが issue の本文から書いたものです。

説明

Minor: this only matters for a build configured with OpenGL off and the OpenGL ES option on, which is a contradictory setup.

Problem

CMakeLists.txt is meant to turn the OpenGL ES option off when OpenGL itself is off, but the line set(FSO_BUILD_WITH_OPENGL_ES OFF FORCE) has no CACHE BOOL "", so CMake sets a normal variable to the list OFF;FORCE. A non-empty string that isn't a false constant counts as true in if(), so the following if(FSO_BUILD_WITH_OPENGL_ES) still adds -DUSE_OPENGL_ES.

Steps to reproduce

  1. Configure current master (tested on 8afa31842) with -DFSO_BUILD_WITH_OPENGL=OFF -DFSO_BUILD_WITH_OPENGL_ES=ON.
  2. Reading the script, the summary line (CMakeLists.txt:272) would then print "With OpenGL ES: OFF;FORCE" and the build would get USE_OPENGL_ES. I have not run a full configure; step 3 is what I ran.
  3. The same evaluation in isolation, with cmake -P: set(V ON), then set(V OFF FORCE), prints value=[OFF;FORCE], and if(V) takes the true branch.

Expected vs. actual behavior

  • Expected: the ES option is off whenever OpenGL is off.
  • Actual: it stays on, as the string OFF;FORCE.

Proposed fixes

  1. Add the cache type: set(FSO_BUILD_WITH_OPENGL_ES OFF CACHE BOOL "" FORCE), as the OpenXR line a few lines below already does.
  2. Or drop FORCE and set a plain variable (set(FSO_BUILD_WITH_OPENGL_ES OFF)), which is enough for the checks that follow.
  3. Or make it a configure error, so the contradictory setup is reported instead of silently corrected.
主要言語
C++
スター
488
フォーク
184
平均マージ
6日 1分
マージ済み PR(30日)
42

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

scp-fs2open/fs2open.github.com のほかの issue

scp-fs2open/fs2open.github.com の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。