Skip to content

Linux support #1

@newincpp

Description

@newincpp

Hi,
This is somewhere between a bug report and a feature request. I was looking for implementing DGF in my own project and went across a few issues related to each other.
The first is in cmake. Vulkan isn't supported in the project (which would be great but that's beside the point). Yet DGF_BUILD_SAMPLES is enabled and ccmake doesn't show the option to disable it. Once disabled, the addition of imgui (which depend on directx) will still be compiled and trigger errors. It should be conditional from the presence of the tester.
So I had to modify CMakeList.txt instead:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,8 +37,8 @@ if( DGF_IS_TOP_LEVEL )
     # We're the root project, build everything
     set( DGF_BUILD_DGFLIB 1 )
     set( DGF_BUILD_DGFBAKER 1 )
-    set( DGF_BUILD_DGFTESTER 1 )
-       set( DGF_BUILD_SAMPLES 1 )
+    #set( DGF_BUILD_DGFTESTER 0 )
+    #set( DGF_BUILD_SAMPLES 0 )
 else()

--- a/external/CMakeLists.txt
+++ b/external/CMakeLists.txt
@@ -20,11 +20,11 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 # THE SOFTWARE.
 
-add_subdirectory(d3d)
+#add_subdirectory(d3d)
 add_subdirectory(miniply)
 add_subdirectory(tinyobjloader)
-add_subdirectory(imgui)
+#add_subdirectory(imgui)
 set_target_properties(miniply PROPERTIES FOLDER "external")
-set_target_properties(imgui PROPERTIES FOLDER "external")
\ No newline at end of file
+#set_target_properties(imgui PROPERTIES FOLDER "external")

Once done there is additional errors and warnings but that one doesn't seems to be on you:

ClusterBuilder.cpp:418:38: error: use of deleted function ‘bool DGFBaker::TriangleAttributes::operator<(const DGFBaker::TriangleAttributes&) const’
  418 |                 return attribs < rhs.attribs;

DGFBaker.h:45:21: note: ‘bool DGFBaker::TriangleAttributes::operator<(const DGFBaker::TriangleAttributes&) const’ is implicitly deleted because the default definition would be ill-formed:
   45 |         inline bool operator<(const TriangleAttributes& rhs) const   = default;

Which is relatively easy to workaround by:

--- a/DGFBaker/include/DGFBaker.h
+++ b/DGFBaker/include/DGFBaker.h
@@ -42,7 +42,9 @@ namespace DGFBaker
 
         inline bool operator==(const TriangleAttributes& rhs) const  = default;        
         inline bool operator!=(const TriangleAttributes& rhs) const  = default;
-        inline bool operator<(const TriangleAttributes& rhs) const   = default;
+        inline bool operator<(const TriangleAttributes& rhs) const {
+            return geomID < rhs.geomID;
+        }
         inline auto operator<=>(const TriangleAttributes& rhs) const = default; 
     };

From my own tests, they seems to be specific to gcc 14.2 (and probably lower, repro here: https://godbolt.org/z/5bcYhsG3q ). I worked around this locally by using clang instead but that can't really be an option for a generic linux support.
Also, I have to say, that operator setup in that class is a tad strange as the goal of operator<=> (if I recall correctly, I haven't used it much personally so I might be wrong, feel free to correct me) is to pack all comparisons in one operator so all the == != and < shouldn't be necessary.

I hope all this is helpful for an improvement on the sdk ❤

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions