forked from BlazingDB/blazingdb-toolchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (58 loc) · 3.51 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
76
77
78
79
#=============================================================================
# Copyright 2019 BlazingDB, Inc.
# Copyright 2019 Percy Camilo Triveño Aucahuasi <[email protected]>
#=============================================================================
cmake_minimum_required(VERSION 3.11)
project(blazingsql-dependencies C CXX)
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
message(STATUS "CMAKE_MODULE_PATH:" "${CMAKE_MODULE_PATH}")
###################################################################################################
# - conda environment -----------------------------------------------------------------------------
if ("$ENV{CONDA_BUILD}" STREQUAL "1")
set(CMAKE_SYSTEM_PREFIX_PATH "$ENV{BUILD_PREFIX};$ENV{PREFIX};${CMAKE_SYSTEM_PREFIX_PATH}")
message(STATUS "Conda build detected, CMAKE_SYSTEM_PREFIX_PATH set to: ${CMAKE_SYSTEM_PREFIX_PATH}")
set(ENV{PKG_CONFIG_PATH} $ENV{BUILD_PREFIX}/lib/pkgconfig/) # used by find libcurl
set(ENV{LD_LIBRARY_PATH} $ENV{BUILD_PREFIX}/lib/) # to link the tests correctly against libcurl.so
find_library(CURL PATHS $ENV{BUILD_PREFIX}/lib/ NO_DEFAULT_PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{BUILD_PREFIX}/lib/cmake)
elseif (DEFINED ENV{CONDA_PREFIX})
set(CMAKE_SYSTEM_PREFIX_PATH "$ENV{CONDA_PREFIX};${CMAKE_SYSTEM_PREFIX_PATH}")
message(STATUS "Conda environment detected, CMAKE_SYSTEM_PREFIX_PATH set to: ${CMAKE_SYSTEM_PREFIX_PATH}")
set(ENV{PKG_CONFIG_PATH} $ENV{CONDA_PREFIX}/lib/pkgconfig/) # used by find libcurl
set(ENV{LD_LIBRARY_PATH} $ENV{CONDA_PREFIX}/lib/) # to link the tests correctly against libcurl.so
find_library(CURL PATHS $ENV{CONDA_PREFIX}/lib/ NO_DEFAULT_PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} $ENV{CONDA_PREFIX}/lib/cmake)
endif ()
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Parse the components version and download URLs
include(DefineVersions)
# Include CMake modules
include(FeatureSummary)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(CTest)
message(STATUS "BUILD_TARGET is ${BUILD_TARGET}")
if (BUILD_TARGET)
if (BUILD_TARGET STREQUAL "gcp-cpp")
include(ConfigureGoogleCloudCPP)
install(DIRECTORY ${GOOGLE_CLOUD_CPP_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/ConfigureGoogleCloudCPP.cmake DESTINATION lib/cmake)
elseif (BUILD_TARGET STREQUAL "aws-cpp")
include(ConfigureAWSSDK)
# NOTE use USE_SOURCE_PERMISSIONS to preserve executable file permisions (e.g. flatc, etc)
install(DIRECTORY ${AWS_SDK_CPP_ROOT} DESTINATION . USE_SOURCE_PERMISSIONS)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/ConfigureAWSSDK.cmake DESTINATION lib/cmake)
install(FILES ${CMAKE_SOURCE_DIR}/cmake/AWSSDKCPP.CMakeLists.txt.cmake DESTINATION lib/cmake)
# NOTE We need to override the aws-cpp-sdk-core-targets.cmake to discart the conda build paths and use conda prefix instead
install(FILES ${CMAKE_SOURCE_DIR}/patches/aws-sdk-cpp-patch/aws-cpp-sdk-core-targets.cmake DESTINATION lib/cmake/aws-cpp-sdk-core/)
else()
message(FATAL_ERROR "Error: Invalid value for BUILD_TARGET (${BUILD_TARGET}) You need to pass -DBUILD_TARGET=gcp-cpp or -DBUILD_TARGET=aws-cpp")
endif()
else()
message(FATAL_ERROR "Error: You need to pass -DBUILD_TARGET=gcp-cpp or -DBUILD_TARGET=aws-cpp")
endif()
# BEGIN MAIN #
# Print the project summary
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
# END MAIN #