-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
75 lines (63 loc) · 2.56 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.15)
project(SimpleFastFloatBenchmark VERSION 0.1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
include(FetchContent)
include(ExternalProject)
if (NOT CYGWIN)
set(ABSL_ENABLE_INSTALL ON)
set(ABSL_RUN_TEST OFF CACHE INTERNAL "")
set(ABSL_USE_GOOGLETEST_HEAD OFF CACHE INTERNAL "")
FetchContent_Declare(abseil
GIT_REPOSITORY https://github.com/abseil/abseil-cpp.git
GIT_TAG "d7aaad8")
FetchContent_GetProperties(abseil)
if(NOT abseil_POPULATED)
set(BUILD_TESTING OFF)
FetchContent_Populate(abseil)
add_subdirectory(${abseil_SOURCE_DIR} ${abseil_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${abseil_SOURCE_DIR}/absl/copts)
include(${abseil_SOURCE_DIR}/absl/copts/AbseilConfigureCopts.cmake)
endif()
endif()
FetchContent_Declare(fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
GIT_TAG origin/main
GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(fast_float)
FetchContent_Declare(doubleconversion
GIT_REPOSITORY https://github.com/google/double-conversion.git
GIT_TAG "v3.1.5")
FetchContent_GetProperties(doubleconversion)
FetchContent_MakeAvailable(doubleconversion)
option(SIMPLE_FASTFLOAT_BENCHMARK_USE_RYU "build Ryu (cause builds failures on many systems)" OFF)
if(SIMPLE_FASTFLOAT_BENCHMARK_USE_RYU)
# Not CMake; gotta struggle a bit
# Copying is a hack.
find_program(BAZEL bazel)
if(BAZEL)
set(ENABLE_RYU ON CACHE INTERNAL "")
ExternalProject_Add(ryu
GIT_REPOSITORY https://github.com/ulfjack/ryu
GIT_TAG 6f85836b6389dce334692829d818cdedb28bfa00
BUILD_IN_SOURCE 1
BUILD_ALWAYS 1
CONFIGURE_COMMAND ""
BUILD_COMMAND bazel build //ryu:ryu_parse --compilation_mode opt
COMMAND cp -f ryu/ryu_parse.h "${CMAKE_BINARY_DIR}"
COMMAND cp -f bazel-bin/ryu/libryu_parse.a "${CMAKE_BINARY_DIR}"
INSTALL_COMMAND "")
add_library(ryu_parse STATIC IMPORTED GLOBAL)
set_property(TARGET ryu_parse
PROPERTY IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/libryu_parse.a)
target_include_directories(ryu_parse PUBLIC
INTERFACE
${CMAKE_BINARY_DIR})
endif(BAZEL)
endif(SIMPLE_FASTFLOAT_BENCHMARK_USE_RYU)
add_subdirectory(benchmarks)