2020-07-14 18:16:18 +02:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
2018-08-13 14:46:34 +02:00
|
|
|
|
|
|
|
project(poly2tri LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
2020-07-14 18:16:18 +02:00
|
|
|
option(P2T_BUILD_TESTS "Build tests" OFF)
|
2020-08-27 19:12:15 +02:00
|
|
|
option(P2T_BUILD_TESTBED "Build the testbed application" OFF)
|
2020-07-14 18:16:18 +02:00
|
|
|
|
2018-08-13 14:46:34 +02:00
|
|
|
file(GLOB SOURCES poly2tri/common/*.cc poly2tri/sweep/*.cc)
|
2020-10-25 15:58:16 +01:00
|
|
|
file(GLOB HEADERS poly2tri/*.h poly2tri/common/*.h poly2tri/sweep/*.h)
|
|
|
|
add_library(poly2tri ${SOURCES} ${HEADERS})
|
2018-08-13 14:46:34 +02:00
|
|
|
target_include_directories(poly2tri INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
|
2020-07-14 18:16:18 +02:00
|
|
|
|
2022-04-20 22:12:21 +02:00
|
|
|
get_target_property(poly2tri_target_type poly2tri TYPE)
|
|
|
|
if(poly2tri_target_type STREQUAL SHARED_LIBRARY)
|
|
|
|
target_compile_definitions(poly2tri PRIVATE P2T_SHARED_EXPORTS)
|
|
|
|
else()
|
|
|
|
target_compile_definitions(poly2tri PUBLIC P2T_STATIC_EXPORTS)
|
|
|
|
endif()
|
|
|
|
|
2020-07-14 18:16:18 +02:00
|
|
|
if(P2T_BUILD_TESTS)
|
|
|
|
enable_testing()
|
|
|
|
add_subdirectory(unittest)
|
|
|
|
endif()
|
2020-08-27 19:12:15 +02:00
|
|
|
|
|
|
|
if(P2T_BUILD_TESTBED)
|
|
|
|
add_subdirectory(testbed)
|
|
|
|
endif()
|