Skip to content

Commit

Permalink
(#23853) libwebsockets: drop dead code
Browse files Browse the repository at this point in the history
* libwebsockets: drop dead code

version is always >=4.2.0
since 203af45

* fixup typo

comes from #17763

* fix compilation without openssl

* Apply suggestions from code review

Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>

---------

Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
  • Loading branch information
ericLemanissier and jcar87 authored May 9, 2024
1 parent 3a2472f commit f340809
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions recipes/libwebsockets/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from conan import ConanFile
from conan.errors import ConanException, ConanInvalidConfiguration
from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps
from conan.tools.files import get, replace_in_file, rmdir, copy, save, collect_libs, save
from conan.tools.microsoft import is_msvc
from conan.tools.files import get, replace_in_file, rmdir, copy, save, collect_libs
from conan.tools.microsoft import check_min_vs, is_msvc
from conan.tools.scm import Version
import os
import textwrap
Expand Down Expand Up @@ -236,11 +236,8 @@ def validate(self):
if self.options.shared and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5":
# https://github.com/conan-io/conan-center-index/pull/5321#issuecomment-826367276
raise ConanInvalidConfiguration("{}/{} shared=True with gcc<5 does not build. Please submit a PR with a fix.".format(self.name, self.version))
if Version(self.version) <= "4.0.15" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) >= "12":
raise ConanInvalidConfiguration("{}/{} with apple-clang>=12 does not build. Please submit a PR with a fix.".format(self.name, self.version))
if Version(self.version) >= "4.3.2":
if ("Visual" in str(self.settings.compiler.version) and Version(self.settings.compiler.version) < 16) or \
("msvc" == str(self.settings.compiler.version) and Version(self.settings.compiler.version) < 192):
if check_min_vs(self, "192", raise_invalid=False):
raise ConanInvalidConfiguration ("{}/{} requires at least Visual Studio 2019".format(self.name, self.version))

if self.options.with_hubbub:
Expand Down Expand Up @@ -301,8 +298,9 @@ def generate(self):
# Allow forwarding project targets to try_compile and derivatives
tc.variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = self.settings.build_type

# Ensure find_package(OpenSSL) is called early
tc.variables["CMAKE_PROJECT_libwebsockets_INCLUDE"] = os.path.join(self.source_folder, "project_include.cmake").replace('\\','/')
if self.options.with_ssl == "openssl":
# Ensure find_package(OpenSSL) is called early
tc.variables["CMAKE_PROJECT_libwebsockets_INCLUDE"] = os.path.join(self.source_folder, "project_include.cmake").replace('\\','/')

if self.options.with_ssl == "mbedtls":
tc.variables["LWS_WITH_MBEDTLS"] = True
Expand Down Expand Up @@ -422,9 +420,8 @@ def generate(self):
tc.variables["LWS_WITH_ALSA"] = False
tc.variables["LWS_WITH_GTK"] = False

if Version(self.version) >= "4.1.0":
tc.variables["LWS_WITH_SYS_SMD"] = self.settings.os != "Windows"
tc.variables["DISABLE_WERROR"] = True
tc.variables["LWS_WITH_SYS_SMD"] = self.settings.os != "Windows"
tc.variables["DISABLE_WERROR"] = True

tc.generate()
deps = CMakeDeps(self)
Expand All @@ -448,16 +445,7 @@ def _patch_sources(self):
os.path.join(self.source_folder, "cmake", "FindOpenSSLbins.cmake"),
"if(OPENSSL_FOUND)", "if(FALSE)")

if Version(self.version) == "4.0.15" and self.options.with_ssl:
replace_in_file(self,
cmakelists,
"list(APPEND LIB_LIST ws2_32.lib userenv.lib psapi.lib iphlpapi.lib)",
"list(APPEND LIB_LIST ws2_32.lib userenv.lib psapi.lib iphlpapi.lib crypt32.lib)"
)
if Version(self.version) < "4.1.0":
replace_in_file(self, cmakelists, "-Werror", "")
if Version(self.version) >= "4.1.4":
replace_in_file(self, cmakelists, "add_compile_options(/W3 /WX)", "add_compile_options(/W3)")
replace_in_file(self, cmakelists, "add_compile_options(/W3 /WX)", "add_compile_options(/W3)")

def build(self):
self._patch_sources()
Expand Down

0 comments on commit f340809

Please sign in to comment.