-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
113 lines (95 loc) · 3.39 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
cmake_minimum_required(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/conf/cmake/")
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
project(fsmod VERSION 0.1 DESCRIPTION "SimGrid-based File System simulation module")
include(GNUInstallDirs)
find_package(SimGrid 3.35.1 REQUIRED)
include_directories(
${CMAKE_SOURCE_DIR}/include
${SimGrid_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/include
/opt/local/include
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# build the version number
set(FSMOD_VERSION_MAJOR "0")
set(FSMOD_VERSION_MINOR "1")
set(FSMOD_VERSION_PATCH "0")
set(FSMOD_VERSION_EXTRA "dev")
if (${FSMOD_VERSION_PATCH} EQUAL "0")
set(FSMOD_RELEASE_VERSION "${FSMOD_VERSION_MAJOR}.${FSMOD_VERSION_MINOR}")
else ()
set(FSMOD_RELEASE_VERSION "${FSMOD_VERSION_MAJOR}.${FSMOD_VERSION_MINOR}.${FSMOD_VERSION_PATCH}")
endif ()
set(SOURCE_FILES
src/PathUtil.cpp
src/FileSystem.cpp
src/File.cpp
src/FileMetadata.cpp
src/Partition.cpp
src/PartitionFIFOCaching.cpp
src/PartitionLRUCaching.cpp
src/Storage.cpp
src/JBODStorage.cpp
src/OneDiskStorage.cpp
src/OneRemoteDiskStorage.cpp
)
set(HEADER_FILES
include/fsmod/File.hpp
include/fsmod/FileStat.hpp
include/fsmod/FileSystemException.hpp
include/fsmod/Partition.hpp
include/fsmod/PartitionFIFOCaching.hpp
include/fsmod/PartitionLRUCaching.hpp
include/fsmod/FileMetadata.hpp
include/fsmod/JBODStorage.hpp
include/fsmod/PathUtil.hpp
include/fsmod/FileSystem.hpp
include/fsmod/OneDiskStorage.hpp
include/fsmod/OneRemoteDiskStorage.hpp
include/fsmod/Storage.hpp
)
add_library(fsmod SHARED ${SOURCE_FILES})
set_target_properties(fsmod PROPERTIES
SOVERSION 0.1
LINKER_LANGUAGE CXX
PUBLIC_HEADER "${HEADER_FILES}")
target_include_directories(fsmod PRIVATE include)
target_link_libraries(fsmod PUBLIC ${SimGrid_LIBRARY})
install(TARGETS fsmod
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fsmod)
install(FILES include/fsmod.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
add_custom_target(examples COMMENT "Recompiling the examples")
# Google test
find_library(GTEST_LIBRARY NAMES gtest)
if(GTEST_LIBRARY)
set(TEST_FILES
test/jbod_storage_test.cpp
test/one_disk_storage_test.cpp
test/one_remote_disk_storage_test.cpp
test/path_util_test.cpp
test/file_system_test.cpp
test/seek_test.cpp
test/truncate_test.cpp
test/caching_test.cpp
test/register_test.cpp
test/stat_test.cpp
test/main.cpp
test/test_util.hpp
include/fsmod.hpp src/Storage.cpp)
add_definitions(-DGTEST_USED)
add_executable(unit_tests EXCLUDE_FROM_ALL ${SOURCE_FILES} ${HEADER_FILES} ${TEST_FILES})
target_include_directories(unit_tests PRIVATE include)
target_link_libraries(unit_tests ${GTEST_LIBRARY} ${SIMGRID_LIBRARY} fsmod -lpthread -lm)
set_target_properties(unit_tests PROPERTIES COMPILE_FLAGS "-g -O0 --coverage")
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "--coverage")
#add_custom_command(TARGET unit_tests COMMAND find . -name *.gcda -delete)
else()
add_custom_target(unit_tests echo "ERROR: Cannot build unit_tests because Google Test (libgtest) was not found by cmake." COMMAND echo " If you have installed Google Test, re-run cmake." VERBATIM)
endif()
# Documentation
include(${CMAKE_HOME_DIRECTORY}/conf/cmake/Documentation.cmake)
# Examples
include(${CMAKE_HOME_DIRECTORY}/examples/Examples.cmake)