-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
cmake: add compiler + remove compiler.version to reduce number of builds #1783
Changes from 4 commits
4a209d5
570f312
213a27b
92b1b37
2931d4d
aaf55f8
ecbb847
6af0f89
e6074ae
d8e61fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
cmake_minimum_required(VERSION 2.8.12) | ||
project(cmake_wrapper) | ||
|
||
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") | ||
else() | ||
include(conanbuildinfo.cmake) | ||
endif() | ||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_subdirectory("source_subfolder") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import os | ||
from conans import tools, ConanFile, CMake | ||
from conans.tools import Version | ||
from conans.errors import ConanInvalidConfiguration, ConanException | ||
|
||
|
||
|
@@ -13,7 +12,9 @@ class CMakeConan(ConanFile): | |
license = "BSD-3-Clause" | ||
exports_sources = ["CMakeLists.txt"] | ||
generators = "cmake" | ||
settings = "os", "arch", "build_type" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
requires = "openssl/1.1.1g" | ||
|
||
_source_subfolder = "source_subfolder" | ||
_cmake = None | ||
|
@@ -35,9 +36,9 @@ def _configure_cmake(self): | |
self._cmake = CMake(self) | ||
self._cmake.definitions["CMAKE_BOOTSTRAP"] = False | ||
if self.settings.os == "Linux": | ||
self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = True | ||
self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared | ||
self._cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-lz" | ||
madebr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
self._cmake.configure(source_dir=self._source_subfolder) | ||
self._cmake.configure() | ||
return self._cmake | ||
|
||
def build(self): | ||
|
@@ -54,6 +55,10 @@ def package(self): | |
cmake.install() | ||
tools.rmdir(os.path.join(self.package_folder, "doc")) | ||
|
||
def package_id(self): | ||
# CMake is a executable-only package, so the compiler version does not matter | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It matters since a system might be missing the runtimes. It won't fix the related issue. CCI will build one MSVC package using the 2015 runtimes, but the target system is a 2017 so it won't be able to execute There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Building with 2015 is fine, it’ll work with the 2015 - 2019 runtimes. https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2019 Removing the compiler ver may not be a best practice, because if CCI is upgraded to build with 2017+ and the system only had the 2015 runtime, that wouldn’t work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a very good point, however these recipes can be used to generate a package for 2013 locally, and the same scenario would cause trouble. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To what runtime do the official cmake windows builds link? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it make sense to only allow static runtime? Or should we just build all variants of cmake and don't bother with limiting anything? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://gitlab.kitware.com/cmake/cmake/-/tree/master/.gitlab/ci looks like vs2019 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the official build uses the static runtime. This is the latest release: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer to build static runtime for CMake (and built tools in general), this will avoid a dependency on Visual Studio CRT redist, which is not necessarily available (especially, if I am using alternate compiler). |
||
del self.info.settings.compiler.version | ||
|
||
def package_info(self): | ||
minor = self._minor_version() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openssl isn't enabled by default on Windows, I think this requires needs to be os specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the link.
I'll have to add the
CMAKE_USE_OPENSSL
option.