forked from adawarp/libpsvr
-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
44 lines (37 loc) · 1.71 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
cmake_minimum_required(VERSION 3.2)
project(libpsvr VERSION 0.1.0)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CMakeUtils.txt)
include(ExternalProject)
set(ROOT_DIR ${CMAKE_CURRENT_LIST_DIR})
set(CMAKE_CXX_STANDARD_17)
set(CMAKE_CXX_STANDARD_REQUIRED_ON)
IF (NOT MSVC)
set(CMAKE_CXX_FLAGS "-std=c++11")
IF (NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
ENDIF()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch")
ENDIF()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Configure and build external libusb projects based on os architecture
if (${CMAKE_C_SIZEOF_DATA_PTR} EQUAL 8)
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
download_external_dependency(libusb ${ROOT_DIR}/deps https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z)
set(LIBUSB_REQ_LIB ${ROOT_DIR}/deps/libusb/src/libusb/MS64/dll/libusb-1.0.lib)
set(LIBUSB_INCL_DIRS ${ROOT_DIR}/deps/libusb/src/libusb/include/libusb-1.0)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# TODO
# download_external_dependency(libusb ${ROOT_DIR}/deps https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2)
else()
build_external_dependecy(libusb
${ROOT_DIR}/deps
https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.tar.bz2
${CMAKE_CURRENT_SOURCE_DIR}/deps/libusb/src/libusb/configure
make -j 2
)
# Set include and library location from compiled libusb
set(LIBUSB_REQ_LIB ${ROOT_DIR}/deps/libusb/src/libusb-build/libusb/.libs/libusb-1.0.so)
set(LIBUSB_INCL_DIRS ${ROOT_DIR}/deps/libusb/src/libusb/libusb)
endif()
endif()
add_subdirectory(src)