Page MenuHomePhabricator

Add cmake build for the crypto library
ClosedPublic

Authored by deadalnix on Dec 10 2017, 20:19.

Details

Summary

As per title

Test Plan
mkdir build && cd build
cmake -GNinja ..
ninja

Check that the library builds. Also repeat for windows builds.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

schancel requested changes to this revision.Dec 12 2017, 01:44

Complaining about a few uses of constexpr:

ccache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++  -DHAVE_CONFIG_H -I../src/crypto/.. -Isrc/crypto/.. -Isrc/crypto/../config -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -MD -MT src/crypto/CMakeFiles/crypto.dir/chacha20.cpp.o -MF src/crypto/CMakeFiles/crypto.dir/chacha20.cpp.o.d -o src/crypto/CMakeFiles/crypto.dir/chacha20.cpp.o -c ../src/crypto/chacha20.cpp
../src/crypto/chacha20.cpp:13:1: error: unknown type name 'constexpr'

Investigating

This revision now requires changes to proceed.Dec 12 2017, 01:44

Compiler needs -std=c++11 flag added.

The following fixes the build: (from https://cmake.org/Wiki/CMake/Tutorials/C%2B%2B11Flags)

Not sure if there is some better place to add this though that would be global.

diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt
index 00b42ec40..baa72f954 100644
--- a/src/crypto/CMakeLists.txt
+++ b/src/crypto/CMakeLists.txt
@@ -1,5 +1,11 @@
 # Copyright (c) 2017 The Bitcoin developers

+cmake_minimum_required(VERSION 2.6)
+
+if(UNIX)
+    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+endif()
+
 include_directories(
        ..
        # To access the config.

Excplicitely specify C++11

This revision is now accepted and ready to land.Dec 12 2017, 03:35

This revision has passed testing.

This revision has passed testing.

This revision was automatically updated to reflect the committed changes.