Unreviewed, silence -Wimplicit-fallthrough in openvr
[WebKit-https.git] / Source / ThirdParty / openvr / src / CMakeLists.txt
1 set(OPENVR_SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/openvr)
2
3 set( LIBNAME "openvr_api" )
4
5 set(EXCEPTION_FLAGS "-fexceptions")
6 add_definitions(${EXCEPTION_FLAGS})
7
8 # Set some properies for specific files.
9 if(APPLE)
10   set(CMAKE_MACOSX_RPATH 1)
11   if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
12     set_source_files_properties(vrcommon/pathtools_public.cpp vrcommon/vrpathregistry_public.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++")
13   endif()
14   if(BUILD_SHARED OR BUILD_FRAMEWORK)
15     find_library(FOUNDATION_FRAMEWORK Foundation)
16     mark_as_advanced(FOUNDATION_FRAMEWORK)
17     set(EXTRA_LIBS ${EXTRA_LIBS} ${FOUNDATION_FRAMEWORK})
18   endif(BUILD_SHARED OR BUILD_FRAMEWORK)
19 elseif(WIN32)
20   if(CMAKE_SIZEOF_VOID_P EQUAL 8)
21     add_definitions( -DWIN64 )
22     set( LIBNAME "openvr_api64" )
23   endif()
24 endif()
25
26 # Add include folders.
27 include_directories(${OPENVR_SOURCE_DIR}/src ${OPENVR_SOURCE_DIR}/headers ${OPENVR_SOURCE_DIR}/src/vrcommon)
28
29 if(USE_CUSTOM_LIBCXX)
30        link_directories(
31               ${LIBCXX_LIB_DIR}
32        )
33 endif()
34
35 # Set the source group and files.
36 set(CORE_FILES
37        openvr_api_public.cpp
38        jsoncpp.cpp
39 )
40 set(VRCOMMON_FILES
41        vrcommon/dirtools_public.cpp
42        vrcommon/envvartools_public.cpp
43        vrcommon/pathtools_public.cpp
44        vrcommon/sharedlibtools_public.cpp
45        vrcommon/hmderrors_public.cpp
46        vrcommon/vrpathregistry_public.cpp
47        vrcommon/strtools_public.cpp
48 )
49
50 set(SOURCE_FILES
51        ${CORE_FILES}
52        ${VRCOMMON_FILES}
53 )
54
55 source_group("Src" FILES
56        ${CORE_FILES}
57 )
58
59 source_group("VRCommon" FILES
60        ${VRCOMMON_FILES}
61 )
62
63 # Build the library.
64 if(BUILD_SHARED)
65        add_library(${LIBNAME} SHARED ${SOURCE_FILES})
66 elseif(BUILD_FRAMEWORK)
67        set( LIBNAME "OpenVR" )
68        add_library( ${LIBNAME} 
69             SHARED ${SOURCE_FILES}
70             ${OPENVR_SOURCE_DIR}/headers/openvr.h
71             ${OPENVR_SOURCE_DIR}/headers/openvr_api.cs
72             ${OPENVR_SOURCE_DIR}/headers/openvr_api.json
73             ${OPENVR_SOURCE_DIR}/headers/openvr_capi.h
74             ${OPENVR_SOURCE_DIR}/headers/openvr_driver.h
75        )
76        set_target_properties(OpenVR PROPERTIES
77               FRAMEWORK TRUE
78               FRAMEWORK_VERSION A
79               MACOSX_FRAMEWORK_IDENTIFIER com.valvesoftware.OpenVR.framework
80               MACOSX_FRAMEWORK_INFO_PLIST ${OPENVR_SOURCE_DIR}/src/Info.plist
81               # "current version" in semantic format in Mach-O binary file
82               VERSION 1.0.6
83               # "compatibility version" in semantic format in Mach-O binary file
84               SOVERSION 1.0.0
85               PUBLIC_HEADER "${OPENVR_SOURCE_DIR}/headers/openvr.h;${OPENVR_SOURCE_DIR}/headers/openvr_api.cs;${OPENVR_SOURCE_DIR}/headers/openvr_api.json;${OPENVR_SOURCE_DIR}/headers/openvr_capi.h;${OPENVR_SOURCE_DIR}/headers/openvr_driver.h"
86               LINKER_LANGUAGE CXX
87        )
88 else()
89        add_library(${LIBNAME} STATIC ${SOURCE_FILES})
90 endif()
91
92 if (COMPILER_IS_GCC_OR_CLANG)
93     WEBKIT_ADD_TARGET_CXX_FLAGS(${LIBNAME} -Wno-implicit-fallthrough
94                                            -Wno-unknown-pragmas
95                                            -Wno-unused-parameter
96                                            -Wno-unused-variable)
97 endif()
98
99 if(USE_CUSTOM_LIBCXX)
100        set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi)
101 endif()
102
103 target_link_libraries(${LIBNAME} ${EXTRA_LIBS})
104
105 install(TARGETS ${LIBNAME} DESTINATION lib)