mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
cmake: provide empty experimental.h for non-cmake users
Not everybody builds libgit2 using cmake; provide an `experimental.h` with no experiments configured for those that do not. To support this, we also now create compile definitions for experimental functionality, to supplant that empty `experimental.h`. cmake will continue to generate the proper `experimental.h` file for use with `make install`.
This commit is contained in:
@@ -1,8 +1,19 @@
|
||||
# Experimental feature support for libgit2 - developers can opt in to
|
||||
# experimental functionality, like sha256 support. When experimental
|
||||
# functionality is enabled, we set both a cmake flag *and* a compile
|
||||
# definition. The cmake flag is used to generate `experimental.h`,
|
||||
# which will be installed by a `make install`. But the compile definition
|
||||
# is used by the libgit2 sources to detect the functionality at library
|
||||
# build time. This allows us to have an in-tree `experimental.h` with
|
||||
# *no* experiments enabled. This lets us support users who build without
|
||||
# cmake and cannot generate the `experimental.h` file.
|
||||
|
||||
if(EXPERIMENTAL_SHA256)
|
||||
add_feature_info("SHA256 API" ON "experimental SHA256 APIs")
|
||||
|
||||
set(EXPERIMENTAL 1)
|
||||
set(GIT_EXPERIMENTAL_SHA256 1)
|
||||
add_compile_definitions(GIT_EXPERIMENTAL_SHA256)
|
||||
else()
|
||||
add_feature_info("SHA256 API" OFF "experimental SHA256 APIs")
|
||||
endif()
|
||||
|
||||
20
include/git2/experimental.h
Normal file
20
include/git2/experimental.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_experimental_h__
|
||||
#define INCLUDE_experimental_h__
|
||||
|
||||
/*
|
||||
* This file exists to support users who build libgit2 with a bespoke
|
||||
* build system and do not use our cmake configuration. Normally, cmake
|
||||
* will create `experimental.h` from the `experimental.h.in` file and
|
||||
* will include the generated file instead of this one. For non-cmake
|
||||
* users, we bundle this `experimental.h` file which will be used
|
||||
* instead.
|
||||
*/
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Copyright (C) the libgit2 contributors. All rights reserved.
|
||||
*
|
||||
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
||||
* a Linking Exception. For full terms see the included COPYING file.
|
||||
*/
|
||||
|
||||
#ifndef INCLUDE_experimental_h__
|
||||
#define INCLUDE_experimental_h__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user