mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-23 04:43:57 +01:00
[WIP] add working test
This commit is contained in:
parent
5b93f55c65
commit
f997265be3
@ -1,5 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
# =========== SETUP THE PROJECT =============
|
||||||
|
|
||||||
project(Trexio
|
project(Trexio
|
||||||
VERSION 2.0.0
|
VERSION 2.0.0
|
||||||
DESCRIPTION "TREX I/O library"
|
DESCRIPTION "TREX I/O library"
|
||||||
@ -9,10 +11,12 @@ project(Trexio
|
|||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# ============= CONFIGURE HDF5 ==============
|
||||||
|
|
||||||
option(ENABLE_HDF5 "Enable HDF5 support" ON)
|
option(ENABLE_HDF5 "Enable HDF5 support" ON)
|
||||||
|
|
||||||
if(ENABLE_HDF5)
|
if(ENABLE_HDF5)
|
||||||
find_package(HDF5 REQUIRED)
|
find_package(HDF5 REQUIRED COMPONENTS C HL)
|
||||||
if(HDF5_FOUND)
|
if(HDF5_FOUND)
|
||||||
message(STATUS "HDF5 version :: ${HDF5_VERSION}")
|
message(STATUS "HDF5 version :: ${HDF5_VERSION}")
|
||||||
message(STATUS "HDF5 include dir :: ${HDF5_INCLUDE_DIRS}")
|
message(STATUS "HDF5 include dir :: ${HDF5_INCLUDE_DIRS}")
|
||||||
@ -23,6 +27,8 @@ if(ENABLE_HDF5)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ========= DEFINE TREXIO C LIBRARY =========
|
||||||
|
|
||||||
#IF DO_SHARED
|
#IF DO_SHARED
|
||||||
add_library(trexio SHARED
|
add_library(trexio SHARED
|
||||||
src/trexio.c
|
src/trexio.c
|
||||||
@ -38,16 +44,27 @@ set_target_properties(trexio PROPERTIES
|
|||||||
PUBLIC_HEADER include/trexio.h
|
PUBLIC_HEADER include/trexio.h
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(trexio PRIVATE
|
target_include_directories(trexio PRIVATE src)
|
||||||
include
|
|
||||||
src
|
include_directories(include)
|
||||||
)
|
|
||||||
|
|
||||||
if(ENABLE_HDF5)
|
if(ENABLE_HDF5)
|
||||||
target_include_directories(trexio PRIVATE ${HDF5_C_INCLUDE_DIRS})
|
target_include_directories(trexio PRIVATE ${HDF5_C_INCLUDE_DIRS})
|
||||||
target_link_libraries(trexio PRIVATE ${HDF5_C_LIBRARIES})
|
target_link_libraries(trexio PRIVATE ${HDF5_C_HL_LIBRARIES} ${HDF5_C_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# ================= TESTING =================
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
add_executable(io_all tests/io_all.c)
|
||||||
|
target_link_libraries(io_all PRIVATE trexio)
|
||||||
|
add_test(
|
||||||
|
NAME io_all
|
||||||
|
COMMAND $<TARGET_FILE:io_all>
|
||||||
|
)
|
||||||
|
|
||||||
|
# ============= INSTALL TREXIO ==============
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
install(TARGETS trexio
|
install(TARGETS trexio
|
||||||
@ -55,4 +72,5 @@ install(TARGETS trexio
|
|||||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# ===========================================
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user