-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
101 lines (85 loc) · 3.33 KB
/
Copy pathCMakeLists.txt
File metadata and controls
101 lines (85 loc) · 3.33 KB
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
# =====================================================================
# DMOD Virtual File System
# =====================================================================
cmake_minimum_required(VERSION 3.10)
# ======================================================================
# DMOD VFS
# ======================================================================
project(dmvfs
VERSION 1.0
DESCRIPTION "DMOD Virtual File System"
LANGUAGES C CXX)
# ======================================================================
# Fetch DMOD repository
# ======================================================================
include(FetchContent)
# Only fetch and build dmod if it's not already available as a target
if(NOT TARGET dmod_inc)
FetchContent_Declare(
dmod
GIT_REPOSITORY https://github.com/choco-technologies/dmod.git
GIT_TAG develop
)
# ======================================================================
# DMOD Configuration
# ======================================================================
set(DMOD_MODE "DMOD_SYSTEM" CACHE STRING "DMOD build mode")
set(DMOD_BUILD_TESTS OFF CACHE BOOL "Build tests")
set(DMOD_BUILD_EXAMPLES OFF CACHE BOOL "Build examples")
set(DMOD_BUILD_TOOLS OFF CACHE BOOL "Build tools")
set(DMOD_BUILD_TEMPLATES OFF CACHE BOOL "Build templates")
set(DMOD_EXTERNAL_REGISTRATION ON CACHE BOOL "Use external registration")
# Pass coverage flags to DMOD if enabled
if(ENABLE_COVERAGE)
set(DMOD_ENABLE_COVERAGE ON CACHE BOOL "Enable DMOD coverage")
endif()
FetchContent_MakeAvailable(dmod)
set(DMOD_DIR ${dmod_SOURCE_DIR} CACHE PATH "DMOD source directory" FORCE)
else()
message(STATUS "dmod target already exists, skipping FetchContent")
endif()
# ======================================================================
# Fetch DMOD File System Interface
# ======================================================================
FetchContent_Declare(
dmfsi
GIT_REPOSITORY
https://github.com/choco-technologies/dmfsi.git
GIT_TAG master
)
# ======================================================================
# DMOD File System Interface Configuration
# ======================================================================
set(DMOD_DIR ${dmod_SOURCE_DIR})
FetchContent_MakeAvailable(dmfsi)
# ======================================================================
# DMOD VFS Library definition
# ======================================================================
add_library(dmvfs STATIC
src/dmvfs.c
src/dmod_sal.c
)
target_include_directories(dmvfs PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/inc>
)
target_link_libraries(dmvfs PUBLIC
dmod
dmfsi
)
if(DMVFS_BUILD_TESTS)
target_compile_definitions(dmvfs PUBLIC
DMVFS_DONT_IMPLEMENT_DMOD_SAL
)
endif()
# Define version string for the library
target_compile_definitions(dmvfs PRIVATE
DMVFS_VERSION="${PROJECT_VERSION}"
)
# ======================================================================
# Tests
# ======================================================================
option(DMVFS_BUILD_TESTS "Build tests" OFF)
if(DMVFS_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()