102 lines
3.5 KiB
CMake
102 lines
3.5 KiB
CMake
cmake_minimum_required(VERSION 3.15.2)
|
|
# 设置项目名称与语言
|
|
project(GCTL_TUTORIALS VERSION 2.0.1)
|
|
|
|
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_SOURCE_DIR}/bin)
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
|
|
|
|
find_package(PkgConfig)
|
|
pkg_search_module(EDITLINE QUIET libeditline)
|
|
|
|
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})
|
|
|
|
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)
|
|
message(STATUS "GCTL_MESH Version: " ${GCTL_MESH_VERSION})
|
|
endif()
|
|
|
|
if(GCTL_OPTIMIZATION_FOUND)
|
|
message(STATUS "GCTL_OPTIMIZATION Version: " ${GCTL_OPTIMIZATION_VERSION})
|
|
endif()
|
|
|
|
if(GCTL_POTENTIAL_FOUND)
|
|
message(STATUS "GCTL_POTENTIAL Version: " ${GCTL_POTENTIAL_VERSION})
|
|
endif()
|
|
|
|
macro(add_example 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(${lib3})
|
|
target_link_libraries(${name} PUBLIC ${GCTL_OPTIMIZATION_LIB})
|
|
endif()
|
|
|
|
if(${lib4})
|
|
target_link_libraries(${name} PUBLIC ${GCTL_POTENTIAL_LIB})
|
|
endif()
|
|
endmacro()
|
|
|
|
if(GCTL_FOUND)
|
|
add_example(core array_ex ON OFF OFF OFF)
|
|
add_example(core autodiff_ex ON OFF OFF OFF)
|
|
add_example(core ceemdan_ex ON OFF OFF OFF)
|
|
add_example(core cliplot_ex ON OFF OFF OFF)
|
|
add_example(core dsv_io_ex ON OFF OFF OFF)
|
|
add_example(core eemd_ex ON OFF OFF OFF)
|
|
add_example(core fft_ex ON OFF OFF OFF)
|
|
add_example(core fft_filter_ex ON OFF OFF OFF)
|
|
add_example(core fft2d_ex ON OFF OFF OFF)
|
|
add_example(core fir_filter_ex ON OFF OFF OFF)
|
|
add_example(core getoption_ex ON OFF OFF OFF)
|
|
add_example(core gmt_ex ON OFF OFF OFF)
|
|
add_example(core gnuplot_ex ON OFF OFF OFF)
|
|
add_example(core kde_ex ON OFF OFF OFF)
|
|
add_example(core legendre_ex ON OFF OFF OFF)
|
|
add_example(core multinary_ex ON OFF OFF OFF)
|
|
add_example(core ply_io_ex ON OFF OFF OFF)
|
|
add_example(core process_ex ON OFF OFF OFF)
|
|
add_example(core refellipsoid_ex ON OFF OFF OFF)
|
|
add_example(core sparray_ex ON OFF OFF OFF)
|
|
add_example(core sparray2d_ex ON OFF OFF OFF)
|
|
add_example(core spmat_ex ON OFF OFF OFF)
|
|
add_example(core stl_io_ex ON OFF OFF OFF)
|
|
add_example(core windowfunc_ex ON OFF OFF OFF)
|
|
endif()
|
|
|
|
#if(GCTL_FOUND AND GCTL_MESH_FOUND)
|
|
# add_example(mesh create_tin_ex1 ON ON OFF OFF)
|
|
# add_example(mesh create_tin_ex2 ON ON OFF OFF)
|
|
# add_example(mesh create_tin_ex3 ON ON OFF OFF)
|
|
# add_example(mesh create_tin_ex4 ON ON OFF OFF)
|
|
#endif() |