Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
139 lines (115 loc) · 5.07 KB
/
Copy pathCMakeLists.txt
File metadata and controls
139 lines (115 loc) · 5.07 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
cmake_minimum_required(VERSION 3.21...3.31)
project(qore-git-module VERSION 1.0.0)
include(CheckCXXCompilerFlag)
include(CheckCXXSymbolExists)
find_package(Qore 2.0 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBGIT2 REQUIRED libgit2)
set(CMAKE_THREAD_PREFER_PTHREAD ON)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(CMAKE_USE_PTHREADS_INIT)
message(STATUS "Found POSIX Threads: TRUE")
else()
message(STATUS "Found POSIX Threads: FALSE")
message(FATAL_ERROR "POSIX threads do not seem to be supported on this platform, aborting")
endif()
include_directories(${LIBGIT2_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_BINARY_DIR})
# Check for C++11.
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# Check for optional libgit2 API symbols
set(CMAKE_REQUIRED_INCLUDES ${LIBGIT2_INCLUDE_DIRS})
set(CMAKE_REQUIRED_LIBRARIES ${LIBGIT2_LDFLAGS})
check_cxx_symbol_exists(git_clone_options_init git2.h HAVE_GIT_CLONE_OPTIONS_INIT)
check_cxx_symbol_exists(git_diff_options_init git2.h HAVE_GIT_DIFF_OPTIONS_INIT)
check_cxx_symbol_exists(git_status_options_init git2.h HAVE_GIT_STATUS_OPTIONS_INIT)
check_cxx_symbol_exists(git_checkout_options_init git2.h HAVE_GIT_CHECKOUT_OPTIONS_INIT)
check_cxx_symbol_exists(git_merge_options_init git2.h HAVE_GIT_MERGE_OPTIONS_INIT)
check_cxx_symbol_exists(git_stash_save_with_opts git2.h HAVE_GIT_STASH_SAVE_WITH_OPTS)
check_cxx_symbol_exists(git_blame_file git2.h HAVE_GIT_BLAME_FILE)
check_cxx_symbol_exists(git_index_conflict_get git2.h HAVE_GIT_INDEX_CONFLICT_GET)
check_cxx_symbol_exists(git_credential_ssh_key_memory_new git2.h HAVE_GIT_CREDENTIAL_SSH_KEY_MEMORY_NEW)
check_cxx_symbol_exists(git_signature_default_from_env git2.h HAVE_GIT_SIGNATURE_DEFAULT_FROM_ENV)
check_cxx_symbol_exists(git_remote_connect_ext git2.h HAVE_GIT_REMOTE_CONNECT_EXT)
unset(CMAKE_REQUIRED_INCLUDES)
unset(CMAKE_REQUIRED_LIBRARIES)
check_cxx_compiler_flag(-fvisibility=hidden HAVE_GCC_VISIBILITY)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_definitions(-D_GNU_SOURCE)
endif()
configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.cmake
${CMAKE_BINARY_DIR}/config.h)
set(QPP_SRC
src/ql_git.qpp
src/QC_GitRepository.qpp
)
set(CPP_SRC
src/git-module.cpp
src/QoreGitRepository.cpp
src/QoreGitMemoryODB.cpp
src/QoreGitMemoryRefDB.cpp
)
qore_wrap_qpp_value(QPP_SOURCES DOXLIST _dox_src METALIST QPP_META_SRC ${QPP_SRC})
set(module_name "git")
set(QORE_DOX_TMPL_SRC
docs/mainpage.dox.tmpl
docs/getting-started.dox.tmpl
docs/cookbook.dox.tmpl
docs/release-notes.dox.tmpl
)
if (DEFINED ENV{DOXYGEN_EXECUTABLE})
set(DOXYGEN_EXECUTABLE $ENV{DOXYGEN_EXECUTABLE})
endif()
add_library(${module_name} MODULE ${CPP_SRC} ${QPP_SOURCES})
set(MODULE_DOX_INPUT
${CMAKE_BINARY_DIR}/mainpage.dox
${CMAKE_BINARY_DIR}/getting-started.dox
${CMAKE_BINARY_DIR}/cookbook.dox
${CMAKE_BINARY_DIR}/release-notes.dox
${_dox_src}
)
set(QORE_DOXYGEN_MODULES ConnectionProvider DataProvider)
set(QORE_DOXYGEN_IMAGES
"${CMAKE_SOURCE_DIR}/qlib/GitDataProvider/git-logo.svg"
)
qore_external_binary_module(${module_name} ${PROJECT_VERSION} ${LIBGIT2_LDFLAGS})
qore_external_user_module("qlib/GitDataProvider" "")
qore_external_user_module("qlib/GitConfigManager" "GitDataProvider")
qore_external_user_module("qlib/GitForgeHelper" "")
qore_external_user_module("qlib/GitConnections.qm" "")
# Reconcile the installed i18n catalog root against the fragments these modules
# currently own. Installing catalogs is otherwise additive: a fragment installed by
# an earlier generation of these sources survives every later install, is still
# discovered, and makes catalog composition fail as soon as the current generation
# describes the same app differently.
#
# This must come after every call above that installs catalogs, both because those
# calls record the fragment set and because install() rules run in declaration order,
# which is what publishes the manifest after the fragments it describes. Removals are
# scoped to this project, so fragments Qore and other products install into the same
# shared catalog root are untouched. Guarded because the helper arrived in Qore 2.3.
if (COMMAND qore_finalize_catalog_install)
qore_finalize_catalog_install()
endif()
qore_dist(${PROJECT_VERSION})
# install qpp metadata files
if (COMMAND qore_install_qpp_metadata)
qore_install_qpp_metadata(${module_name} ${QPP_META_SRC})
else()
install(FILES ${QPP_META_SRC}
DESTINATION ${CMAKE_INSTALL_DATADIR}/qore/metadata)
endif()
qore_config_info()
if (DOXYGEN_FOUND)
qore_wrap_dox(QORE_DOX_SRC ${QORE_DOX_TMPL_SRC})
add_custom_target(QORE_MOD_DOX_FILES DEPENDS ${QORE_DOX_SRC})
add_dependencies(docs-module QORE_MOD_DOX_FILES)
qore_binary_module_two_phase_docs(${module_name} "GitConfigManager;GitConnections;GitDataProvider;GitForgeHelper")
endif()