-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#12835) libmodbus: conan v2 support
* modernize libmodbus for conanv2 * fix some minor linter warnings * add test_v1_package * temporarely disable vcvars envs definition * fix missing assignment * fix wrong cross_building import * try requiring automake for macos builds * Remove project name from topics Co-authored-by: Uilian Ries <uilianries@gmail.com> * Use is_msvc Co-authored-by: Uilian Ries <uilianries@gmail.com> * Remove unneeded comments Co-authored-by: Uilian Ries <uilianries@gmail.com> * Fix conan.tools.microsoft imports * revert Macos check * add MSVC specific stuff ported following PR #12916 * add apple and destdir fixes * fix linting * remove autoreconf, not really needed * set win_bash in configure stage * use deps_user_info instead of conf to get ar_lib * add -FS to extra_cflags * replace wsock32 system_libs with ws2_32 (see libmodbus configure.ac) * minor changes * fix Windows AR arguments * Apply suggestions for test_v1_package Co-authored-by: Uilian Ries <uilianries@gmail.com> * revert removal of _settings_build for checking if msys2 is needed * Update recipes/libmodbus/all/conanfile.py Co-authored-by: Uilian Ries <uilianries@gmail.com> * Update recipes/libmodbus/all/conanfile.py Co-authored-by: Uilian Ries <uilianries@gmail.com> * Re-use test_package.c Co-authored-by: Uilian Ries <uilianries@gmail.com>
- Loading branch information
1 parent
f5d763e
commit a484011
Showing
7 changed files
with
147 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ sources: | |
patches: | ||
"3.1.6": | ||
- patch_file: "patches/0001-msvc-fixes.patch" | ||
base_path: "source_subfolder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.8) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(libmodbus REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE libmodbus::libmodbus) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run(os.path.join("bin", "test_package"), run_environment=True) | ||
|
||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(libmodbus CONFIG REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} ../test_package/test_package.c) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE libmodbus::libmodbus) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from conans import ConanFile, CMake | ||
from conans.tools import cross_building | ||
import os | ||
|
||
|
||
# legacy validation with Coann 1.x | ||
class TestPackageV1Conan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
|