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

libsodium: fix several regressions of #13792 #14998

Merged
merged 7 commits into from
Dec 31, 2022

Conversation

SpaceIm
Copy link
Contributor

@SpaceIm SpaceIm commented Dec 29, 2022

Fix several regressions coming from #13792:

  • msvc: honor runtime: closes [package] libsodium: doesn't honor vc runtime #14997
  • macos: restore @rpath in install_name of shared lib
  • mingw: restore injection of -lssp & call to autoreconf
  • fix discrepancy of source folder location in conan cache between msvc and other compilers (source folder location in local cache must be settings independent !)

Moreover, I've simplified unecessary complex things in msvc build branch (like _fix_msvc_platform_toolset, unecessary calls to MSBuildDeps or VCVars generators etc).


@ericLemanissierBot
Copy link

I detected other pull requests that are modifying libsodium/all recipe:

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline

All green in build 8 (69cba0e6ab4c5f06937fe53f28253ae4b0790023):

  • libsodium/cci.20220430@:
    All packages built successfully! (All logs)

  • libsodium/1.0.18@:
    All packages built successfully! (All logs)


Conan v2 pipeline (informative, not required for merge)

All green in build 8 (69cba0e6ab4c5f06937fe53f28253ae4b0790023):

  • libsodium/1.0.18@:
    All packages built successfully! (All logs)

  • libsodium/cci.20220430@:
    All packages built successfully! (All logs)

@conan-center-bot conan-center-bot merged commit 4e0dc05 into conan-io:master Dec 31, 2022
@SpaceIm SpaceIm deleted the fix/libsodium branch December 31, 2022 13:58
Comment on lines +137 to +171
# FIXME: There is currently no guarantee from new MSBuild helper that props files
# generated by MSBuildToolchain and MSBuildDeps have precedence over custom values of project.
# Therefore conantoolchain.props is injected manually before Microsoft.Cpp.Default.props like it was done
# with /p:ForceImportBeforeCppTargets in legacy MSBuild helper.
# see:
# - https://learn.microsoft.com/en-us/cpp/build/modify-project-properties-without-changing-project-file
# - https://github.com/conan-io/conan/issues/12155
conantoolchain_props = os.path.join(self.generators_folder, "conantoolchain.props")
replace_in_file(
self,
vcxproj_file,
f"<PlatformToolset>{old_toolset}</PlatformToolset>",
f"<PlatformToolset>{platform_toolset}</PlatformToolset>",
self, vcxproj_path,
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />",
f"<Import Project=\"{conantoolchain_props}\" />\n<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />",
)

def _build_msvc(self):
msvc_ver_subfolder = self._msvc_sln_folder or ("vs2022" if self.version != "1.0.18" else "vs2019")
msvc_sln_folder = os.path.join(self.build_folder, self.source_folder, "builds", "msvc", msvc_ver_subfolder)

msvc_sln_path = os.path.join(msvc_sln_folder, "libsodium.sln")

# 1.0.18 only supported up to vs2019. Add support for newer toolsets.
if self.version == "1.0.18" and msvc_ver_subfolder == "vs2019":
vcxproj_path = os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj")
self._fix_msvc_platform_toolset(vcxproj_path, "v142")
# Honor runtime library from profile
runtime_library = MSBuildToolchain(self).runtime_library
for prop_file, runtime_library_old in [
("DebugDEXE.props", "MultiThreadedDebugDLL"),
("DebugDLL.props", "MultiThreadedDebugDLL"),
("DebugLEXE.props", "MultiThreadedDebug"),
("DebugLIB.props", "MultiThreadedDebug"),
("DebugLTCG.props", "MultiThreadedDebug"),
("DebugSEXE.props", "MultiThreadedDebug"),
("ReleaseDEXE.props", "MultiThreadedDLL"),
("ReleaseDLL.props", "MultiThreadedDLL"),
("ReleaseLEXE.props", "MultiThreaded"),
("ReleaseLIB.props", "MultiThreaded"),
("ReleaseLTCG.props", "MultiThreaded"),
("ReleaseSEXE.props", "MultiThreaded"),
]:
replace_in_file(
self, os.path.join(msvc_builds_folder, "properties", prop_file),
f"<RuntimeLibrary>{runtime_library_old}</RuntimeLibrary>",
f"<RuntimeLibrary>{runtime_library}</RuntimeLibrary>",
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened conan-io/conan#12817, I think it will avoid all this mess (which was unecessary with legacy MSBuild helper).

RubenRBS pushed a commit to RubenRBS/conan-center-index that referenced this pull request Jan 16, 2023
* rely on similar CMakeLists in test v1 package & test package

* modernize more

* simplify msvc build logic

* properly inject props files generated by MSBuildToolchain

* relocatable shared lib on macOS

* restore autoreconf call if mingw

* honor runtime from profile
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.

[package] libsodium: doesn't honor vc runtime
5 participants