-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to fix travis mac build findlibuv
- Loading branch information
1 parent
5fb676e
commit 539fbed
Showing
2 changed files
with
69 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,71 @@ | ||
#============================================================================= | ||
# Copyright 2016 The Luvit Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
# Locate libuv library | ||
# This module defines | ||
# LIBUV_FOUND, if false, do not try to link to libuv | ||
# LIBUV_LIBRARIES | ||
# LIBUV_INCLUDE_DIR, where to find uv.h | ||
find_library(LibUV_LIBRARY | ||
NAMES uv | ||
) | ||
mark_as_advanced(LibUV_LIBRARY) | ||
|
||
find_path( | ||
LIBUV_INCLUDE_DIR | ||
NAMES uv.h | ||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" | ||
PATH_SUFFIXES "include" | ||
NO_DEFAULT_PATH | ||
) | ||
find_path(LibUV_INCLUDE_DIR | ||
NAMES uv.h | ||
) | ||
mark_as_advanced(LibUV_INCLUDE_DIR) | ||
|
||
find_path(LIBUV_INCLUDE_DIR NAMES uv.h) | ||
|
||
find_library( | ||
LIBUV_LIBRARIES | ||
NAMES libuv.a uv libuv | ||
PATHS "${XMRIG_DEPS}" ENV "XMRIG_DEPS" | ||
PATH_SUFFIXES "lib" | ||
NO_DEFAULT_PATH | ||
) | ||
|
||
find_library(LIBUV_LIBRARIES NAMES libuv.a uv libuv) | ||
|
||
|
||
if(WIN32) | ||
list(APPEND LIBUV_LIBRARIES iphlpapi) | ||
list(APPEND LIBUV_LIBRARIES psapi) | ||
list(APPEND LIBUV_LIBRARIES userenv) | ||
list(APPEND LIBUV_LIBRARIES ws2_32) | ||
#----------------------------------------------------------------------------- | ||
# Extract version number if possible. | ||
set(_LibUV_H_REGEX "#[ \t]*define[ \t]+UV_VERSION_(MAJOR|MINOR|PATCH)[ \t]+[0-9]+") | ||
if(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv-version.h") | ||
file(STRINGS "${LibUV_INCLUDE_DIR}/uv-version.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") | ||
elseif(LibUV_INCLUDE_DIR AND EXISTS "${LibUV_INCLUDE_DIR}/uv.h") | ||
file(STRINGS "${LibUV_INCLUDE_DIR}/uv.h" _LibUV_H REGEX "${_LibUV_H_REGEX}") | ||
else() | ||
set(_LibUV_H "") | ||
endif() | ||
foreach(c MAJOR MINOR PATCH) | ||
if(_LibUV_H MATCHES "#[ \t]*define[ \t]+UV_VERSION_${c}[ \t]+([0-9]+)") | ||
set(_LibUV_VERSION_${c} "${CMAKE_MATCH_1}") | ||
else() | ||
unset(_LibUV_VERSION_${c}) | ||
endif() | ||
endforeach() | ||
if(DEFINED _LibUV_VERSION_MAJOR AND DEFINED _LibUV_VERSION_MINOR) | ||
set(LibUV_VERSION_MAJOR "${_LibUV_VERSION_MAJOR}") | ||
set(LibUV_VERSION_MINOR "${_LibUV_VERSION_MINOR}") | ||
set(LibUV_VERSION "${LibUV_VERSION_MAJOR}.${LibUV_VERSION_MINOR}") | ||
if(DEFINED _LibUV_VERSION_PATCH) | ||
set(LibUV_VERSION_PATCH "${_LibUV_VERSION_PATCH}") | ||
set(LibUV_VERSION "${LibUV_VERSION}.${LibUV_VERSION_PATCH}") | ||
else() | ||
unset(LibUV_VERSION_PATCH) | ||
endif() | ||
else() | ||
set(LibUV_VERSION_MAJOR "") | ||
set(LibUV_VERSION_MINOR "") | ||
set(LibUV_VERSION_PATCH "") | ||
set(LibUV_VERSION "") | ||
endif() | ||
unset(_LibUV_VERSION_MAJOR) | ||
unset(_LibUV_VERSION_MINOR) | ||
unset(_LibUV_VERSION_PATCH) | ||
unset(_LibUV_H_REGEX) | ||
unset(_LibUV_H) | ||
|
||
#----------------------------------------------------------------------------- | ||
include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUV | ||
FOUND_VAR LibUV_FOUND | ||
REQUIRED_VARS LibUV_LIBRARY LibUV_INCLUDE_DIR | ||
VERSION_VAR LibUV_VERSION | ||
) | ||
set(LIBUV_FOUND ${LibUV_FOUND}) | ||
|
||
INCLUDE(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUV DEFAULT_MSG LIBUV_LIBRARIES LIBUV_INCLUDE_DIR) | ||
#----------------------------------------------------------------------------- | ||
# Provide documented result variables and targets. | ||
if(LibUV_FOUND) | ||
set(LibUV_INCLUDE_DIRS ${LibUV_INCLUDE_DIR}) | ||
set(LibUV_LIBRARIES ${LibUV_LIBRARY}) | ||
if(NOT TARGET LibUV::LibUV) | ||
add_library(LibUV::LibUV UNKNOWN IMPORTED) | ||
set_target_properties(LibUV::LibUV PROPERTIES | ||
IMPORTED_LOCATION "${LibUV_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${LibUV_INCLUDE_DIRS}" | ||
) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters