v2.0.1 add tin examples
This commit is contained in:
216
CMakeLists.txt
216
CMakeLists.txt
@@ -1,187 +1,75 @@
|
||||
cmake_minimum_required(VERSION 3.15.2)
|
||||
# 设置项目名称与语言
|
||||
project(GCTL_EXAMPLES VERSION 1.0)
|
||||
project(GCTL_TUTORIALS VERSION 2.0.1)
|
||||
|
||||
# 设置编译选项
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
||||
if(WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -O3")
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
# ExprTK库在macOS 15.4中编译会有错误 添加以下命令对应检查项
|
||||
add_compile_options(-Wno-missing-template-arg-list-after-template-kw)
|
||||
endif()
|
||||
|
||||
# 设置可执行文件的输出地址
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
||||
|
||||
find_package(GCTL)
|
||||
find_package(GCTL_MESH)
|
||||
find_package(GCTL_POTENTIAL)
|
||||
find_package(GCTL_SEISMIC)
|
||||
find_package(GCTL_ELECMAG)
|
||||
find_package(GCTL_GRAPHIC)
|
||||
find_package(GCTL_OPTIMIZATION)
|
||||
find_package(PkgConfig)
|
||||
pkg_search_module(EDITLINE QUIET libeditline)
|
||||
|
||||
if(GCT_FOUND)
|
||||
include_directories(${GCTL_INC_DIR})
|
||||
endif()
|
||||
find_package(GCTL QUIET)
|
||||
find_package(GCTL_MESH QUIET)
|
||||
find_package(GCTL_OPTIMIZATION QUIET)
|
||||
find_package(GCTL_POTENTIAL QUIET)
|
||||
include_directories(${GCTL_INC_DIR})
|
||||
include_directories(${GCTL_MESH_INC_DIR})
|
||||
include_directories(${GCTL_OPTIMIZATION_INC_DIR})
|
||||
include_directories(${GCTL_POTENTIAL_INC_DIR})
|
||||
|
||||
if(GCTL_OPENMP)
|
||||
message(STATUS "GCTL is compiled with OpenMP support.")
|
||||
find_package(OpenMP REQUIRED)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
|
||||
message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR})
|
||||
|
||||
if(GCTL_FOUND)
|
||||
message(STATUS "GCTL Version: " ${GCTL_VERSION})
|
||||
endif()
|
||||
|
||||
if(GCTL_MESH_FOUND)
|
||||
include_directories(${GCTL_MESH_INC_DIR})
|
||||
endif()
|
||||
|
||||
if(GCTL_POTENTIAL_FOUND)
|
||||
include_directories(${GCTL_POTENTIAL_INC_DIR})
|
||||
endif()
|
||||
|
||||
if(GCTL_SEISMIC_FOUND)
|
||||
include_directories(${GCTL_SEISMIC_INC_DIR})
|
||||
endif()
|
||||
|
||||
if(GCTL_ELECMAG_FOUND)
|
||||
include_directories(${GCTL_ELECMAG_INC_DIR})
|
||||
endif()
|
||||
|
||||
if(GCTL_GRAPHIC_FOUND)
|
||||
include_directories(${GCTL_GRAPHIC_INC_DIR})
|
||||
message(STATUS "GCTL_MESH Version: " ${GCTL_MESH_VERSION})
|
||||
endif()
|
||||
|
||||
if(GCTL_OPTIMIZATION_FOUND)
|
||||
include_directories(${GCTL_OPTIMIZATION_INC_DIR})
|
||||
message(STATUS "GCTL_OPTIMIZATION Version: " ${GCTL_OPTIMIZATION_VERSION})
|
||||
endif()
|
||||
|
||||
find_package(LibLCG)
|
||||
if(LibLCG_FOUND)
|
||||
include_directories(${LibLCG_INC_DIR})
|
||||
if(GCTL_POTENTIAL_FOUND)
|
||||
message(STATUS "GCTL_POTENTIAL Version: " ${GCTL_POTENTIAL_VERSION})
|
||||
endif()
|
||||
|
||||
macro(add_example name switch)
|
||||
if(${switch})
|
||||
# 添加可执行程序名称
|
||||
add_executable(${name} examples/${name}.cpp)
|
||||
# 设置安装后的动态库调用地址
|
||||
set_target_properties(${name} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
target_link_libraries(${name} PUBLIC OpenMP::OpenMP_CXX)
|
||||
macro(add_toolkit ex_dir name lib1 lib2 lib3 lib4)
|
||||
#aux_source_directory(${name} src/${ex_dir}/${name}.cpp)
|
||||
add_executable(${name} src/${ex_dir}/${name}.cpp)
|
||||
set_target_properties(${name} PROPERTIES INSTALL_RPATH /usr/local/lib)
|
||||
set_target_properties(${name} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(${lib1})
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_LIB})
|
||||
endif()
|
||||
|
||||
if(${lib2})
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_MESH_LIB})
|
||||
endif()
|
||||
|
||||
# 链接动态库
|
||||
if(GCTL_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_LIB})
|
||||
endif()
|
||||
if(${lib3})
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_OPTIMIZATION_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_MESH_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_MESH_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_POTENTIAL_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_POTENTIAL_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_SEISMIC_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_SEISMIC_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_ELECMAG_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_ELECMAG_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_GRAPHIC_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_GRAPHIC_LIB})
|
||||
endif()
|
||||
|
||||
if(GCTL_OPTIMIZATION_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_OPTIMIZATION_LIB})
|
||||
endif()
|
||||
|
||||
if(LibLCG_FOUND)
|
||||
target_link_libraries(${name} PUBLIC ${LibLCG_LIB})
|
||||
endif()
|
||||
endif()
|
||||
if(${lib4})
|
||||
target_link_libraries(${name} PUBLIC ${GCTL_POTENTIAL_LIB})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
add_example(array_ex ON)
|
||||
add_example(sparray_ex ON)
|
||||
add_example(sparray2d_ex ON)
|
||||
add_example(spmat_ex ON)
|
||||
add_example(spmat_ex2 ON)
|
||||
add_example(spmat_ex3 ON)
|
||||
add_example(spmat_ex4 ON)
|
||||
add_example(spmat_ex5 ON)
|
||||
add_example(spmat_ex6 ON)
|
||||
add_example(spmat_ex7 ON)
|
||||
add_example(sptr_ex ON)
|
||||
add_example(stream_ex ON)
|
||||
add_example(stream_template_ex ON)
|
||||
add_example(vector_ex ON)
|
||||
add_example(spmat_inversion_ex ON)
|
||||
add_example(find_index_ex ON)
|
||||
add_example(difference_1d_ex ON)
|
||||
add_example(dynamic_stddev_ex ON)
|
||||
add_example(ellipse_filter_ex ON)
|
||||
add_example(gaussian_hill_ex ON)
|
||||
add_example(mat_inverse_ex ON)
|
||||
add_example(svd_ex ON)
|
||||
add_example(track_ellipse_ex ON)
|
||||
add_example(frac_model_ex ON)
|
||||
add_example(difference_2d_ex ON)
|
||||
add_example(geometry2d_ex ON)
|
||||
add_example(point2d_rotate_ex ON)
|
||||
add_example(point_ex ON)
|
||||
add_example(tensor_ex ON)
|
||||
add_example(entity_ex ON)
|
||||
add_example(cut_2d_tri_mesh_ex ON)
|
||||
add_example(cut_3d_tri_mesh_ex ON)
|
||||
add_example(tetra_neighbor_ex ON)
|
||||
add_example(gobser_tri2d_ex ON)
|
||||
add_example(gobser_rect2d_ex ON)
|
||||
add_example(gobser_polygon_ex ON)
|
||||
add_example(gobser_tricone_ex ON)
|
||||
add_example(gobser_block_ex ON)
|
||||
add_example(gobser_tesseroid_ex ON)
|
||||
add_example(gobser_tetra_sph_ex ON)
|
||||
add_example(mobser_tesseroid_ex ON)
|
||||
add_example(rtp_ex ON)
|
||||
add_example(drtp_ex ON)
|
||||
add_example(gobser_sphere_ex ON)
|
||||
add_example(grav_gradient_ex ON)
|
||||
add_example(mobser_block_ex ON)
|
||||
add_example(mobser_tetra_ex ON)
|
||||
add_example(gobser_tri_ex ON)
|
||||
add_example(gobser_tri_sph_ex ON)
|
||||
add_example(gobser_tetra_ex ON)
|
||||
add_example(getoption_ex ON)
|
||||
add_example(heap_sort_ex ON)
|
||||
add_example(flags_parser_ex ON)
|
||||
add_example(progressbar_ex ON)
|
||||
add_example(basic_io_ex ON)
|
||||
add_example(gmsh_io_ex ON)
|
||||
add_example(surfer_io_ex ON)
|
||||
add_example(triangle_io_ex ON)
|
||||
add_example(xyz_io_ex ON)
|
||||
add_example(text_io_ex ON)
|
||||
add_example(read_netcdf_ex ON)
|
||||
add_example(save_netcdf_ex ON)
|
||||
add_example(griding_ex ON)
|
||||
add_example(mesh_sample1_ex ON)
|
||||
add_example(mesh_sample4_ex ON)
|
||||
add_example(mesh_sample6_ex ON)
|
||||
add_example(mesh_sample7_ex ON)
|
||||
add_example(mesh_sample8_ex ON)
|
||||
add_example(mesh_sample9_ex ON)
|
||||
add_example(mesh_sample10_ex ON)
|
||||
add_example(mesh_sample2_ex ON)
|
||||
add_example(mesh_sample3_ex ON)
|
||||
add_example(mesh_sample5_ex ON)
|
||||
add_example(wavelet_ex ON)
|
||||
add_example(traveltime_tri2d_ex ON)
|
||||
add_example(traveltime_tri2d_ex2 ON)
|
||||
add_example(traveltime_tri2d_ex3 ON)
|
||||
add_example(traveltime_tet3d_ex ON)
|
||||
add_example(traveltime_tet3d_ex2 ON)
|
||||
add_example(gmt_plot_grid_ex ON)
|
||||
add_example(parse_string ON)
|
||||
if(GCTL_FOUND AND GCTL_MESH_FOUND)
|
||||
add_toolkit(mesh create_tin_ex1 ON ON OFF OFF)
|
||||
add_toolkit(mesh create_tin_ex2 ON ON OFF OFF)
|
||||
add_toolkit(mesh create_tin_ex3 ON ON OFF OFF)
|
||||
add_toolkit(mesh create_tin_ex4 ON ON OFF OFF)
|
||||
endif()
|
Reference in New Issue
Block a user