diff --git a/cmake/modules/FindFaceshift.cmake b/cmake/modules/FindFaceshift.cmake index 92eb5d5c0f..ccb457497b 100644 --- a/cmake/modules/FindFaceshift.cmake +++ b/cmake/modules/FindFaceshift.cmake @@ -23,16 +23,28 @@ else (FACESHIFT_LIBRARIES AND FACESHIFT_INCLUDE_DIRS) elseif (UNIX) find_library(FACESHIFT_LIBRARIES libfaceshift.a ${FACESHIFT_ROOT_DIR}/lib/UNIX/) elseif (WIN32) - find_library(FACESHIFT_LIBRARIES faceshift.lib ${FACESHIFT_ROOT_DIR}/lib/WIN32/) + # For windows, we're going to build the faceshift sources directly into the interface build + # and not link to a prebuilt library. This is because the VS2010 linker doesn't like cross-linking + # between release and debug libraries. If we change that in the future we can make win32 more + # like the other platforms + #find_library(FACESHIFT_LIBRARIES faceshift.lib ${FACESHIFT_ROOT_DIR}/lib/WIN32/) endif () - if (FACESHIFT_INCLUDE_DIRS AND FACESHIFT_LIBRARIES) - set(FACESHIFT_FOUND TRUE) - endif (FACESHIFT_INCLUDE_DIRS AND FACESHIFT_LIBRARIES) - + if (WIN32) + # Windows only cares about the headers + if (FACESHIFT_INCLUDE_DIRS) + set(FACESHIFT_FOUND TRUE) + endif (FACESHIFT_INCLUDE_DIRS AND FACESHIFT_LIBRARIES) + else (WIN32) + # Mac and Unix requires libraries + if (FACESHIFT_INCLUDE_DIRS AND FACESHIFT_LIBRARIES) + set(FACESHIFT_FOUND TRUE) + endif (FACESHIFT_INCLUDE_DIRS AND FACESHIFT_LIBRARIES) + endif (WIN32) + if (FACESHIFT_FOUND) if (NOT FACESHIFT_FIND_QUIETLY) - message(STATUS "Found Faceshift: ${FACESHIFT_LIBRARIES}") + message(STATUS "Found Faceshift... ${FACESHIFT_LIBRARIES}") endif (NOT FACESHIFT_FIND_QUIETLY) else (FACESHIFT_FOUND) if (FACESHIFT_FIND_REQUIRED) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index ac0a13ff8f..a39283774a 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -22,8 +22,6 @@ else () set(BUILD_SEQ "0") endif () -#set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} $ENV{QT_CMAKE_PREFIX_PATH} ) - if (APPLE) set(GL_HEADERS "#include \n#include ") endif (APPLE) @@ -34,20 +32,25 @@ if (UNIX AND NOT APPLE) endif (UNIX AND NOT APPLE) if (WIN32) - #MESSAGE(${CMAKE_PREFIX_PATH}) - #set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A") - MESSAGE("interface cmake") - MESSAGE(${CMAKE_PREFIX_PATH}) - add_definitions( -D_USE_MATH_DEFINES -DWINDOWS_LEAN_AND_MEAN ) # apparently needed to get M_PI and other defines from cmath/math.h + add_definitions( -D_USE_MATH_DEFINES ) # apparently needed to get M_PI and other defines from cmath/math.h + add_definitions( -DWINDOWS_LEAN_AND_MEAN ) # needed to make sure windows doesn't go to crazy with its defines + # windows build needs an external glut, we're using freeglut set(GLUT_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/freeglut) - set(PTHREADS_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/pthreads) set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${GLUT_ROOT_PATH}) - #set(GL_HEADERS "#define GLEW_STATIC\n#define FREEGLUT_STATIC\n#define FREEGLUT_LIB_PRAGMAS 0\n#include \n#include \n#include \n#include ") + # windows build needs glew (opengl extention wrangler) this will handle providing access to OpenGL methods after 1.1 + # which are not accessible on windows without glew or some other dynamic linking mechanism + set(GLEW_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/glew) + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${GLEW_ROOT_PATH}) + include_directories(SYSTEM ${GLEW_ROOT_PATH}/include) - set(GL_HEADERS "#include \n#include ") + # windows still using pthreads, TODO: switch to QThreads + set(PTHREADS_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/external/pthreads) + + #set(GL_HEADERS "#define GLEW_STATIC\n#define FREEGLUT_STATIC\n#define FREEGLUT_LIB_PRAGMAS 0\n#include \n#include \n#include \n#include ") + set(GL_HEADERS "#define GLEW_STATIC\n#include \n#include \n#include ") include_directories(SYSTEM ${PTHREADS_ROOT_PATH}/include) endif (WIN32) @@ -67,6 +70,16 @@ foreach(SUBDIR avatar devices renderer ui starfield) set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) endforeach(SUBDIR) +#windows also includes the faceshift externals, because using a lib doesn't work due to debug/release mismatch +if (WIN32) + set(EXTERNAL_SOURCE_SUBDIRS "faceshift") +endif (WIN32) +foreach(EXTERNAL_SOURCE_SUBDIR ${EXTERNAL_SOURCE_SUBDIRS}) + file(GLOB_RECURSE SUBDIR_SRCS external/${EXTERNAL_SOURCE_SUBDIR}/src/*.cpp external/${EXTERNAL_SOURCE_SUBDIR}/src/*.c external/${EXTERNAL_SOURCE_SUBDIR}/src/*.h) + set(INTERFACE_SRCS ${INTERFACE_SRCS} ${SUBDIR_SRCS}) +endforeach(SUBDIR) + + find_package(Qt5Core REQUIRED) find_package(Qt5Gui REQUIRED) find_package(Qt5Multimedia REQUIRED) @@ -241,10 +254,9 @@ if (WIN32) target_link_libraries( ${TARGET_NAME} ${OPENCV_LIBRARIES} - ${FACESHIFT_LIBRARIES} + #${FACESHIFT_LIBRARIES} - # this was from the first verion of the attempt to port to windows, it may or may not be correct, temporarily disabled - #${CMAKE_CURRENT_SOURCE_DIR}/external/glut/Release/glew32.lib + ${CMAKE_CURRENT_SOURCE_DIR}/external/glew/lib/Release/Win32/glew32s.lib ${GLUT_ROOT_PATH}/lib/freeglut.lib # note: the pthreads stuff was in the /external/glut before, that's not right, I moved it to it's own location diff --git a/interface/external/faceshift/lib/WIN32/faceshift.lib b/interface/external/faceshift/lib/WIN32/faceshift.lib deleted file mode 100644 index 14fea97753..0000000000 Binary files a/interface/external/faceshift/lib/WIN32/faceshift.lib and /dev/null differ