From 61f3ab8f23f4c924d455757bf3e65f8487521b5a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 13:57:42 +0200 Subject: Adding upstream version 1.3. Signed-off-by: Daniel Baumann --- tests/dependent-project/.gitignore | 2 ++ tests/dependent-project/CMakeLists.txt | 27 +++++++++++++++++++++++++++ tests/dependent-project/main.cpp | 12 ++++++++++++ tests/dependent-project/my_lib.cpp | 6 ++++++ tests/dependent-project/my_lib.h | 4 ++++ 5 files changed, 51 insertions(+) create mode 100644 tests/dependent-project/.gitignore create mode 100644 tests/dependent-project/CMakeLists.txt create mode 100644 tests/dependent-project/main.cpp create mode 100644 tests/dependent-project/my_lib.cpp create mode 100644 tests/dependent-project/my_lib.h (limited to 'tests/dependent-project') diff --git a/tests/dependent-project/.gitignore b/tests/dependent-project/.gitignore new file mode 100644 index 0000000..0bb214c --- /dev/null +++ b/tests/dependent-project/.gitignore @@ -0,0 +1,2 @@ +build-as-subproject +build-with-find-package \ No newline at end of file diff --git a/tests/dependent-project/CMakeLists.txt b/tests/dependent-project/CMakeLists.txt new file mode 100644 index 0000000..c371114 --- /dev/null +++ b/tests/dependent-project/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.1) +project(test_dep_2geom CXX C) +set(CMAKE_CXX_STANDARD 17) + +option(2GEOM_AS_SUBPROJECT "include 2geom as subproject" OFF) + +if (2GEOM_AS_SUBPROJECT) + message("Using 2geom as subdirectory") + set(2GEOM_BUILD_SHARED ON CACHE BOOL "Build 2geom shared version") + add_subdirectory("../../" 2geom) +else() + message("Using installed 2geom") + find_package(2Geom REQUIRED) +endif() + +add_library(my_lib SHARED my_lib.cpp) +add_executable(main main.cpp) +target_link_libraries(main my_lib) +target_link_libraries(my_lib PUBLIC 2Geom::2geom) + +install(TARGETS + main + my_lib + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + ) diff --git a/tests/dependent-project/main.cpp b/tests/dependent-project/main.cpp new file mode 100644 index 0000000..6b6469c --- /dev/null +++ b/tests/dependent-project/main.cpp @@ -0,0 +1,12 @@ +#include <2geom/2geom.h> +#include +#include "my_lib.h" + +int main() { + Geom::Rect rect1(0, 0, 1, 1); + Geom::Rect rect2(0.5, 0.5, 1.5, 1.5); + + std::cout << sum_of_three_points(Geom::Point(1, 1), Geom::Point(1, 2), Geom::Point(2, 3)); + + return rect1.intersects(rect2) ? 0 : 1; +} diff --git a/tests/dependent-project/my_lib.cpp b/tests/dependent-project/my_lib.cpp new file mode 100644 index 0000000..d5af62a --- /dev/null +++ b/tests/dependent-project/my_lib.cpp @@ -0,0 +1,6 @@ +#include "my_lib.h" + +using namespace Geom; +Point sum_of_three_points(const Point&a, const Point&b, const Point&c){ + return a+b+c; +} \ No newline at end of file diff --git a/tests/dependent-project/my_lib.h b/tests/dependent-project/my_lib.h new file mode 100644 index 0000000..2278aaf --- /dev/null +++ b/tests/dependent-project/my_lib.h @@ -0,0 +1,4 @@ +#pragma once +#include <2geom/2geom.h> + +Geom::Point sum_of_three_points(const Geom::Point&a, const Geom::Point&b, const Geom::Point&c); \ No newline at end of file -- cgit v1.2.3