diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:57:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 11:57:42 +0000 |
commit | 61f3ab8f23f4c924d455757bf3e65f8487521b5a (patch) | |
tree | 885599a36a308f422af98616bc733a0494fe149a /tests/dependent-project | |
parent | Initial commit. (diff) | |
download | lib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.tar.xz lib2geom-61f3ab8f23f4c924d455757bf3e65f8487521b5a.zip |
Adding upstream version 1.3.upstream/1.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dependent-project')
-rw-r--r-- | tests/dependent-project/.gitignore | 2 | ||||
-rw-r--r-- | tests/dependent-project/CMakeLists.txt | 27 | ||||
-rw-r--r-- | tests/dependent-project/main.cpp | 12 | ||||
-rw-r--r-- | tests/dependent-project/my_lib.cpp | 6 | ||||
-rw-r--r-- | tests/dependent-project/my_lib.h | 4 |
5 files changed, 51 insertions, 0 deletions
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 <iostream> +#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 |