DescentDevelopers / Descent3

Descent 3 by Outrage Entertainment
GNU General Public License v3.0
2.74k stars 231 forks source link

Fixed failing MSVC build #429

Closed pzychotic closed 3 weeks ago

pzychotic commented 4 weeks ago

Pull Request Type

Description

When starting from a completely new/empty build directory where $<TARGET_FILE_DIR:Descent3> doesn't exist yet, the copy command for LICENSE will create a file named Debug or Release, depending on the current configuration, in the Descent3 directory. This then prevents the creation of the output directory for the Descent3 target with the same name and thus failing the build. I'm not quite sure why this doesn't happen on our CI builds. Maybe it's some difference between IDE and command line builds or just luck in case of parallel builds...

Related Issues

Screenshots (if applicable)

Checklist

Additional Comments

Jayman2000 commented 4 weeks ago

Could you provide steps to reproduce this issue on the main branch? I want to test out this PR, but I haven’t figured out how to make CMake to create the Debug or Release file.


When starting from a completely new/empty build directory where $<TARGET_FILE_DIR:Descent3> doesn't exist yet, the copy command for LICENSE will create a file named Debug or Release, depending on the current configuration, in the Descent3 directory. This then prevents the creation of the output directory for the Descent3 target with the same name and thus failing the build.

I would put this into your commit message.

pzychotic commented 4 weeks ago

Could you provide steps to reproduce this issue on the main branch? I want to test out this PR, but I haven’t figured out how to make CMake to create the Debug or Release file.

The problem happens on compile time when the custom target to copy the LICENSE file gets executed.

Steps to reproduce:

winterheart commented 4 weeks ago

Hello. Better way is replace all custom commands (related to license files) with install command like main license file (you can even add license files into root CMakeLists.txt install directive):

install(FILES README.md LICENSE <additional files here> DESTINATION ${CMAKE_INSTALL_DOCDIR})
Jayman2000 commented 3 weeks ago

Steps to reproduce:

  • delete your current build directory

  • run CMake to generate the Descent3.sln

  • open Descent3.sln in VS

  • build solution

I was able to reproduce this problem using those steps, but unfortunately, I can’t get it to reproduce consistently. I was also able to reproduce it by running cmake --build --preset win32 -j 0.

pzychotic commented 3 weeks ago

Steps to reproduce:

  • delete your current build directory
  • run CMake to generate the Descent3.sln
  • open Descent3.sln in VS
  • build solution

I was able to reproduce this problem using those steps, but unfortunately, I can’t get it to reproduce consistently. I was also able to reproduce it by running cmake --build --preset win32 -j 0.

Glad you can reproduce it and it's not just me. From the VS IDE I was hitting it consistently.

pzychotic commented 3 weeks ago

Hello. Better way is replace all custom commands (related to license files) with install command like main license file (you can even add license files into root CMakeLists.txt install directive):

install(FILES README.md LICENSE <additional files here> DESTINATION ${CMAKE_INSTALL_DOCDIR})

This sounds like sensible solution, too. If some wants to give a shot, be my guest. I'll probably can't get to it soon'ish.