# This file is part of t8code.
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element types in parallel.
#
# Copyright (C) 2025 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# t8code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Define own library for mesh handle.
if ( T8CODE_BUILD_AS_SHARED_LIBRARY )
add_library( T8_MESH_HANDLE SHARED )
set_target_properties( T8_MESH_HANDLE PROPERTIES POSITION_INDEPENDENT_CODE ON )
else()
add_library( T8_MESH_HANDLE STATIC )
endif()
add_library( T8CODE::T8_MESH_HANDLE ALIAS T8_MESH_HANDLE )
set_target_properties(T8_MESH_HANDLE PROPERTIES OUTPUT_NAME mesh_handle)
target_include_directories( T8_MESH_HANDLE PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/..>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/mesh_handle>
)
target_sources(T8_MESH_HANDLE PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/mesh.cxx)
install( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.hxx"
)
target_link_libraries(T8_MESH_HANDLE PUBLIC T8)
install( TARGETS T8_MESH_HANDLE
EXPORT ${PROJECT_NAME}-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if( T8CODE_EXPORT_COMPILE_COMMANDS )
set_target_properties( T8_MESH_HANDLE PROPERTIES EXPORT_COMPILE_COMMANDS ON )
endif( T8CODE_EXPORT_COMPILE_COMMANDS )