Merge pull request #43 from feilen/master

Change compilation to closely match the official SDK
This commit is contained in:
Brad Davis 2015-01-15 22:37:46 -08:00
commit f37724a762
4 changed files with 20 additions and 15 deletions

View File

@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 2.8)
include(cmake/defaults.cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake )
# Official path is like so: ${CMAKE_BINARY_DIR}/Lib/(Platform)/(Buildconfig)/(Arch)/libovr.a
# First for the generic no-config case (e.g. with mingw)
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output )
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output )
@ -26,9 +28,12 @@ set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMakeTargets")
if(CMAKE_COMPILER_IS_GNUCXX)
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -fPIC")
endif()
# Use official default CFLAGS
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -msse2 -fno-strict-aliasing")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -msse2 -fno-strict-aliasing")
endif()
if(WIN32)
@ -39,7 +44,7 @@ endif()
# The primary SDK artifact, a static library for Oculus access
add_subdirectory(LibOVR)
set_target_properties(OculusVR PROPERTIES FOLDER "Oculus")
set_target_properties(ovr PROPERTIES FOLDER "Oculus")
###############################################################################
#
@ -54,10 +59,10 @@ if(OCULUS_BUILD_SAMPLES)
include_directories(3rdParty/TinyXml)
# Make sure to set up the OVR include paths
include_directories(${OculusVR_SOURCE_DIR}/Include)
include_directories(${OculusVR_SOURCE_DIR}/Src)
include_directories(${OculusVR_SOURCE_DIR}/Src/Kernel)
include_directories(${OculusVR_SOURCE_DIR}/Src/Util)
include_directories(${ovr_SOURCE_DIR}/Include)
include_directories(${ovr_SOURCE_DIR}/Src)
include_directories(${ovr_SOURCE_DIR}/Src/Kernel)
include_directories(${ovr_SOURCE_DIR}/Src/Util)
add_subdirectory (Samples/CommonSrc )
set_target_properties(CommonSrc PROPERTIES FOLDER "Samples")

View File

@ -1,4 +1,4 @@
project (OculusVR)
project (ovr)
include_directories(Include Src Src/Kernel Src/Util)
include_directories(../3rdParty/glext)
@ -66,10 +66,10 @@ else()
list(APPEND SOURCE_FILES ${UNIX_FILES})
# Extra libs
add_subdirectory(../3rdParty/EDID ${CMAKE_CURRENT_BINARY_DIR}/../3rdParty/EDID)
list(APPEND SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/EDID/edid.cpp)
# Used by the SDK to read the EDID of the monitors
list(APPEND EXTRA_LIBS edid rt)
list(APPEND EXTRA_LIBS rt)
# Used by the SDK to access the HID functions
list(APPEND EXTRA_LIBS udev)
@ -90,6 +90,6 @@ else()
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DOVR_BUILD_DEBUG")
add_library(OculusVR ${SOURCE_FILES} ${PLATFORM_SOURCE_FILES})
target_link_libraries(OculusVR ${EXTRA_LIBS})
add_library(ovr ${SOURCE_FILES} ${PLATFORM_SOURCE_FILES})
target_link_libraries(ovr ${EXTRA_LIBS})
set(OVR_LIBRARIES ${EXTRA_LIBS} CACHE STRING "Dependencies of OculusVR")

View File

@ -1,7 +1,7 @@
project(OculusRoomTiny)
file(GLOB SOURCE_FILES *.cpp *.h)
list(APPEND EXTRA_LIBS OculusVR)
list(APPEND EXTRA_LIBS ovr)
if (WIN32)
find_package( DirectX REQUIRED)

View File

@ -4,7 +4,7 @@ file(GLOB SOURCE_FILES *.cpp *.h)
file(GLOB_RECURSE ASSET_FILES Assets/Tuscany/*)
# All the Oculus VR functionality comes from this DLL
set(EXTRA_LIBS OculusVR)
set(EXTRA_LIBS ovr)
# While the samples use the C API, they also use the
# core SDK functionality quite a bit
list(APPEND EXTRA_LIBS ${OVR_LIBRARIES})