Skip to content

Commit

Permalink
[PrematureStopping] Add CMake support to search or install RxCpp.
Browse files Browse the repository at this point in the history
  • Loading branch information
geektoni authored and vigsterkr committed Jul 12, 2017
1 parent f027fb3 commit f7fe02f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cmake/Findrxcpp.cmake
@@ -0,0 +1,30 @@
# Copyright Gonzalo Brito Gadeschi 2015
# Copyright Kirk Shoop 2016
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#
# Find the rxcpp include directory
# The following variables are set if rxcpp is found.
# rxcpp_FOUND - True when the rxcpp include directory is found.
# rxcpp_INCLUDE_DIR - The path to where the meta include files are.
# If rxcpp is not found, rxcpp_FOUND is set to false.

# https://github.com/gnzlbg/ndtree/blob/master/cmake/Findrange-v3.cmake

find_package(PkgConfig)

if(NOT EXISTS "${rxcpp_INCLUDE_DIR}")
find_path(rxcpp_INCLUDE_DIR
NAMES rxcpp/rx.hpp
DOC "rxcpp library header files"
)
endif()

include(FindPackageHandleStandardArgs)
mark_as_advanced(rxcpp_INCLUDE_DIR)

if(EXISTS "${rxcpp_INCLUDE_DIR}")
set(rxcpp_FOUND 1)
else()
set(rxcpp_FOUND 0)
endif()
23 changes: 23 additions & 0 deletions cmake/external/rxcpp.cmake
@@ -0,0 +1,23 @@
GetCompilers()

include(ExternalProject)
ExternalProject_Add(
rxcpp
PREFIX ${CMAKE_BINARY_DIR}/rxcpp
DOWNLOAD_DIR ${THIRD_PARTY_DIR}/rxcpp
URL https://github.com/Reactive-Extensions/RxCpp/archive/v4.0.0.tar.gz
URL_MD5 feb89934f465bb5ac513c9adce8d3b1b
CMAKE_ARGS
-DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo
-DCMAKE_INSTALL_PREFIX:STRING=${CMAKE_BINARY_DIR}/src/shogun/lib/external
-DCMAKE_C_COMPILER:STRING=${C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CXX_COMPILER}
BUILD_COMMAND ""
)

add_dependencies(libshogun rxcpp)

set(rxcpp_INCLUDE_DIR ${THIRD_PARTY_INCLUDE_DIR})

UNSET(C_COMPILER)
UNSET(CXX_COMPILER)
11 changes: 11 additions & 0 deletions src/shogun/CMakeLists.txt
Expand Up @@ -273,6 +273,17 @@ SET_LINALG_BACKEND(LINALG_EIGENSOLVER_LIB EIGSLV)

####### /LINALG

FIND_PACKAGE(rxcpp)
IF(NOT rxcpp_FOUND)
include(external/rxcpp)
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM
$<BUILD_INTERFACE:${rxcpp_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include/shogun/lib/external/rxcpp>
)
ELSE()
SHOGUN_INCLUDE_DIRS(SCOPE PUBLIC SYSTEM ${rxcpp_INCLUDE_DIR})
ENDIF()

#### LAPACK
include(ShogunFindLAPACK)

Expand Down

0 comments on commit f7fe02f

Please sign in to comment.