upload src
This commit is contained in:
@@ -1,54 +1,67 @@
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(lib TETGENLIB_SRC)
|
||||
aux_source_directory(lib TRILIB_SRC)
|
||||
# 设置编译选项
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||
|
||||
# 以下部分为库的编译
|
||||
# 注意目标名必须唯一 所以不能直接生成相同名称的动态库与静态库
|
||||
# 注意此处不必为目标名称添加lib前缀和相应后缀,cmake会自行添加
|
||||
add_library(tetlib SHARED ${TETGENLIB_SRC})
|
||||
add_library(trilib SHARED ${TRILIB_SRC})
|
||||
# 首先添加静态库的生成命令
|
||||
add_library(tetlib_static STATIC ${TETGENLIB_SRC})
|
||||
add_library(trilib_static STATIC ${TRILIB_SRC})
|
||||
# 设置编译选项 将源代码编译为动态与静态库
|
||||
# 设置静态库的输出名称从而获得与动态库名称相同的静态库
|
||||
set_target_properties(tetlib PROPERTIES OUTPUT_NAME "tetgen")
|
||||
set_target_properties(tetlib_static PROPERTIES OUTPUT_NAME "tetgen")
|
||||
set_target_properties(trilib PROPERTIES OUTPUT_NAME "triangle")
|
||||
set_target_properties(trilib_static PROPERTIES OUTPUT_NAME "triangle")
|
||||
# 设置库的编译选项
|
||||
set_target_properties(trilib PROPERTIES COMPILE_DEFINITIONS "TRILIBRARY")
|
||||
set_target_properties(trilib_static PROPERTIES COMPILE_DEFINITIONS "TRILIBRARY")
|
||||
# 设置输出目标属性以同时输出动态库与静态库
|
||||
set_target_properties(tetlib PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(tetlib_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(trilib PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(trilib_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
# 设置动态库的版本号
|
||||
set_target_properties(tetlib PROPERTIES VERSION 1.5.1 SOVERSION 1.5.1)
|
||||
set_target_properties(trilib PROPERTIES VERSION 1.6 SOVERSION 1.6)
|
||||
# 设置库文件的输出地址
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
||||
|
||||
# 库的安装命令
|
||||
if(WIN32)
|
||||
install(TARGETS tetlib DESTINATION lib)
|
||||
install(TARGETS tetlib_static DESTINATION lib)
|
||||
install(TARGETS trilib DESTINATION lib)
|
||||
install(TARGETS trilib_static DESTINATION lib)
|
||||
else()
|
||||
install(TARGETS tetlib tetlib_static
|
||||
install(TARGETS trilib trilib_static
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
# 头文件安装命令
|
||||
install(FILES lib/tetgen.h DESTINATION include)
|
||||
install(FILES lib/triangle.h DESTINATION include)
|
||||
|
||||
|
||||
# 设置可执行文件的输出地址
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
# 以下为可执行命令行工具的编译
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(tool TETGEN_SRC)
|
||||
# 添加可执行文件
|
||||
add_executable(tetgen ${TETGEN_SRC})
|
||||
add_executable(triangle ${TRILIB_SRC})
|
||||
# 命令行工具安装命令
|
||||
install(TARGETS tetgen RUNTIME DESTINATION sbin)
|
||||
install(TARGETS triangle RUNTIME DESTINATION sbin)
|
||||
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(tool SHOWME_SRC)
|
||||
# 设置X11的地址
|
||||
include_directories(/opt/X11/include)
|
||||
# 添加可执行文件
|
||||
add_executable(showme_triangle ${SHOWME_SRC})
|
||||
# 链接动态库
|
||||
find_library(X_LIBRARY X11 /opt/X11/lib)
|
||||
target_link_libraries(showme_triangle PUBLIC ${X_LIBRARY})
|
||||
# 命令行工具安装命令
|
||||
install(TARGETS showme_triangle RUNTIME DESTINATION sbin)
|
||||
|
||||
# 以下部分为例子程序的编译
|
||||
# 添加可执行文件
|
||||
add_executable(tetcall sample/tetcall.cxx)
|
||||
add_executable(tricall sample/tricall.cxx)
|
||||
# 为安装文件添加动态库的搜索地址 在Windows下并没有什么用 直接忽略
|
||||
set_target_properties(tetcall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
set_target_properties(tricall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
# 链接动态库
|
||||
target_link_libraries(tetcall PUBLIC tetlib)
|
||||
target_link_libraries(tricall PUBLIC trilib)
|
||||
|
||||
@@ -248,42 +248,58 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _TRIANGLE_H
|
||||
#define _TRIANGLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#define REAL double
|
||||
#define ANSI_DECLARATORS
|
||||
#define VOID int
|
||||
|
||||
struct triangulateio {
|
||||
REAL *pointlist; /* In / out */
|
||||
REAL *pointattributelist; /* In / out */
|
||||
int *pointmarkerlist; /* In / out */
|
||||
int numberofpoints; /* In / out */
|
||||
int numberofpointattributes; /* In / out */
|
||||
REAL *pointlist; /* In / out */
|
||||
REAL *pointattributelist; /* In / out */
|
||||
int *pointmarkerlist; /* In / out */
|
||||
int numberofpoints; /* In / out */
|
||||
int numberofpointattributes; /* In / out */
|
||||
|
||||
int *trianglelist; /* In / out */
|
||||
REAL *triangleattributelist; /* In / out */
|
||||
REAL *trianglearealist; /* In only */
|
||||
int *neighborlist; /* Out only */
|
||||
int numberoftriangles; /* In / out */
|
||||
int numberofcorners; /* In / out */
|
||||
int numberoftriangleattributes; /* In / out */
|
||||
int *trianglelist; /* In / out */
|
||||
REAL *triangleattributelist; /* In / out */
|
||||
REAL *trianglearealist; /* In only */
|
||||
int *neighborlist; /* Out only */
|
||||
int numberoftriangles; /* In / out */
|
||||
int numberofcorners; /* In / out */
|
||||
int numberoftriangleattributes; /* In / out */
|
||||
|
||||
int *segmentlist; /* In / out */
|
||||
int *segmentmarkerlist; /* In / out */
|
||||
int numberofsegments; /* In / out */
|
||||
int *segmentlist; /* In / out */
|
||||
int *segmentmarkerlist; /* In / out */
|
||||
int numberofsegments; /* In / out */
|
||||
|
||||
REAL *holelist; /* In / pointer to array copied out */
|
||||
int numberofholes; /* In / copied out */
|
||||
REAL *holelist; /* In / pointer to array copied out */
|
||||
int numberofholes; /* In / copied out */
|
||||
|
||||
REAL *regionlist; /* In / pointer to array copied out */
|
||||
int numberofregions; /* In / copied out */
|
||||
REAL *regionlist; /* In / pointer to array copied out */
|
||||
int numberofregions; /* In / copied out */
|
||||
|
||||
int *edgelist; /* Out only */
|
||||
int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
|
||||
REAL *normlist; /* Used only with Voronoi diagram; out only */
|
||||
int numberofedges; /* Out only */
|
||||
int *edgelist; /* Out only */
|
||||
int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
|
||||
REAL *normlist; /* Used only with Voronoi diagram; out only */
|
||||
int numberofedges; /* Out only */
|
||||
};
|
||||
|
||||
#ifdef ANSI_DECLARATORS
|
||||
void triangulate(char *, struct triangulateio *, struct triangulateio *,
|
||||
struct triangulateio *);
|
||||
void trifree(VOID *memptr);
|
||||
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *);
|
||||
void trifree(VOID *memptr);
|
||||
#else /* not ANSI_DECLARATORS */
|
||||
void triangulate();
|
||||
void trifree();
|
||||
void triangulate();
|
||||
void trifree();
|
||||
#endif /* not ANSI_DECLARATORS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _TRIANGLE_H
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "triangle.h"
|
||||
#include "../lib/triangle.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
@@ -37,15 +37,8 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void report(io, markers, reporttriangles, reportneighbors, reportsegments,
|
||||
reportedges, reportnorms)
|
||||
struct triangulateio *io;
|
||||
int markers;
|
||||
int reporttriangles;
|
||||
int reportneighbors;
|
||||
int reportsegments;
|
||||
int reportedges;
|
||||
int reportnorms;
|
||||
void report(triangulateio *io, int markers, int reporttriangles, int reportneighbors,
|
||||
int reportsegments, int reportedges, int reportnorms)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
3375
src/tool/showme.c
Normal file
3375
src/tool/showme.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user