Skip to content

Commit

Permalink
Fix Win10/MSVC2015 build issues
Browse files Browse the repository at this point in the history
- tests & utils need PTEX_STATIC to be defined or we get link errors on static functions
- disabled some warnings (recommending those be fixed in the code)
  • Loading branch information
manuelkNVDA committed Feb 19, 2016
1 parent daff903 commit 46912a1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ if (NOT WIN32)
set(CMAKE_CXX_FLAGS "-std=c++98 -Wall -Wextra -pedantic")
endif ()

if(MSVC)
add_definitions(

#warning C4800: 'BOOL': forcing value to bool 'true' or 'false' (performance warning)
/wd4800

#warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
/wd4244

/D_CRT_SECURE_NO_WARNINGS
)
endif()

if (${PRMAN_15_COMPATIBLE_PTEX})
add_definitions(-DPTEX_NO_LARGE_METADATA_BLOCKS)
endif ()
Expand Down
2 changes: 2 additions & 0 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
add_definitions(-DPTEX_STATIC)

add_executable(wtest wtest.cpp)
target_link_libraries(wtest Ptex_dynamic)

Expand Down
2 changes: 1 addition & 1 deletion src/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ execute_process(COMMAND git describe ${PTEX_SHA}
OUTPUT_STRIP_TRAILING_WHITESPACE)

add_executable(ptxinfo ptxinfo.cpp)
add_definitions(-DPTEX_VER="${PTEX_VER} \(${PTEX_SHA}\)")
add_definitions(-DPTEX_VER="${PTEX_VER} \(${PTEX_SHA}\)" -DPTEX_STATIC)
target_link_libraries(ptxinfo Ptex_dynamic)

install(TARGETS ptxinfo DESTINATION ${CMAKE_INSTALL_BINDIR})

0 comments on commit 46912a1

Please sign in to comment.