forked from conan-io/conan-center-index
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(conan-io#13037) [Catch2] adapt recipe for Conan v2
* [Catch2] adapt recipe for Conan v2 * fixes * fixes * fixes * fixes * fixes 4 * fixes 5 * fixes 6 * Update recipes/catch2/3.x.x/conanfile.py Co-authored-by: Uilian Ries <uilianries@gmail.com> * Update recipes/catch2/3.x.x/conanfile.py Co-authored-by: Uilian Ries <uilianries@gmail.com> * Update recipes/catch2/3.x.x/conanfile.py Co-authored-by: Uilian Ries <uilianries@gmail.com> * Update recipes/catch2/3.x.x/conanfile.py * fix patches * fix * fix * remove comments * Update recipes/catch2/3.x.x/conanfile.py Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * Update recipes/catch2/3.x.x/conanfile.py Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * test package changes * Move test package files (#2) * move gtest Signed-off-by: Uilian Ries <uilianries@gmail.com> * Delete test_all.sh * Use cmake targets * Do not use settings Signed-off-by: Uilian Ries <uilianries@gmail.com> Signed-off-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
- Loading branch information
Showing
9 changed files
with
152 additions
and
65 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
project(test_package) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(Catch2 REQUIRED) | ||
|
||
if(NOT WITH_PREFIX) | ||
add_executable(test_package ../test_package/000-CatchMain.cpp ../test_package/100-Fix-Section.cpp) | ||
target_link_libraries(test_package PRIVATE Catch2::Catch2) | ||
|
||
if(WITH_MAIN) | ||
add_executable(standalone ../test_package/200-standalone.cpp) | ||
target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) | ||
if(WITH_BENCHMARK) | ||
add_executable(benchmark ../test_package/300-benchmark.cpp) | ||
target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) | ||
endif() | ||
endif() | ||
else() | ||
add_executable(test_package ../test_package/000-CatchMain.cpp ../test_package/400-with-prefix.cpp) | ||
target_link_libraries(test_package PRIVATE Catch2::Catch2) | ||
|
||
if(WITH_MAIN) | ||
add_executable(standalone ../test_package/400-with-prefix.cpp) | ||
target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) | ||
endif() | ||
endif() |
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,24 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.tools import Version | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["WITH_MAIN"] = self.options["catch2"].with_main | ||
cmake.definitions["WITH_BENCHMARK"] = self.options["catch2"].with_main and self.options["catch2"].with_benchmark | ||
cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run(os.path.join("bin", "test_package"), run_environment=True) | ||
if self.options["catch2"].with_main: | ||
self.run(os.path.join("bin", "standalone"), run_environment=True) | ||
if self.options["catch2"].with_benchmark: | ||
self.run(os.path.join("bin", "benchmark"), run_environment=True) |
This file was deleted.
Oops, something went wrong.
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
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,18 +1,31 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.tools import Version | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, CMakeToolchain | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout | ||
import os | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["WITH_PREFIX"] = self.dependencies[self.tested_reference_str].options.with_prefix | ||
tc.generate() | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run(os.path.join("bin", "standalone"), run_environment=True) | ||
self.run(os.path.join("bin", "benchmark"), run_environment=True) | ||
if can_run(self): | ||
self.run(os.path.join(self.cpp.build.bindirs[0], "standalone"), env="conanrun") | ||
self.run(os.path.join(self.cpp.build.bindirs[0], "benchmark"), 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,22 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(Catch2 REQUIRED CONFIG) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
if(NOT WITH_PREFIX) | ||
add_executable(standalone ../test_package/100-standalone.cpp) | ||
target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) | ||
add_executable(benchmark ../test_package/200-benchmark.cpp) | ||
target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) | ||
else() | ||
add_executable(standalone ../test_package/300-standalone-with-prefix.cpp) | ||
target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) | ||
add_executable(benchmark ../test_package/400-benchmark-with-prefix.cpp) | ||
target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) | ||
endif() |
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,18 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conans.tools import Version | ||
import os | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
self.run(os.path.join("bin", "standalone"), run_environment=True) | ||
self.run(os.path.join("bin", "benchmark"), run_environment=True) |