mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Move sha256.c to lib/
Precompiled headers don't work if we're not a pure C++ project.
This commit is contained in:
parent
3120558dd1
commit
cdbbac5b6d
@ -277,6 +277,7 @@ find_package(Lua REQUIRED)
|
|||||||
if(NOT USE_LUAJIT)
|
if(NOT USE_LUAJIT)
|
||||||
add_subdirectory(lib/bitop)
|
add_subdirectory(lib/bitop)
|
||||||
endif()
|
endif()
|
||||||
|
add_subdirectory(lib/sha256)
|
||||||
|
|
||||||
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
if(BUILD_UNITTESTS OR BUILD_BENCHMARKS)
|
||||||
add_subdirectory(lib/catch2)
|
add_subdirectory(lib/catch2)
|
||||||
|
14
lib/sha256/CMakeLists.txt
Normal file
14
lib/sha256/CMakeLists.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
project(sha256 C)
|
||||||
|
|
||||||
|
add_library(sha256 STATIC sha256.c)
|
||||||
|
|
||||||
|
target_include_directories(sha256 INTERFACE .)
|
||||||
|
|
||||||
|
INCLUDE(CheckIncludeFiles)
|
||||||
|
check_include_files(endian.h HAVE_ENDIAN_H)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/cmake_config.h"
|
||||||
|
)
|
||||||
|
target_include_directories(sha256 PRIVATE "${PROJECT_BINARY_DIR}")
|
5
lib/sha256/cmake_config.h.in
Normal file
5
lib/sha256/cmake_config.h.in
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// Filled in by the build system
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#cmakedefine HAVE_ENDIAN_H
|
@ -56,17 +56,13 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "util/sha256.h"
|
#include "sha256/sha256.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
|
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
|
||||||
#define __attribute__(a)
|
#define __attribute__(a)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* pull HAVE_ENDIAN_H from Minetest */
|
#include "cmake_config.h" /* HAVE_ENDIAN_H */
|
||||||
#include "config.h"
|
|
||||||
#if !HAVE_ENDIAN_H
|
|
||||||
#undef HAVE_ENDIAN_H
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** endian.h **/
|
/** endian.h **/
|
||||||
/*
|
/*
|
@ -565,6 +565,7 @@ if(BUILD_CLIENT)
|
|||||||
${GMP_LIBRARY}
|
${GMP_LIBRARY}
|
||||||
${JSON_LIBRARY}
|
${JSON_LIBRARY}
|
||||||
${LUA_BIT_LIBRARY}
|
${LUA_BIT_LIBRARY}
|
||||||
|
sha256
|
||||||
${FREETYPE_LIBRARY}
|
${FREETYPE_LIBRARY}
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
# on Android, Minetest depends on SDL2 directly
|
# on Android, Minetest depends on SDL2 directly
|
||||||
@ -637,6 +638,7 @@ if(BUILD_SERVER)
|
|||||||
${JSON_LIBRARY}
|
${JSON_LIBRARY}
|
||||||
${LUA_LIBRARY}
|
${LUA_LIBRARY}
|
||||||
${LUA_BIT_LIBRARY}
|
${LUA_BIT_LIBRARY}
|
||||||
|
sha256
|
||||||
${GMP_LIBRARY}
|
${GMP_LIBRARY}
|
||||||
${PLATFORM_LIBS}
|
${PLATFORM_LIBS}
|
||||||
)
|
)
|
||||||
|
@ -42,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "util/hex.h"
|
#include "util/hex.h"
|
||||||
#include "util/sha1.h"
|
#include "util/sha1.h"
|
||||||
#include "util/sha256.h"
|
#include <sha256/sha256.h>
|
||||||
#include "util/png.h"
|
#include "util/png.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ set(UTIL_SRCS
|
|||||||
${CMAKE_CURRENT_SOURCE_DIR}/quicktune.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/quicktune.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/serialize.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/serialize.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sha1.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/sha1.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/sha256.c
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/srp.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/srp.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/timetaker.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/timetaker.cpp
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#include <mini-gmp.h>
|
#include <mini-gmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util/sha256.h"
|
#include <sha256/sha256.h>
|
||||||
|
|
||||||
#include "srp.h"
|
#include "srp.h"
|
||||||
//#define CSRP_USE_SHA1
|
//#define CSRP_USE_SHA1
|
||||||
|
Loading…
Reference in New Issue
Block a user