[WebVR] Add OpenVR to the tree and to the build
[WebKit-https.git] / Source / ThirdParty / openvr / patches / cmake-build.patch
1 diff --git a/CMakeLists.txt b/CMakeLists.txt
2 index 94de3ce..6decedd 100644
3 --- a/CMakeLists.txt
4 +++ b/CMakeLists.txt
5 @@ -1,14 +1,8 @@
6  # Set the minimum required version of CMake for this project.
7  cmake_minimum_required(VERSION 2.8)
8  
9 -# Set project name.
10 -project(OpenVRSDK)
11 -
12  # Setup some options.
13  option(BUILD_SHARED "Builds the library as shared library" OFF)
14 -option(BUILD_FRAMEWORK "Builds the library as an apple Framework" OFF)
15 -option(BUILD_UNIVERSAL "Builds the shared or framework as a universal (fat, 32- & 64-bit) binary" ON)
16 -option(BUILD_OSX_I386 "Builds the shared or framework as a 32-bit binary, even on a 64-bit platform" OFF)
17  option(USE_LIBCXX "Uses libc++ instead of libstdc++" ON)
18  option(USE_CUSTOM_LIBCXX "Uses a custom libc++" OFF)
19  
20 @@ -37,21 +31,9 @@ elseif(APPLE)
21    if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*" OR CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*")
22      set(PLATFORM_NAME "osx")
23      add_definitions(-DOSX -DPOSIX)
24 -    if(BUILD_UNIVERSAL)
25 -      set(CMAKE_OSX_ARCHITECTURES "i386;x86_64")
26 -    endif()
27 -    if(BUILD_OSX_I386)
28 -      set(PROCESSOR_ARCH "32")
29 -      set(CMAKE_OSX_ARCHITECTURES "i386")
30 -    endif()
31    endif()
32  endif()
33  
34 -# Set output folder for static and shared libraries
35 -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
36 -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
37 -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH})
38 -
39  # Enable some properties.
40  if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
41         # Enable c++11 and hide symbols which shouldn't be visible
42 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
43 index 58954d6..8b537af 100644
44 --- a/src/CMakeLists.txt
45 +++ b/src/CMakeLists.txt
46 @@ -3,6 +3,9 @@ project(openvr_api)
47  
48  set( LIBNAME "openvr_api" )
49  
50 +set(EXCEPTION_FLAGS "-fexceptions")
51 +add_definitions(${EXCEPTION_FLAGS})
52 +
53  # Set some properies for specific files.
54  if(APPLE)
55    set(CMAKE_MACOSX_RPATH 1)
56 @@ -22,7 +25,7 @@ elseif(WIN32)
57  endif()
58  
59  # Add include folders.
60 -include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/headers ${CMAKE_SOURCE_DIR}/src/vrcommon)
61 +include_directories(${PROJECT_SOURCE_DIR}/../src ${PROJECT_SOURCE_DIR}/../headers ${PROJECT_SOURCE_DIR}/../src/vrcommon)
62  
63  if(USE_CUSTOM_LIBCXX)
64         link_directories(
65 @@ -65,22 +68,22 @@ elseif(BUILD_FRAMEWORK)
66         set( LIBNAME "OpenVR" )
67         add_library( ${LIBNAME} 
68              SHARED ${SOURCE_FILES}
69 -            ${CMAKE_SOURCE_DIR}/headers/openvr.h
70 -            ${CMAKE_SOURCE_DIR}/headers/openvr_api.cs
71 -            ${CMAKE_SOURCE_DIR}/headers/openvr_api.json
72 -            ${CMAKE_SOURCE_DIR}/headers/openvr_capi.h
73 -            ${CMAKE_SOURCE_DIR}/headers/openvr_driver.h
74 +            ${PROJECT_SOURCE_DIR}/../headers/openvr.h
75 +            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs
76 +            ${PROJECT_SOURCE_DIR}/../headers/openvr_api.json
77 +            ${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h
78 +            ${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h
79         )
80         set_target_properties(OpenVR PROPERTIES
81                FRAMEWORK TRUE
82                FRAMEWORK_VERSION A
83                MACOSX_FRAMEWORK_IDENTIFIER com.valvesoftware.OpenVR.framework
84 -              MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/Info.plist
85 +              MACOSX_FRAMEWORK_INFO_PLIST ${PROJECT_SOURCE_DIR}/../src/Info.plist
86                # "current version" in semantic format in Mach-O binary file
87                VERSION 1.0.6
88                # "compatibility version" in semantic format in Mach-O binary file
89                SOVERSION 1.0.0
90 -              PUBLIC_HEADER "${CMAKE_SOURCE_DIR}/headers/openvr.h;${CMAKE_SOURCE_DIR}/headers/openvr_api.cs;${CMAKE_SOURCE_DIR}/headers/openvr_api.json;${CMAKE_SOURCE_DIR}/headers/openvr_capi.h;${CMAKE_SOURCE_DIR}/headers/openvr_driver.h"
91 +              PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/../headers/openvr.h;${PROJECT_SOURCE_DIR}/../headers/openvr_api.cs;${PROJECT_SOURCE_DIR}/../headers/openvr_api.json;${PROJECT_SOURCE_DIR}/../headers/openvr_capi.h;${PROJECT_SOURCE_DIR}/../headers/openvr_driver.h"
92                LINKER_LANGUAGE CXX
93         )
94  else()