1 Star 0 Fork 0

yizhangss/gctl_examples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMakeLists.txt 4.79 KB
一键复制 编辑 原始数据 按行查看 历史
yizhangss 提交于 2023-09-04 13:40 . add matrix_Ex
cmake_minimum_required(VERSION 3.15.2)
# 设置项目名称与语言
project(GCTL_EXAMPLES VERSION 1.0)
# 设置编译选项
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")
endif()
# 设置可执行文件的输出地址
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
find_package(GCTL)
find_package(GCTL_POTENTIAL)
find_package(GCTL_SEISMIC)
find_package(GCTL_ELECMAG)
find_package(GCTL_GRAPHIC)
find_package(GCTL_OPTIMIZATION)
if(GCT_FOUND)
include_directories(${GCTL_INC_DIR})
endif()
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}")
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})
endif()
if(GCTL_OPTIMIZATION_FOUND)
include_directories(${GCTL_OPTIMIZATION_INC_DIR})
endif()
find_package(LibLCG)
if(LibLCG_FOUND)
include_directories(${LibLCG_INC_DIR})
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)
# 链接动态库
if(GCTL_FOUND)
target_link_libraries(${name} PUBLIC ${GCTL_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()
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(matrix_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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yizhangss/gctl_examples.git
git@gitee.com:yizhangss/gctl_examples.git
yizhangss
gctl_examples
gctl_examples
master

搜索帮助