Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

joltphysics: add version 5.0.0 #24670

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

cuppajoeman
Copy link
Contributor

@cuppajoeman cuppajoeman commented Jul 19, 2024

Summary

Changes to recipe: joltphysics/[5.0.0]
These changes allow for users to install jolt5.0.0 with conan

Motivation

Many new features were added in jolt 5.0.0, these pertain to soft body, vehicles, character, constraint, collision detection, and can be read more about here: https://github.com/jrouwe/JoltPhysics/releases/tag/v5.0.0

Details

I am still not an authorized user, so I don't think this will be able to be merged in until I am, but I thought I would start the merge request a bit earlier, because it's my first time doing this and thought that there might be things that I have to change after review, by the time it's correct I'd probably have authorization.

WARNING: This merge request is most likely incorrect because I don't fully understand what the previous patch was doing and so I didn't include a patch in this commit, even though running conan . create --version=5.0.0 works just fine.

So far I have:

Questions

  • I am the least familiar with patching, notice that in my commit I have added the following line to the CMakeLists.txt in test_package:
add_definitions(-DJPH_PROFILE_ENABLED=0 -DJPH_DEBUG_RENDERER=0)

I added this because when it was not there and I tried to run conan create . --version=5.0.0 I got the error:

======== Testing the package: Executing test ========
joltphysics/5.0.0 (test package): Running test()
joltphysics/5.0.0 (test package): RUN: ./test_package
Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!
Mismatching define JPH_PROFILE_ENABLED.
Mismatching define JPH_DEBUG_RENDERER.

From what I understand this is because we build the joltphysics package in isolation from the test package, since they both use jolt, they must have matching compiler definitions or else the code is not compatible. When I inspect the previous version patches they have lines like this:

-target_precompile_headers(Jolt PRIVATE ${JOLT_PHYSICS_ROOT}/Jolt.h)
-target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug>:_DEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>")
-target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Release>:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>")
+target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug>:_DEBUG>")
+target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Release>:NDEBUG>")

Is my method of changing the CMakeLists.txt incorrect? Should I be using patching for this? [Also I have read the corresponding section on patches]

  • Another question I had comes from the previous patch that looks like this:

+add_library(Jolt ${JOLT_PHYSICS_SRC_FILES})
+target_compile_features(Jolt PUBLIC cxx_std_17)
+include(GNUInstallDirs)
+install(
+ TARGETS Jolt
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
+install(DIRECTORY ${JOLT_PHYSICS_ROOT} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING REGEX "(.*).(h|inl)$")
+if(JPH_DEBUG_RENDERER)
+ target_compile_definitions(Jolt PUBLIC JPH_DEBUG_RENDERER)
+endif()
+if(JPH_PROFILE_ENABLED)
+ target_compile_definitions(Jolt PUBLIC JPH_PROFILE_ENABLED)
+endif()

What is the purpose of this modification? Do I need create a patch that does that in my version here?

@toge I know that you created the previous patches, would you be able to help answer a few of the above questions?

  • I am also curious if I am supposed to add an option in a one-to-one manner for each available option in the new jolt version (aside from build_testing), the options are laid out here. Note that I have read the corresponding section about the conanfile options attribute

Apologies for asking so many questions, but I really want to help contribute to conan center index. I think once I complete my first merge request I will have far less questions.

Closes: #25558


@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@ErniGH ErniGH self-assigned this Aug 21, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@cuppajoeman
Copy link
Contributor Author

Hey @ErniGH (or @toge who created the original files) Hopefully you can help me out with this, the main problem I'm having now is that I'm having trouble understanding why patching is necessary, what the current patches do for this recipe, and how to generate my own patches.

I read this: https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/sources_and_patches.md, but I'm still having trouble seeing why we need a patch in our specific case of this recipe, my specific questions are for the entire patch, but I'll focus on this one first:

+add_library(Jolt ${JOLT_PHYSICS_SRC_FILES})
+target_compile_features(Jolt PUBLIC cxx_std_17)
+include(GNUInstallDirs)
+install(
+	TARGETS Jolt
+	ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+	LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+	RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+)
+install(DIRECTORY ${JOLT_PHYSICS_ROOT} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING REGEX "(.*).(h|inl)$")
+if(JPH_DEBUG_RENDERER)
+    target_compile_definitions(Jolt PUBLIC JPH_DEBUG_RENDERER)
+endif()
+if(JPH_PROFILE_ENABLED)
+    target_compile_definitions(Jolt PUBLIC JPH_PROFILE_ENABLED)
+endif()
  • Why are we adding the compile features for cxx_std_17?
  • Why do we define a way to install jolt?
  • Why are we adding the JPH_DEBUG_RENDERER definition to the compile definitions of the Jolt library?

@AbrilRBS AbrilRBS assigned AbrilRBS and unassigned ErniGH Sep 5, 2024
@AbrilRBS
Copy link
Member

AbrilRBS commented Sep 5, 2024

Hi @cuppajoeman thanks for taking the time to add the new version. To be able to answer your questions, we'll need to check the previous PRs, see if some info was discussed there. I'll try to take a look tomorrow, see if we can come up with some answers! :)

@shiena
Copy link
Contributor

shiena commented Sep 14, 2024

@cuppajoeman
It looks like that patch was first made over here.
#14573 (@SpaceIm )

@shiena
Copy link
Contributor

shiena commented Sep 14, 2024

@cuppajoeman @AbrilRBS
I would like to add the following changes for mac.
When building with build_type=Release in apple-clang, INTERPROCEDURAL_OPTIMIZATION is turned on and binaries with bitcode enabled are generated.
Since bitcode has been deprecated since Xcode14 and is now causing trouble, I want to disable it by default for mac.
https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations

diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py
index ef2cbdfc7..bdd5f9e77 100644
--- a/recipes/joltphysics/all/conanfile.py
+++ b/recipes/joltphysics/all/conanfile.py
@@ -1,5 +1,6 @@
 from conan import ConanFile
 from conan.errors import ConanInvalidConfiguration
+from conan.tools.apple import is_apple_os
 from conan.tools.build import check_min_cppstd
 from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
 from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
@@ -29,6 +30,7 @@ class JoltPhysicsConan(ConanFile):
         "simd": ["sse", "sse41", "sse42", "avx", "avx2", "avx512"],
         "debug_renderer": [True, False],
         "profile": [True, False],
+        "lto": [True, False],
     }
     default_options = {
         "shared": False,
@@ -36,6 +38,7 @@ class JoltPhysicsConan(ConanFile):
         "simd": "sse42",
         "debug_renderer": False,
         "profile": False,
+        "lto": True,
     }
 
     @property
@@ -80,6 +83,8 @@ class JoltPhysicsConan(ConanFile):
             del self.options.fPIC
         if self.settings.arch not in ("x86", "x86_64"):
             del self.options.simd
+        if is_apple_os(self):
+            self.options.lto = False
 
     def configure(self):
         if self.options.shared:
@@ -131,6 +136,7 @@ class JoltPhysicsConan(ConanFile):
             tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self)
         tc.variables["JPH_DEBUG_RENDERER"] = self.options.debug_renderer
         tc.variables["JPH_PROFILE_ENABLED"] = self.options.profile
+        tc.variables["INTERPROCEDURAL_OPTIMIZATION"] = self.options.lto
         if Version(self.version) >= "3.0.0":
             tc.variables["ENABLE_ALL_WARNINGS"] = False
         tc.generate()

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 14, 2024

@shiena Please disable lto if it's manually managed in upstream CMakeList, and don't add such option in conancenter recipe. Lto can be enabled by users through conan config. It's always disabled by default for consistency across libraries provided by conancenter.

@shiena
Copy link
Contributor

shiena commented Sep 15, 2024

@SpaceIm
Perhaps because of the upstream definition, if you build for mac with build_type=Release , lto is enabled.
Since the purpose is to disable it, it is sufficient to add tc.variables[“INTERPROCEDURAL_OPTIMIZATION”] = False.

@uilianries
Copy link
Member

uilianries commented Sep 15, 2024

@shiena Hello and thank you for commenting. Have you discussed with the upstream this situation involving lto, instead? It look pretty particular, and it's configured already to be always ON: https://github.com/jrouwe/JoltPhysics/blob/f95ad217f2c2797081cbc33b6d3463dd0ef65f84/Build/CMakeLists.txt#L29 Maybe the upstream could change the behavior when using OSX to avoid the current error.

Otherwise, I would just enforce INTERPROCEDURAL_OPTIMIZATION always to False

@SpaceIm
Copy link
Contributor

SpaceIm commented Sep 15, 2024

@cuppajoeman It looks like that patch was first made over here. #14573 (@SpaceIm )

I've made this patch for joltphysics 2.0.1 (first version of joltphysics packaged in conancenter), I don't know if the logic is still relevant for other versions.

For 2.0.1, patch was fixing this:

  • C++17 was hardcoded (raw injection of -std=c++17 flag), so it was removed and replaced by target_compile_defintions cxx_std_17, which allows to honor compiler.cppstd from conan profile if above C++17.
  • hardcoded LTO was removed (conancenter recipes provide non-LTO build by default, otherwise it can lead to binary compatibility issues across minor versions of some compilers).
  • Werror/WX removed (warnings as errors can lead to compilation errors for recent compilers)
  • Upstream CMakeLists was only creating static lib, not shared, so STATIC was removed from add_library call, allowing to honor shared option from recipe.
  • There was no install target in upstream CMakeLists, so it has been added
  • In Upstream CMakeLists, JPH_DEBUG_RENDERER and JPH_PROFILE_ENABLED were injected based on build type. Patch replaced this behavior by an option, so that users can decide to enable these features based on recipe option.

@uilianries
Copy link
Member

Just read the issue jrouwe/JoltPhysics#418. I would pass tc.variables[“INTERPROCEDURAL_OPTIMIZATION”] = False by default. In case someone want that 10% of extra performance, is still possible to override it via the configuration tools.cmake.cmaketoolchain:extra_variables.

@shiena
Copy link
Contributor

shiena commented Sep 16, 2024

@uilianries Thank you for all your advice. I will withdraw my request and investigate the upstream topic.

@conan-center-bot

This comment has been minimized.

@noizex
Copy link

noizex commented Sep 21, 2024

Also something that I don't quite understand with conan packages is how a conanfile.py works against different versions, for example right now there are certain options specified in the current conanfile.py:

This is actually an interesting question - most of the packages in Conan repository state only a few recent versions, often just a couple of minor versions within single major version. I browsed existing recipes looking for a jump from a very basic version like 1.0 to 3.0 or higher, something that would also experience a change in make configs, addition of new flags and options - and couldn't find anything. Most of packages just have a static set of options.

If there was such a huge change between v3 and v5 of Jolt and it introduced a lot of new options compared to the older versions, I actually started to wonder if this does not justify a separate recipe for newer version? But couldn't find such use cases either.

I was able to find some hints in Conan docs for options here

It notes some way to dynamically remove options based on some conditional checks, so I think this could be used to check against the version and remove options if it's older than some set threshold. To make it nicer maybe there could be a list of options for v5 and if version is less than that, they're removed.

configure(): use this method to configure which options or settings of the recipe are available. For example, in this case, we delete the fPIC option, because it should only be True if we are building the library as shared (in fact, some build systems will add this flag automatically when building a shared library).

config_options(): This method is used to constrain the available options in a package before they take a value. If a value is assigned to a setting or option that is deleted inside this method, Conan will raise an error. In this case we are deleting the fPIC option in Windows because that option does not exist for that operating system. Note that this method is executed before the configure() method.

@noizex
Copy link

noizex commented Sep 22, 2024

TLDR; Despite profiler_in_distribution option being FALSE, Jolt library is still built with define of PROFILER_IN_DISTRIBUTION, but then test package does not set any defines and assumes defaults coming from library's .h files, and these defaults do not have PROFILER_IN_DISTRIBUTION enabled - and hence the mismatch.

UPDATE: Hmm, there will still be problem with ENABLE_OBJECT_STREAM - starting to wonder that maybe there is no elegant way to clean compile test package without providing some definitions? I suppose if that's how the library is made to work then so be it.. but I still think the two toggles for profiler and debug renderer are incorrectly handled by Jolt iself - or the way it's explained is ambiguous (at least to me! :) Because the override works only when the flag is true, but when it's false the override won't happen.

I added this because when it was not there and I tried to run conan create . --version=5.0.0 I got the error:

======== Testing the package: Executing test ========
joltphysics/5.0.0 (test package): Running test()
joltphysics/5.0.0 (test package): RUN: ./test_package
Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!
Mismatching define JPH_PROFILE_ENABLED.
Mismatching define JPH_DEBUG_RENDERER.

From what I understand this is because we build the joltphysics package in isolation from the test package, since they both use jolt, they must have matching compiler definitions or else the code is not compatible. When I inspect the previous version patches they have lines like this:

This is true, but in my opinion package built with default options should have exactly the same configuration & definitions as a client built with no additional defines using that package. I think I know why this is causing error (and it is erroring on my local test currently too, as I went on and started reviewing this package).

Here is how options are defined in Conan for JPH_PROFILE_ENABLED:

        "profiler": False, # so long as the following two options are false, this variable comes into effect,
                                  # this is added as a custom conan option so that you can have custom profiler
                                  # behavior
        "profiler_in_debug_and_release": True,
        "profiler_in_distribution": False,
  
        <...>        

        tc.variables["PROFILER_IN_DEBUG_AND_RELEASE"] = self.options.profiler_in_debug_and_release
        tc.variables["PROFILER_IN_DISTRIBUTION"] = self.options.profiler_in_distribution
   
       <...>
       # if both options are false
       if (not self.options.profiler_in_debug_and_release and not self.options.profiler_in_distribution):
            # but you want custom behavior
            if (self.options.profiler):
                self.cpp_info.defines.append("JPH_PROFILE_ENABLED")

This looks correct to me as these are the defaults from Jolt CMake config as well:

# Enable the profiler in Debug and Release builds. Note that PROFILER_IN_DISTRIBUTION will override this setting.
option(PROFILER_IN_DEBUG_AND_RELEASE "Enable the profiler in Debug and Release builds" ON)

# Enable the profiler in all builds.
# Note that enabling this reduces the performance of the library.
option(PROFILER_IN_DISTRIBUTION "Enable the profiler in all builds" OFF)

There is also this note: PROFILER_IN_DISTRIBUTION will override this setting which sort of indicates that PROFILER_IN_DISTRIBUTION takes precedence and if it's False then profiler WILL be disabled. That's what recipe is based on as it does default profiler_in_debug_and_release to True but profiler_in_distribution is False, so should disable ALL profiling.

But here is how it's handled in Jolt's CMake:

# Enable the profiler
if (PROFILER_IN_DISTRIBUTION)
	target_compile_definitions(Jolt PUBLIC "JPH_PROFILE_ENABLED")
elseif (PROFILER_IN_DEBUG_AND_RELEASE)
	target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug,Release,ReleaseASAN,ReleaseUBSAN>:JPH_PROFILE_ENABLED>")
endif()

This condition does not actually make PROFILER_IN_DISTRIBUTION guard a definitive one. If PROFILER_IN_DISTRIBUTION is false (which it is in our case) but PROFILER_IN_DEBUG_AND_RELEASE is true, the elseif will be followed and it will enable JPH_PROFILE_ENABLED anyway, despite PROFILER_IN_DISTRIBUTION being false.

I think this is mistake in upstream on how it handles this condition, at least based on the above Note that tells us that the more general setting is "overriding". I think it either needs to set PROFILER_IN_DEBUG_AND_RELEASE to false (which will make the default test work, but it will now diverge from original Jolt's config assumptions) or make change in the upstream to be more like:

# Enable the profiler
if (PROFILER_IN_DISTRIBUTION)
        if (PROFILER_IN_DEBUG_AND_RELEASE)
	       target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug,Release,ReleaseASAN,ReleaseUBSAN>:JPH_PROFILE_ENABLED>")
        else()
        	target_compile_definitions(Jolt PUBLIC "JPH_PROFILE_ENABLED")
        endif()
endif()

which would I think match what the intention behind this flag is (again, assuming this from the Note that the more general setting should override the more specific one - so PROFILE_IN_DISTRIBUTION being false means there is no profiling and PROFILER_IN_DEBUG_AND_RELEASE can't have effect.

@cuppajoeman
Copy link
Contributor Author

cuppajoeman commented Sep 24, 2024

Hi @noizex I looked over what you wrote here and I agree with most of what was said. I have some notes and a question:

I did some reading of the docs and found this out: https://docs.conan.io/2/tutorial/versioning/revisions.html which can be summed up by:

This sections introduces how doing modifications to a given recipe or source code without explicitly creating new versions, will still internally track those changes with a mechanism called revisions.

So as I understand it, it might not be necessary to conditionally load in specific options because for each version, the most recent revision is used for that version, though that would almost nullify the reason to check for version which might explain why you're not seeing many examples of it, though there may be cases that it's used, but as I mentioned I don't have enough experience with conan to know those cases yet.


As you mentioned the current status of this package is that we get mismatched defines, and I don't see where the discrepancy comes from, we have:

        "profiler": False, # so long as the following two options are false, this variable comes into effect,
                                  # this is added as a custom conan option so that you can have custom profiler
                                  # behavior
        "profiler_in_debug_and_release": True,
        "profiler_in_distribution": False,
  
        <...>        

        tc.variables["PROFILER_IN_DEBUG_AND_RELEASE"] = self.options.profiler_in_debug_and_release
        tc.variables["PROFILER_IN_DISTRIBUTION"] = self.options.profiler_in_distribution

which would equate to setting:

option(PROFILER_IN_DEBUG_AND_RELEASE "Enable the profiler in Debug and Release builds" ON)
option(PROFILER_IN_DISTRIBUTION "Enable the profiler in all builds" OFF)

So when we build the package using conan create . --version=5.0.0 wouldn't the execution path through the mentioned if statement be the same in jolt's cmake file when compared against the execution path when the project is being build in the test? (even though, as you mentioned the override logic is not right)


Note: On second thought I think the logic is right in the if statement because suppose that PROFILER_IN_DISTRIBUTION is true, in that case we get JPH_PROFILE_ENABLED defined in any build type, which is the correct behavior, even when both PROFILER_IN_DISTRIBUTION and PROFILER_IN_DEBUG_AND_RELEASE are both true, then even though we get into the else if branch, the call target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug,Release,ReleaseASAN,ReleaseUBSAN>:JPH_DEBUG_RENDERER>") does nothing as we've already created that definition in all build types (and when PROFILER_IN_DEBUG_AND_RELEASE is false, it doesn't do anything either). Only when PROFILER_IN_DISTRIBUTION is false then PROFILER_IN_DEBUG_AND_RELEASE comes into effect, which I believe is the intended effect.


TLDR: From what I can see everything seems correct but we're getting the mismatched defines message, if we can figure that out we should be all the way there (hopefully)

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ❌

Failure in build 12 (6a8c4300d58d47180e2a5b25946398d74f1bf629):

  • joltphysics/3.0.1:
    Didn't run or was cancelled before finishing

  • joltphysics/5.1.0:
    CI failed to create some packages (All logs)

    Logs for packageID ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.libcxx=libstdc++11
    compiler.version=9
    os=Linux
    [options]
    joltphysics:shared=False
    
    [...]
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleGrouper/TriangleGrouperClosestCentroid.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleGrouper/TriangleGrouperMorton.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitter.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitterBinning.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitterFixedLeafSize.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitterLongestAxis.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitterMean.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/TriangleSplitter/TriangleSplitterMorton.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/GetPrimitiveTypeOfType.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStream.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamBinaryIn.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamBinaryOut.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamIn.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamOut.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamTextIn.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamTextOut.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/ObjectStreamTypes.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/SerializableAttribute.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/SerializableAttributeEnum.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/SerializableAttributeTyped.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/include/Jolt/ObjectStream/TypeDeclarations.h
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/lib/cmake/Jolt/JoltConfig.cmake
    -- Installing: /home/conan/workspace/prod-v1/bsr/100019/bbfbc/.conan/data/joltphysics/5.1.0/_/_/package/ea29eab04aa7b6bcf2845a7bd90b00c03d37b01c/lib/cmake/Jolt/JoltConfig-release.cmake
    [HOOK - conan-center.py] post_package(): [PACKAGE LICENSE (KB-H012)] OK
    [HOOK - conan-center.py] post_package(): [DEFAULT PACKAGE LAYOUT (KB-H013)] OK
    [HOOK - conan-center.py] post_package(): [MATCHING CONFIGURATION (KB-H014)] OK
    [HOOK - conan-center.py] post_package(): [SHARED ARTIFACTS (KB-H015)] OK
    [HOOK - conan-center.py] post_package(): [STATIC ARTIFACTS (KB-H074)] OK
    [HOOK - conan-center.py] post_package(): [EITHER STATIC OR SHARED OF EACH LIB (KB-H076)] OK
    [HOOK - conan-center.py] post_package(): [PC-FILES (KB-H020)] OK
    [HOOK - conan-center.py] post_package(): [PDB FILES NOT ALLOWED (KB-H017)] OK
    [HOOK - conan-center.py] post_package(): [LIBTOOL FILES PRESENCE (KB-H018)] OK
    [HOOK - conan-center.py] post_package(): [MS RUNTIME FILES (KB-H021)] OK
    [HOOK - conan-center.py] post_package(): [SHORT_PATHS USAGE (KB-H066)] OK
    [HOOK - conan-center.py] post_package(): [MISSING SYSTEM LIBS (KB-H043)] OK
    [HOOK - conan-center.py] post_package(): [APPLE RELOCATABLE SHARED LIBS (KB-H077)] OK
    CMake Warning:
      Manually-specified variables were not used by the project:
    
        CMAKE_POLICY_DEFAULT_CMP0091
    
    
    WARN: **************************************************
    WARN: *** Conan 1 is legacy and on a deprecation path **
    WARN: *********** Please upgrade to Conan 2 ************
    WARN: **************************************************
    joltphysics/5.1.0: WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
    [HOOK - conan-center.py] post_package(): ERROR: [CMAKE-MODULES-CONFIG-FILES (KB-H016)] The conan-center repository doesn't allow the packages to contain CMake find modules or config files. The packages have to be located using generators and the declared `cpp_info` information (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H016-CMAKE-MODULES-CONFIG-FILES) 
    [HOOK - conan-center.py] post_package(): ERROR: [CMAKE-MODULES-CONFIG-FILES (KB-H016)] Found files: ./lib/cmake/Jolt/JoltConfig.cmake (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H016-CMAKE-MODULES-CONFIG-FILES) 
    ERROR: [HOOK - conan-center.py] post_package(): Some checks failed running the hook, check the output
    
  • joltphysics/5.0.1:
    Didn't run or was cancelled before finishing

  • joltphysics/2.0.1:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.


Conan v2 pipeline ❌

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping @conan-io/barbarians on the PR and we will help you.

Failure in build 11 (6a8c4300d58d47180e2a5b25946398d74f1bf629):

  • joltphysics/5.1.0:
    CI failed to create some packages (All logs)

    Logs for packageID 03f941fe603eab0c1e5136bf7f61d843ff2372d1:
    [settings]
    arch=x86_64
    build_type=Release
    compiler=gcc
    compiler.cppstd=17
    compiler.libcxx=libstdc++11
    compiler.version=11
    os=Linux
    [options]
    */*:shared=False
    
    [...]
    joltphysics/5.1.0 (test package): CMakeToolchain generated: /home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package/build/gcc-11-x86_64-17-release/generators/CMakePresets.json
    joltphysics/5.1.0 (test package): CMakeToolchain generated: /home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package/CMakeUserPresets.json
    joltphysics/5.1.0 (test package): Generator 'CMakeDeps' calling 'generate()'
    joltphysics/5.1.0 (test package): CMakeDeps necessary find_package() and targets for your CMakeLists.txt
        find_package(joltphysics)
        target_link_libraries(... joltphysics::joltphysics)
    joltphysics/5.1.0 (test package): Generator 'VirtualRunEnv' calling 'generate()'
    joltphysics/5.1.0 (test package): Generating aggregated env files
    joltphysics/5.1.0 (test package): Generated aggregated env files: ['conanrun.sh', 'conanbuild.sh']
    
    ======== Testing the package: Building ========
    joltphysics/5.1.0 (test package): Calling build()
    joltphysics/5.1.0 (test package): Running CMake.configure()
    joltphysics/5.1.0 (test package): RUN: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="/home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILD_TYPE="Release" "/home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package"
    -- Using Conan toolchain: /home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package/build/gcc-11-x86_64-17-release/generators/conan_toolchain.cmake
    -- Conan toolchain: Defining architecture flag: -m64
    -- Conan toolchain: C++ Standard 17 with extensions OFF
    -- The CXX compiler identification is GNU 11.4.0
    -- Check for working CXX compiler: /usr/local/bin/c++
    -- Check for working CXX compiler: /usr/local/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Conan: Target declared 'joltphysics::joltphysics'
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package/build/gcc-11-x86_64-17-release
    
    joltphysics/5.1.0 (test package): Running CMake.build()
    joltphysics/5.1.0 (test package): RUN: cmake --build "/home/conan/workspace/prod-v2/bsr/cci-9c900747/recipes/joltphysics/all/test_package/build/gcc-11-x86_64-17-release" -- -j3
    Scanning dependencies of target test_package
    [ 50%] Building CXX object CMakeFiles/test_package.dir/test_package.cpp.o
    [100%] Linking CXX executable test_package
    lto-wrapper: warning: using serial compilation of 16 LTRANS jobs
    [100%] Built target test_package
    
    
    ======== Testing the package: Executing test ========
    joltphysics/5.1.0 (test package): Running test()
    joltphysics/5.1.0 (test package): RUN: ./test_package
    Version mismatch, make sure you compile the client code with the same Jolt version and compiler definitions!
    Mismatching define JPH_PROFILE_ENABLED.
    Mismatching define JPH_DEBUG_RENDERER.
    Mismatching define JPH_OBJECT_STREAM.
    Aborted
    
    ERROR: joltphysics/5.1.0 (test package): Error in test() method, line 26
    	self.run(bin_path, env="conanrun")
    	ConanException: Error 134 while executing
    
  • joltphysics/5.0.1:
    Didn't run or was cancelled before finishing

  • joltphysics/3.0.1:
    Didn't run or was cancelled before finishing

  • joltphysics/2.0.1:
    Didn't run or was cancelled before finishing


Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.

@cuppajoeman
Copy link
Contributor Author

cuppajoeman commented Sep 24, 2024

Hi @noizex I saw your slack thread where it was mentioned that you would want to directly append the the definition, but I'm still curious we have lines like this in conanfile.py:

        tc.variables["DEBUG_RENDERER_IN_DEBUG_AND_RELEASE"] = self.options.debug_renderer_in_debug_and_release

and then in jolt.cmake:

# Enable the debug renderer
if (DEBUG_RENDERER_IN_DISTRIBUTION)
	target_compile_definitions(Jolt PUBLIC "JPH_DEBUG_RENDERER")
elseif (DEBUG_RENDERER_IN_DEBUG_AND_RELEASE)
	target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug,Release,ReleaseASAN,ReleaseUBSAN>:JPH_DEBUG_RENDERER>")
endif()

From what I understand when you set tc.variables you're defining those options to be true which would then allow one of these branches to execute in turn creating the compiler definition?

@noizex
Copy link

noizex commented Sep 24, 2024

Hi @noizex I saw your slack thread where it was mentioned that you would want to directly append the the definition, but I'm still curious we have lines like this in conanfile.py:

        tc.variables["DEBUG_RENDERER_IN_DEBUG_AND_RELEASE"] = self.options.debug_renderer_in_debug_and_release

and then in jolt.cmake:

# Enable the debug renderer
if (DEBUG_RENDERER_IN_DISTRIBUTION)
	target_compile_definitions(Jolt PUBLIC "JPH_DEBUG_RENDERER")
elseif (DEBUG_RENDERER_IN_DEBUG_AND_RELEASE)
	target_compile_definitions(Jolt PUBLIC "$<$<CONFIG:Debug,Release,ReleaseASAN,ReleaseUBSAN>:JPH_DEBUG_RENDERER>")
endif()

From what I understand when you set tc.variables you're defining those options to be true which would then allow one of these branches to execute in turn creating the compiler definition?

I think that explains why I had this lingering thought that appending to defines is not something that solves every situation. I suppose this would require literally recreating this logic from library's CMakeFiles to Conan logic in package_info. So we probably should be checking for build_type there? Instead using options it would probably be better to just copy defines that were used for this particular run of package build, but not sure this is even possible :/

@noizex
Copy link

noizex commented Sep 24, 2024

From what I understand when you set tc.variables you're defining those options to be true which would then allow one of these branches to execute in turn creating the compiler definition?

Yes, this passes that flag to CMake and then CMake adds the compile definition based on this. But to make it reach the consumer of the package, based on that Slack conversation, we need to add this to package_info which feels a bit redundant and requires us to recreate similar conditionals that are used via CMake :/

@cuppajoeman
Copy link
Contributor Author

cuppajoeman commented Sep 26, 2024

@noizex I have an idea on how we can do this something like this:

conan_option_to_cmake_option_name = {
    "use_asserts": "USE_ASSERTS",
    "double_precision": "DOUBLE_PRECISION",
    "generate_debug_symbols": "GENERATE_DEBUG_SYMBOLS",
    "override_cxx_flags": "OVERRIDE_CXX_FLAGS",
    "cross_platform_deterministic": "CROSS_PLATFORM_DETERMINISTIC",
    "cross_compile_arm": "CROSS_COMPILE_ARM",
    "build_shared_libs": "BUILD_SHARED_LIBS",
    "interprocedural_optimization": "INTERPROCEDURAL_OPTIMIZATION",
    "floating_point_exceptions_enabled": "FLOATING_POINT_EXCEPTIONS_ENABLED",
    "cpp_exceptions_enabled": "CPP_EXCEPTIONS_ENABLED",
    "cpp_rtti_enabled": "CPP_RTTI_ENABLED",
    "object_layer_bits": "OBJECT_LAYER_BITS",

    # X86 processor features
    "use_sse4_1": "USE_SSE4_1",
    "use_sse4_2": "USE_SSE4_2",
    "use_avx": "USE_AVX",
    "use_avx2": "USE_AVX2",
    "use_avx512": "USE_AVX512",
    "use_lzcnt": "USE_LZCNT",
    "use_tzcnt": "USE_TZCNT",
    "use_f16c": "USE_F16C",
    "use_fmadd": "USE_FMADD",

    # WebAssembly SIMD
    "use_wasm_simd": "USE_WASM_SIMD",

    # Warnings and Stats
    "enable_all_warnings": "ENABLE_ALL_WARNINGS",
    "track_broadphase_stats": "TRACK_BROADPHASE_STATS",
    "track_narrowphase_stats": "TRACK_NARROWPHASE_STATS",

    # Debug Renderer
    "debug_renderer_in_debug_and_release": "DEBUG_RENDERER_IN_DEBUG_AND_RELEASE",
    "debug_renderer_in_distribution": "DEBUG_RENDERER_IN_DISTRIBUTION",

    # Profiler
    "profiler_in_debug_and_release": "PROFILER_IN_DEBUG_AND_RELEASE",
    "profiler_in_distribution": "PROFILER_IN_DISTRIBUTION",

    # Allocator and Vector
    "disable_custom_allocator": "DISABLE_CUSTOM_ALLOCATOR",
    "use_std_vector": "USE_STD_VECTOR",

    # Object Stream and Install
    "enable_object_stream": "ENABLE_OBJECT_STREAM",
    "enable_install": "ENABLE_INSTALL"
}

this pretty much would copy the settings for both the 
def custom_profiler_check(options):
    return not options.profiler_in_debug_and_release and not options.profiler_in_distribution and options.profiler

# Map for custom evaluation logic
custom_evaluation_map = {
    "JPH_PROFILE_ENABLED": custom_profiler_check
}

def generate(self):
    for conan_option, cmake_option in conan_option_to_cmake_option_name.items():
        tc.variables[cmake_option] = getattr(self.options, conan_option)

def package_info(self):
    for conan_option, cmake_option in conan_option_to_cmake_option_name.items():
        if getattr(self.options, conan_option):
            self.cpp_info.defines.append(cmake_option)
    

    for cmake_option, custom_func in custom_evaluation_map.items():
        if custom_func(self.options):
            self.cpp_info.defines.append(cmake_option)

This would copy the settings for both the package and the consumer, let me know your thoughts on this, if you think it's alright I can go ahead with it.

(There would be more code in the snippet but this is just specifying the framework

@TariqYoussef
Copy link

TariqYoussef commented Oct 8, 2024

Hello @cuppajoeman @AbrilRBS @noizex ,
Are there any updates regarding this issue ?
Regards,
Tariq

@cuppajoeman
Copy link
Contributor Author

Hello @cuppajoeman @AbrilRBS @noizex , Are there any updates regarding this issue ? Regards, Tariq

At the moment I need some direction on how to handle the problem last specfied by @noizex when we have a clear direction on how to fix this then I think it can be finished pretty fast

@TariqYoussef
Copy link

I'm willing to help as well.

@cuppajoeman
Copy link
Contributor Author

I'm willing to help as well.

Honestly I think if you could try to get the attention of someone who is more experienced on the slack server to look over what we have that would be really useful, I've tried a few times but haven't had any luck

@shiena
Copy link
Contributor

shiena commented Nov 4, 2024

JoltPhysics 5.2.0 released.

@franramirez688 franramirez688 self-assigned this Nov 5, 2024
@cuppajoeman
Copy link
Contributor Author

Hey @franramirez688 lmk if you have any questions about this PR I can try to help out

@TariqYoussef
Copy link

Hello @franramirez688 Hope you are well
Do you have any idea when will this be finished ?

@uilianries uilianries self-assigned this Nov 21, 2024
@uilianries
Copy link
Member

@cuppajoeman Hello! We are going to review this PR on this Friday (22/11) and check possible solution involving the build. Thank you for your PR again!

@uilianries uilianries removed the Failed label Nov 22, 2024
Signed-off-by: Uilian Ries <[email protected]>
@uilianries
Copy link
Member

First, @cuppajoeman Thank for bringing us this new major version of joltphysics in this PR 💚

@TariqYoussef @noizex @shiena Thank for your comments in this PR, it's clear the project has several options and can result in different configurations, as those options are dependent of each other.

After discussing about this PR with Conan team, we idealized of reducing this PR, following the minimal of options possible, as the CI can not test all those combinations and may result in future issues. The current configured options for 5.x are to disable examples, tests, profiler and the renderer.

In case you really need a specific option, we could discuss in a future issue after this PR, so we would avoid new delays.


Still, Conan 2.x offers a safe way to inject cmake definitions without changing any line of the recipe, the configuration tools.cmake.cmaketoolchain:extra_variables, so you can enabled/disable features, for instance:

-c tools.cmake.cmaketoolchain:extra_variables='{"PROFILER_IN_DEBUG_AND_RELEASE": "ON"}'

This override the value for PROFILER_IN_DEBUG_AND_RELEASE. It can be extended to any variable present in the upstream's CMakeLists.txt.

This configuration does not affect the package ID, so it will override your local cache with a new package that does not follow the recipe in Conan Center. In order affect the package ID, by any configuration used, you can use configuration tools.info.package_id:confs:

-c tools.info.package_id:confs='["tools.cmake.cmaketoolchain:extra_variables"]'

Reference: https://docs.conan.io/2/reference/config_files/global_conf.html

These configuration can be added to your profile as well, so you do not need to copy/paste for every command line. That's a fast way to unblock you in case needing a new option not available in the recipe yet.

@uilianries
Copy link
Member

The CI was not able to process the current state of this PR. It's an internal bug and is listed to be fixed. Sorry for the inconvenience.

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.

[request] joltphysics/5.1.0