KhronosGroup / Vulkan-Samples

One stop solution for all Vulkan samples
Apache License 2.0
4.33k stars 648 forks source link

Fix #791: Add support for Xcode #994

Closed jeroenbakker-atmind closed 6 months ago

jeroenbakker-atmind commented 8 months ago

Description

Xcode projects were not able to link. The reason is that libtool (linker) doesn't support to sharing same name in a single library. Framework uses 4 files with the same name. One in the framework folder and one in framework/scene_graph/components.

These files are:

There are two ways to solve this, rename these files so all files in a library is unique or split the library into 2 so within a library the compile unit names are still unique. This PR splits framework into two separate library (framework and framework_scene_graph).

After this issue has been merged we can update the documentation how to generate the Xcode project. eg.

cmake -G Xcode -B build/mac-xcode

Fixes #791

General Checklist:

Please ensure the following points are checked:

Sample Checklist

If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist:

CLAassistant commented 8 months ago

CLA assistant check
All committers have signed the CLA.

gpx1000 commented 8 months ago

I fixed this in a different way in the #696. See if that version works for you.

I do like this as a solution as well. The problem with my solution is the names can never conflict, the advantage of this solution is it doesn't matter it will work longer term. Thanks for the submission!

jherico commented 8 months ago

I called out one instance. You need to search your branch for every instance of the string list(APPEND ${ and fix them.

jeroenbakker-atmind commented 8 months ago

@jherico thx for pointing that out. I also detected a logical error where the definitions where used as compile options. I will try to spin on a Windows machine and see how to solve the linker error.

jeroenbakker-atmind commented 8 months ago

@gpx1000 I glanced over your solution (also pointed that one out in the PR description. I wasn't aware of that it was already being addressed. So we need to check which one would be best suited.

My approach is that developers should not become aware of the unique file names issue. In larger applications you typically use prefixes or make the file names unique (by adding the _core as you did). IMO that is less readable for developers as the content of the file doesn't reflect the filename itself. eg the class vbk::core::Image would be easier to find when the file is still called Image.cpp/h.

Anyhow as I am still new to the project I am open for both solutions.

jeroenbakker-atmind commented 8 months ago

Just a note that I had to force push. I saw that one of my machines used a different email address, which made it not possible to accept the CLA. I rewrote the history so one email address was used (for my changes). The other changes (and authors) were kept intact.

gpx1000 commented 8 months ago

@gpx1000 I glanced over your solution (also pointed that one out in the PR description. I wasn't aware of that it was already being addressed. So we need to check which one would be best suited.

My approach is that developers should not become aware of the unique file names issue. In larger applications you typically use prefixes or make the file names unique (by adding the _core as you did). IMO that is less readable for developers as the content of the file doesn't reflect the filename itself. eg the class vbk::core::Image would be easier to find when the file is still called Image.cpp/h.

Anyhow as I am still new to the project I am open for both solutions.

I like your solution more. If we can get this merged ahead of my PR getting merged then I'll back out my changes. Otherwise, I'll create a new PR which reverts the renaming fix. Thanks for the submission. We really appreciate any and all help and this is a good fix.

jeroenbakker-atmind commented 7 months ago

Solved code review feedback and fixed building on Linux

jeroenbakker-atmind commented 7 months ago

Currently this PR would be a cleanup and revert parts of #696. Next steps:

jeroenbakker-atmind commented 7 months ago

This PR is rebased with latest main. The renaming of CPP files done by #696 has been reverted. I also noticed a file to be listed twice. Any feedback is welcome!

jeroenbakker-atmind commented 7 months ago

The issue is that VulkanSamples has a minimum requirement of stdcpp14, but recently added changes uses stdcpp17 syntax. I think it is better to stick to the syntax of stdcpp14.

Due to my lack of experience in CMake I couldn't detect the location inside the build script that sets the stdcpp to 17.

jeroenbakker-atmind commented 7 months ago

Nothing changed, but github detected a possible merge conflict, which was automatically resolved when merging manually.

Seems like more CPP17 code style was added. I will fix them as well ...

jeroenbakker-atmind commented 7 months ago

This task is currently Blocked by: #1017