summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/2geom/tests/dependent-project
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:24:48 +0000
commitcca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch)
tree146f39ded1c938019e1ed42d30923c2ac9e86789 /src/3rdparty/2geom/tests/dependent-project
parentInitial commit. (diff)
downloadinkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz
inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/3rdparty/2geom/tests/dependent-project')
-rw-r--r--src/3rdparty/2geom/tests/dependent-project/CMakeLists.txt27
-rw-r--r--src/3rdparty/2geom/tests/dependent-project/build-and-run.sh25
-rw-r--r--src/3rdparty/2geom/tests/dependent-project/main.cpp12
-rw-r--r--src/3rdparty/2geom/tests/dependent-project/my_lib.cpp6
-rw-r--r--src/3rdparty/2geom/tests/dependent-project/my_lib.h4
5 files changed, 74 insertions, 0 deletions
diff --git a/src/3rdparty/2geom/tests/dependent-project/CMakeLists.txt b/src/3rdparty/2geom/tests/dependent-project/CMakeLists.txt
new file mode 100644
index 0000000..c371114
--- /dev/null
+++ b/src/3rdparty/2geom/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/src/3rdparty/2geom/tests/dependent-project/build-and-run.sh b/src/3rdparty/2geom/tests/dependent-project/build-and-run.sh
new file mode 100644
index 0000000..b7bb2db
--- /dev/null
+++ b/src/3rdparty/2geom/tests/dependent-project/build-and-run.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -x
+mkdir -p ../../opt2
+mkdir -p build-as-subproject
+(
+ cd build-as-subproject;
+ cmake .. -D2GEOM_AS_SUBPROJECT=ON \
+ -DCMAKE_INSTALL_PREFIX=../../../opt2
+ make main -j 2
+ ./main
+ make install
+)
+
+mkdir -p build-with-find-package
+(
+ cd build-with-find-package;
+ cmake .. -D2GEOM_AS_SUBPROJECT=OFF \
+ -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address" \
+ -DCMAKE_INSTALL_PREFIX=../../../opt2 \
+ -D2Geom_DIR="$PWD/../../../opt/lib/cmake/2Geom"
+ make main -j 2
+ ./main
+ make install
+)
diff --git a/src/3rdparty/2geom/tests/dependent-project/main.cpp b/src/3rdparty/2geom/tests/dependent-project/main.cpp
new file mode 100644
index 0000000..6b6469c
--- /dev/null
+++ b/src/3rdparty/2geom/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/src/3rdparty/2geom/tests/dependent-project/my_lib.cpp b/src/3rdparty/2geom/tests/dependent-project/my_lib.cpp
new file mode 100644
index 0000000..d5af62a
--- /dev/null
+++ b/src/3rdparty/2geom/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/src/3rdparty/2geom/tests/dependent-project/my_lib.h b/src/3rdparty/2geom/tests/dependent-project/my_lib.h
new file mode 100644
index 0000000..2278aaf
--- /dev/null
+++ b/src/3rdparty/2geom/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