Skip to content

Commit

Permalink
Changed the way to handle helpers:
Browse files Browse the repository at this point in the history
the helpers includes are installed to the includes directory as before
the helpers source code is sent to a dedicated helpers directory that is pointed by the $libMeshb_HELPERS_DIRS variable
  • Loading branch information
LoicMarechal committed Nov 29, 2024
1 parent 77dcc05 commit 43ad1f5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# GLOBAL CONFIGURATION VARIABLES
################################

cmake_minimum_required (VERSION 3.7.2)
cmake_minimum_required (VERSION 3.10)
set (libMeshb_VERSION_MAJOR 7)
set (libMeshb_VERSION_MINOR 80)
project(libMeshb VERSION ${libMeshb_VERSION_MAJOR}.${libMeshb_VERSION_MINOR} LANGUAGES C)
Expand Down Expand Up @@ -94,6 +94,7 @@ file(WRITE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
"include(\${CMAKE_CURRENT_LIST_DIR}/meshb-target.cmake)
include(\${CMAKE_CURRENT_LIST_DIR}/libMeshb-target.cmake)
set(libMeshb_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include)
set(libMeshb_HELPERS_DIRS ${CMAKE_INSTALL_PREFIX}/helpers)
set(libMeshb_LINK_DIRS ${CMAKE_INSTALL_PREFIX}/lib)
set(libMeshb_LIBRARIES Meshb.7 ${AIO_LIBRARIES})
set(libMeshb_Fortran_LIBRARIES Meshbf.7 ${AIO_LIBRARIES})
Expand Down
9 changes: 6 additions & 3 deletions sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ else()
add_library(Meshb.7 libmeshb7.c ../utilities/libmeshb7_helpers.c)
endif()

install (FILES libmeshb7.h libmeshb7.ins ../utilities/libmeshb7_helpers.h DESTINATION include COMPONENT headers)
install (FILES libmeshb7.h libmeshb7.ins DESTINATION include COMPONENT headers)

target_include_directories(
Meshb.7 PUBLIC $<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/sources>)

install (TARGETS Meshb.7 EXPORT meshb-target DESTINATION lib COMPONENT libraries)

install (EXPORT meshb-target NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/${PROJECT_NAME})

install (TARGETS Meshb.7 EXPORT libMeshb-target DESTINATION lib COMPONENT libraries)

install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ DESTINATION include)

install (EXPORT libMeshb-target DESTINATION lib/cmake/${PROJECT_NAME})
export (PACKAGE libMeshb)


export (PACKAGE libMeshb)
3 changes: 3 additions & 0 deletions utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ install (TARGETS speed_test DESTINATION bin COMPONENT applications)
add_executable(ugrid2mesh ugrid2mesh.c)
target_link_libraries (ugrid2mesh Meshb.7 ${AIO_LIBRARIES})
install (TARGETS ugrid2mesh DESTINATION bin COMPONENT applications)

install (FILES libmeshb7_helpers.c DESTINATION helpers COMPONENT sources)
install (FILES libmeshb7_helpers.h DESTINATION include COMPONENT headers)
23 changes: 15 additions & 8 deletions utilities/libmeshb7_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
/* */
/*----------------------------------------------------------------------------*/


/*----------------------------------------------------------------------------*/
/* Includes */
/*----------------------------------------------------------------------------*/

#include "libmeshb7_helpers.h"
#include "libmeshb7.h"
#include <stdio.h>
#include <stdlib.h>
#include "libmeshb7_helpers.h"
#include "libmeshb7.h"


/*----------------------------------------------------------------------------*/
/* Defines */
Expand All @@ -38,6 +40,7 @@
#define fpn double
#endif


/*----------------------------------------------------------------------------*/
/* Defintion of macro commands */
/*----------------------------------------------------------------------------*/
Expand All @@ -46,6 +49,7 @@
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define POW(a) ((a) * (a))


/*----------------------------------------------------------------------------*/
/* Allocate a structure to hold all polygons and polyhedra related data */
/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -138,6 +142,7 @@ PolMshSct *GmfAllocatePolyhedralStructure(int64_t MshIdx)
return (pol);
}


/*----------------------------------------------------------------------------*/
/* Free all polyhedral tables and the head structure itself */
/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -168,6 +173,7 @@ void GmfFreePolyghedralStructure(PolMshSct *pol)
free(pol);
}


/*----------------------------------------------------------------------------*/
/* Read the surface polygons from an already opened mesh file */
/* and store the data in the provided polyhedral structure */
Expand Down Expand Up @@ -197,6 +203,7 @@ int GmfReadBoundaryPolygons(PolMshSct *pol)
return (1);
}


/*----------------------------------------------------------------------------*/
/* Read the polyhedra from an already opened mesh file */
/* and store the data in the provided polyhedral structure */
Expand All @@ -206,7 +213,8 @@ int GmfReadPolyhedra(PolMshSct *pol)
{
int ret;

if (!pol || !pol->InrHdrTab || !pol->InrVerTab || !pol->VolHdrTab || !pol->VolFacTab)
if (!pol || !pol->InrHdrTab || !pol->InrVerTab
|| !pol->VolHdrTab || !pol->VolFacTab)
{
return (0);
}
Expand Down Expand Up @@ -242,6 +250,7 @@ int GmfReadPolyhedra(PolMshSct *pol)
return (1);
}


/*----------------------------------------------------------------------------*/
/* Copy one surface polygon list of vertices in the table and return its size */
/*----------------------------------------------------------------------------*/
Expand All @@ -268,6 +277,7 @@ itg GmfGetBoundaryPolygon(PolMshSct *pol, itg EleIdx, itg *UsrTab)
return (EndIdx - BegIdx + 1);
}


/*----------------------------------------------------------------------------*/
/* Copy one inner polygon list of vertices in the table and return its size */
/*----------------------------------------------------------------------------*/
Expand Down Expand Up @@ -304,6 +314,7 @@ itg GmfGetInnerPolygon(PolMshSct *pol, itg EleIdx, itg *UsrTab)
return (EndIdx - BegIdx + 1);
}


/*----------------------------------------------------------------------------*/
/* Copy one polyhedra list of polygonal faces in the table and return its size*/
/*----------------------------------------------------------------------------*/
Expand All @@ -330,6 +341,7 @@ itg GmfGetPolyhedron(PolMshSct *pol, itg EleIdx, itg *UsrTab)
return (EndIdx - BegIdx + 1);
}


/*----------------------------------------------------------------------------*/
/* Create the tessellation in triangles of a polygon */
/* Output: number of triangles, list of trangles and visibility of egdes */
Expand Down Expand Up @@ -370,11 +382,6 @@ itg GmfTesselatePolygon(PolMshSct *pol, itg EleIdx, itg (*Tri)[3], itg (*VisEdg)
VisEdg[NmbTri - 1][1] = 1;
VisEdg[NmbTri - 1][2] = 0;

// for (i = 0; i < NmbTri; i++) {
// printf("GmfTesselatePolygon: Tri[%d] %d %d %d \n", i, Tri[i][0], Tri[i][1], Tri[i][2]);
// printf("GmfTesselatePolygon: VisEdg[%d] %d %d %d \n", i, VisEdg[i][0], VisEdg[i][1], VisEdg[i][2]);
// }

return NmbTri;
}

Expand Down

0 comments on commit 43ad1f5

Please sign in to comment.