forked from bartvdbraak/blender
Cycles Standalone: Add initial support for compilation on Windows
This applies to an application comiling from the standalone Cycles repository only. There's still lack of proper install target, so currently pthreads library is to be copied next to cycles.exe manually.
This commit is contained in:
parent
9e2e408323
commit
9b8942ac71
@ -20,10 +20,8 @@ set(LIBRARIES
|
|||||||
cycles_subd
|
cycles_subd
|
||||||
cycles_util
|
cycles_util
|
||||||
${BOOST_LIBRARIES}
|
${BOOST_LIBRARIES}
|
||||||
${OPENEXR_LIBRARIES}
|
|
||||||
${BLENDER_GL_LIBRARIES}
|
${BLENDER_GL_LIBRARIES}
|
||||||
${CYCLES_APP_GLEW_LIBRARY}
|
${CYCLES_APP_GLEW_LIBRARY}
|
||||||
${OPENIMAGEIO_LIBRARIES}
|
|
||||||
${PNG_LIBRARIES}
|
${PNG_LIBRARIES}
|
||||||
${JPEG_LIBRARIES}
|
${JPEG_LIBRARIES}
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
@ -33,6 +31,27 @@ set(LIBRARIES
|
|||||||
extern_cuew
|
extern_cuew
|
||||||
)
|
)
|
||||||
|
|
||||||
|
macro(target_link_libraries_oiio target)
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_link_libraries(${target}
|
||||||
|
${OPENIMAGEIO_LIBRARIES}
|
||||||
|
${OPENEXR_LIBRARIES})
|
||||||
|
else()
|
||||||
|
# For MSVC we link to different libraries depending whether
|
||||||
|
# release or debug target is being built.
|
||||||
|
file_list_suffix(OPENIMAGEIO_LIBRARIES_DEBUG "${OPENIMAGEIO_LIBRARIES}" "_d")
|
||||||
|
file_list_suffix(OPENIMAGEIO_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
|
||||||
|
|
||||||
|
target_link_libraries_debug("${target}" "${OPENIMAGEIO_LIBRARIES_DEBUG}")
|
||||||
|
target_link_libraries_debug("${target}" "${OPENEXR_LIBRARIES_DEBUG}")
|
||||||
|
target_link_libraries_optimized("${target}" "${OPENIMAGEIO_LIBRARIES}")
|
||||||
|
target_link_libraries_optimized("${target}" "${OPENEXR_LIBRARIES}")
|
||||||
|
|
||||||
|
unset(OPENIMAGEIO_LIBRARIES_DEBUG)
|
||||||
|
unset(OPENIMAGEIO_LIBRARIES_DEBUG)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
if(NOT PUGIXML_LIBRARIES STREQUAL "")
|
if(NOT PUGIXML_LIBRARIES STREQUAL "")
|
||||||
list(APPEND LIBRARIES ${PUGIXML_LIBRARIES})
|
list(APPEND LIBRARIES ${PUGIXML_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
@ -78,6 +97,7 @@ if(WITH_CYCLES_STANDALONE)
|
|||||||
add_executable(cycles ${SRC})
|
add_executable(cycles ${SRC})
|
||||||
list(APPEND LIBRARIES ${PLATFORM_LINKLIBS})
|
list(APPEND LIBRARIES ${PLATFORM_LINKLIBS})
|
||||||
target_link_libraries(cycles ${LIBRARIES} ${CMAKE_DL_LIBS})
|
target_link_libraries(cycles ${LIBRARIES} ${CMAKE_DL_LIBS})
|
||||||
|
target_link_libraries_oiio(cycles)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
set_target_properties(cycles PROPERTIES INSTALL_RPATH $ORIGIN/lib)
|
set_target_properties(cycles PROPERTIES INSTALL_RPATH $ORIGIN/lib)
|
||||||
@ -91,10 +111,10 @@ if(WITH_CYCLES_NETWORK)
|
|||||||
)
|
)
|
||||||
add_executable(cycles_server ${SRC})
|
add_executable(cycles_server ${SRC})
|
||||||
target_link_libraries(cycles_server ${LIBRARIES} ${CMAKE_DL_LIBS})
|
target_link_libraries(cycles_server ${LIBRARIES} ${CMAKE_DL_LIBS})
|
||||||
|
target_link_libraries_oiio(cycles_server)
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
|
set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
|
||||||
endif()
|
endif()
|
||||||
unset(SRC)
|
unset(SRC)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
###########################################################################
|
||||||
|
# Precompiled libraries tips and hints, for find_package().
|
||||||
|
|
||||||
|
if(CYCLES_STANDALONE_REPOSITORY)
|
||||||
|
if(APPLE OR WIN32)
|
||||||
|
include(precompiled_libs)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
# GLUT
|
# GLUT
|
||||||
|
|
||||||
@ -42,13 +51,13 @@ endif()
|
|||||||
# source code. but which we need to take care of when building Cycles from a
|
# source code. but which we need to take care of when building Cycles from a
|
||||||
# standalone repository
|
# standalone repository
|
||||||
if(CYCLES_STANDALONE_REPOSITORY)
|
if(CYCLES_STANDALONE_REPOSITORY)
|
||||||
if(APPLE OR WIN32)
|
|
||||||
include(precompiled_libs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# PThreads
|
# PThreads
|
||||||
find_package(Threads REQUIRED)
|
# TODO(sergey): Bloody exception, handled in precompiled_libs.cmake.
|
||||||
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
if(NOT WIN32)
|
||||||
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
set(PTHREADS_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
endif()
|
||||||
|
|
||||||
####
|
####
|
||||||
# OpenGL
|
# OpenGL
|
||||||
@ -83,10 +92,12 @@ if(CYCLES_STANDALONE_REPOSITORY)
|
|||||||
if(WITH_CYCLES_NETWORK)
|
if(WITH_CYCLES_NETWORK)
|
||||||
list(APPEND __boost_packages serialization)
|
list(APPEND __boost_packages serialization)
|
||||||
endif()
|
endif()
|
||||||
if(WITH_CYCLES_OSL AND APPLE)
|
if(WITH_CYCLES_OSL)
|
||||||
# TODO(sergey): This is because of the way how our precompiled
|
# TODO(sergey): This is because of the way how our precompiled
|
||||||
# libraries works, could be different for someone's else libs..
|
# libraries works, could be different for someone's else libs..
|
||||||
list(APPEND __boost_packages wave)
|
if(APPLE OR MSVC)
|
||||||
|
list(APPEND __boost_packages wave)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
|
find_package(Boost 1.48 COMPONENTS ${__boost_packages} REQUIRED)
|
||||||
if(NOT Boost_FOUND)
|
if(NOT Boost_FOUND)
|
||||||
|
Loading…
Reference in New Issue
Block a user