Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.20)
project(gmsh_tools VERSION 1.0 LANGUAGES CXX)

set(PROJECT_IS_TOP_LEVEL OFF)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(PROJECT_IS_TOP_LEVEL ON)
endif()

option(BUILD_GMSH_TOOLS_EXECUTABLE "Build the gmsh_tools executable" ${PROJECT_IS_TOP_LEVEL})

set(LIB_NAME gmshtools)
set(EXE_NAME ${PROJECT_NAME})

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(LIB_SOURCES src/gmshData.cpp src/gmshElement.cpp src/gmshMesh.cpp)

add_library(${LIB_NAME} STATIC ${LIB_SOURCES})
set_target_properties(${LIB_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)

target_include_directories(${LIB_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

if(BUILD_GMSH_TOOLS_EXECUTABLE)
add_executable(${EXE_NAME} src/main.cc)

target_link_libraries(${EXE_NAME}
PRIVATE ${LIB_NAME}
)
endif()


include(GNUInstallDirs)

install(TARGETS ${LIB_NAME}
EXPORT ${LIB_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(DIRECTORY include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

if(BUILD_EXECUTABLE)
install(TARGETS ${EXE_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif()

install(EXPORT ${LIB_NAME}Targets
FILE ${LIB_NAME}Targets.cmake
NAMESPACE ${LIB_NAME}::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIB_NAME}
)

include(CMakePackageConfigHelpers)

write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/cmake/${LIB_NAME}Config.cmake"
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/cmake/${LIB_NAME}Config.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIB_NAME}
)
16 changes: 0 additions & 16 deletions Makefile

This file was deleted.

10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,18 @@ This C++ librairy provides some tools to read and write meshes:
The library runs on Unix systems. It is written in C++11 and requires a recent compiler to be compiled (GCC >= 5.0 or Clang >= 3.8). Older compilers may work but they are neither supported nor tested.

To compile it:
make

mkdir build
cd build
cmake ..
make


You will end up with an executable named `gmsh_tools` and some meshes in `/meshes`.


# Exemple
There is an exemple in main.cc
# Example
There is an example in main.cc

gmsh_tools ./meshes/<meshes>

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions gmshData.cpp → src/gmshData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#include <utility>
#include <vector>

#include "gmshData.hpp"
#include "gmshElement.hpp"
#include "gmshMesh.hpp"
#include "gmsh_tools/gmshData.hpp"
#include "gmsh_tools/gmshElement.hpp"
#include "gmsh_tools/gmshMesh.hpp"

namespace gmsh {

Expand Down
4 changes: 2 additions & 2 deletions gmshElement.cpp → src/gmshElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* cite it.
*/

#include "gmshElement.hpp"
#include "gmshMesh.hpp"
#include "gmsh_tools/gmshElement.hpp"
#include "gmsh_tools/gmshMesh.hpp"
#include <assert.h>
#include <fstream>
#include <iostream>
Expand Down
4 changes: 2 additions & 2 deletions gmshMesh.cpp → src/gmshMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* cite it.
*/

#include "gmshMesh.hpp"
#include "gmshElement.hpp"
#include "gmsh_tools/gmshMesh.hpp"
#include "gmsh_tools/gmshElement.hpp"
#include <assert.h>
#include <fstream>
#include <iostream>
Expand Down
6 changes: 3 additions & 3 deletions main.cc → src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include<iostream>
#include<string>
#include <math.h>
#include "gmshMesh.hpp"
#include "gmshData.hpp"
#include "gmshElement.hpp"
#include "gmsh_tools/gmshMesh.hpp"
#include "gmsh_tools/gmshData.hpp"
#include "gmsh_tools/gmshElement.hpp"

using namespace std;

Expand Down