From e4c7c12e5f98deb6451dfec5d209a06e23268ad9 Mon Sep 17 00:00:00 2001 From: Yi Zhang Date: Tue, 10 Sep 2024 20:17:23 +0800 Subject: [PATCH] initial upload --- .gitignore | 36 +--------- CMakeLists.txt | 15 +++++ GCTL_ELECMAGConfig.cmake.in | 21 ++++++ installer | 54 +++++++++++++++ lib/CMakeLists.txt | 62 +++++++++++++++++ lib/electromagnetic.h | 33 +++++++++ lib/electromagnetic/magnetometric.cpp | 96 +++++++++++++++++++++++++++ lib/electromagnetic/magnetometric.h | 58 ++++++++++++++++ 8 files changed, 341 insertions(+), 34 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 GCTL_ELECMAGConfig.cmake.in create mode 100755 installer create mode 100644 lib/CMakeLists.txt create mode 100644 lib/electromagnetic.h create mode 100644 lib/electromagnetic/magnetometric.cpp create mode 100644 lib/electromagnetic/magnetometric.h diff --git a/.gitignore b/.gitignore index e257658..aaab5ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,2 @@ -# ---> C++ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - +.DS_Store +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..d3061b9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.15.2) +# 设置项目名称与语言 +project(GCTL_ELECMAG VERSION 1.0) +# 添加配置配件编写的函数 +include(CMakePackageConfigHelpers) + +message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME}) +message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX}) +message(STATUS "Processor: " ${CMAKE_HOST_SYSTEM_PROCESSOR}) + +find_package(GCTL REQUIRED) +include_directories(${GCTL_INC_DIR}) + +# 添加库源文件地址 +add_subdirectory(lib) \ No newline at end of file diff --git a/GCTL_ELECMAGConfig.cmake.in b/GCTL_ELECMAGConfig.cmake.in new file mode 100644 index 0000000..2be7134 --- /dev/null +++ b/GCTL_ELECMAGConfig.cmake.in @@ -0,0 +1,21 @@ +@PACKAGE_INIT@ + +set(@PROJECT_NAME@_VERSION "@PROJECT_VERSION@") +set_and_check(@PROJECT_NAME@_INSTALL_PREFIX "${PACKAGE_PREFIX_DIR}") +set_and_check(@PROJECT_NAME@_INC_DIR "${PACKAGE_PREFIX_DIR}/include") +set_and_check(@PROJECT_NAME@_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include") +set_and_check(@PROJECT_NAME@_LIB_DIR "${PACKAGE_PREFIX_DIR}/lib") +set_and_check(@PROJECT_NAME@_LIBRARY_DIR "${PACKAGE_PREFIX_DIR}/lib") + +set(@PROJECT_NAME@_LIB gctl_elecmag) +set(@PROJECT_NAME@_LIBRARY gctl_elecmag) + +if(NOT GCTL_FOUND) + find_package(GCTL REQUIRED) + include_directories(${GCTL_INC_DIR}) +endif() + +# include target information +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") + +check_required_components(@PROJECT_NAME@) \ No newline at end of file diff --git a/installer b/installer new file mode 100755 index 0000000..dc4bdee --- /dev/null +++ b/installer @@ -0,0 +1,54 @@ +#!/bin/bash + +if [[ $# == 0 || ${1} == "help" ]]; then + echo "Compiles executables/libraries and maintains installed files. Two tools 'Cmake' and 'stow' are empolyed here. For more information, see https://cmake.org and https://www.gnu.org/software/stow/." + echo "" + echo "School of Earth Sciences, Zhejiang University" + echo "Yi Zhang (yizhang-geo@zju.edu.cn)" + echo "" + echo "Usage: ./config.sh [option] [Cmake options]" + echo "" + echo "Options:" + echo "(1) configure: Configure Cmake project(s). This option could take extra Cmake options as in