Skip to content

Commit

Permalink
Merge pull request #3611 from claudiofantacci/fix/windowsbuild
Browse files Browse the repository at this point in the history
CMake improvements for Windows build
  • Loading branch information
dorodnic authored Apr 29, 2019
2 parents 312a1e6 + 292fb8b commit d02697f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ lib/
ubuntu-xenial/
ubuntu-xenial-hwe/

# Docs
doc/doxygen/html/
*.html.lnk

# CMake
build/
build*/
connectivity_check

# XCode
Expand Down Expand Up @@ -83,4 +87,3 @@ librealsense-log.txt
*.json
*.ini
*.cxx

16 changes: 12 additions & 4 deletions CMake/windows_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ macro(os_set_flags)
# Makes VS15 find the DLL when trying to run examples/tests
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# build with multiple cores
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")

## Check for Windows Version ##
if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
message(STATUS "Build for Win7")
Expand All @@ -26,7 +24,17 @@ macro(os_set_flags)
set(BACKEND RS2_USE_WINUSB_UVC_BACKEND)
endif()

if (MSVC)
if(MSVC)
# Set CMAKE_DEBUG_POSTFIX to "d" to add a trailing "d" to library
# built in debug mode. In this Windows user can compile, build and install the
# library in both Release and Debug configuration avoiding naming clashes in the
# installation directories.
set(CMAKE_DEBUG_POSTFIX "d")

# build with multiple cores
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4819")
set(LRS_TRY_USE_AVX true)
add_definitions(-D_UNICODE)
Expand Down

0 comments on commit d02697f

Please sign in to comment.