vcpkg/ports/triangle/CMakeLists.txt
Nathan 47c0b1ce40
[triangle] Add new port (#13322)
* New Port : libigl-triangle

* Update ci.baseline.txt for libigl-triangle port

* Update ports/libigl-triangle/CONTROL

Unnecessary Port-Version

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update ports/libigl-triangle/portfile.cmake

Unnecessary inclusion of vcpkg_common_functions

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update ports/libigl-triangle/portfile.cmake

Use README from source as the copyright file

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Updates to libigl-translate port

* Update libigl-triangle port

* Update ports/libigl-triangle/CONTROL

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update ports/libigl-triangle/portfile.cmake

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Make the header copy properly and add CMake targets

* Utilize original sources for triangle library and rename to triangle

* Build triangle executable and add it to tools

* Fix Linux build which requires linking to m library for math functions

* Update scripts/ci.baseline.txt

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Instead of defining INT_PTR, use uintptr_t from stdint.h
Also, define FLOAT and VOID in the header so the user of the library does not have to define them

* Make sure the port works and can be used

* Remove the use of the SINGLE define for switching the REAL define to be float or double. Also make the define for VOID be void rather than replacing all VOID with void in order to reduce the patch size.

Co-authored-by: Nathan Mercer <nmercer@intermap.com>
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
2020-09-14 17:11:49 -07:00

46 lines
1.3 KiB
CMake

cmake_minimum_required(VERSION 2.8.12)
project(triangle)
include(GNUInstallDirs)
add_library(triangleLib triangle.c exports.def)
add_executable(triangle triangle.c)
target_compile_definitions(triangleLib PRIVATE -DTRILIBRARY -DANSI_DECLARATORS)
target_compile_definitions(triangle PRIVATE -DANSI_DECLARATORS)
if(WIN32)
target_compile_definitions(triangleLib PRIVATE -DNO_TIMER)
target_compile_definitions(triangle PRIVATE -DNO_TIMER)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(triangle m)
endif()
target_include_directories(triangleLib PUBLIC
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
)
set_target_properties(triangleLib PROPERTIES POSITION_INDEPENDENT_CODE ON)
set_target_properties(triangleLib PROPERTIES PUBLIC_HEADER
"${CMAKE_SOURCE_DIR}/triangle.h"
)
set_target_properties(triangleLib PROPERTIES OUTPUT_NAME "triangle")
install(TARGETS triangleLib EXPORT triangleTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(TARGETS triangle DESTINATION tools/triangle)
install(EXPORT triangleTargets
FILE triangleConfig.cmake
NAMESPACE triangle::
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/triangle"
)