svn merge -r40166:40279 ^/trunk/blender
[blender.git] / source / creator / CMakeLists.txt
index 355ddbf55cff29db7948cff86f3bd57c61e1e510..22fe0a1a1d1f2ab465675dba64a54caf71315518 100644 (file)
@@ -25,9 +25,6 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
-# So BUILDINFO and BLENDERPATH strings are automatically quoted
-cmake_policy(SET CMP0005 NEW)
-
 setup_libdirs()
 
 blender_include_dirs(
@@ -81,6 +78,10 @@ if(WITH_PYTHON)
        endif()
 endif()
 
+if(WITH_HEADLESS)
+       add_definitions(-DWITH_HEADLESS)
+endif()
+
 if(WITH_GAMEENGINE)
        blender_include_dirs(../gameengine/BlenderRoutines)
 
@@ -93,7 +94,7 @@ endif()
 
 if(WITH_BINRELOC)
        add_definitions(-DWITH_BINRELOC)
-       blender_include_dirs(${BINRELOC_INC})
+       blender_include_dirs(${BINRELOC_INCLUDE_DIRS})
 endif()
 
 # Setup the exe sources and buildinfo
@@ -132,6 +133,7 @@ if(WIN32 AND NOT UNIX)
 endif()
 
 if(WITH_BUILDINFO)
+       add_definitions(-DWITH_BUILDINFO)
        # --------------------------------------------------------------------------
        # These defines could all be moved into the header below
        string(REPLACE " " "\ " BUILDINFO_CFLAGS "${CMAKE_C_FLAGS}")
@@ -191,10 +193,10 @@ if(WITH_PYTHON_MODULE)
        set_target_properties(
                blender
                PROPERTIES
-                               PREFIX ""
-                               OUTPUT_NAME bpy
-                               LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/
-                               RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/  # only needed on windows
+                       PREFIX ""
+                       OUTPUT_NAME bpy
+                       LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
+                       RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin  # only needed on windows
        )
        
        if(WIN32)
@@ -227,7 +229,17 @@ else()
        set(TARGETDIR ${EXECUTABLE_OUTPUT_PATH})
 endif()
 
-# install target
+
+# -----------------------------------------------------------------------------
+# Install Targets
+
+set(BLENDER_TEXT_FILES
+       ${CMAKE_SOURCE_DIR}/release/text/GPL-license.txt
+       ${CMAKE_SOURCE_DIR}/release/text/Python-license.txt
+       ${CMAKE_SOURCE_DIR}/release/text/copyright.txt
+       ${CMAKE_SOURCE_DIR}/release/text/readme.html
+)
+
 if(UNIX AND NOT APPLE)
 
        if(WITH_INSTALL_PORTABLE)
@@ -257,9 +269,9 @@ if(UNIX AND NOT APPLE)
        if(WITH_INSTALL_PORTABLE)
                install(
                        FILES
-                       ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
-                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
-                       ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/blender.desktop
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/scalable/apps/blender.svg
+                               ${CMAKE_SOURCE_DIR}/doc/manpage/blender.1
                        DESTINATION ${TARGETDIR}
                )
 
@@ -270,25 +282,18 @@ if(UNIX AND NOT APPLE)
                )
 
                install(
-                       DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
+                       FILES ${BLENDER_TEXT_FILES}
                        DESTINATION ${TARGETDIR}
-                       PATTERN ".svn" EXCLUDE
                )
 
        else()
                # main blender binary
                if(WITH_PYTHON_MODULE)
-                       get_target_property(_module_name blender OUTPUT_NAME)
-                       if(NOT _module_suffix)
-                               set(_module_suffix "${SUFFIX}")
-                       endif()
-
                        install(
-                               PROGRAMS "${TARGETDIR}/${_module_name}.so"  # XXX, *nix only
+                               TARGETS blender
+                               LIBRARY
                                DESTINATION ${PYTHON_LIBPATH}/python${PYTHON_VERSION}/site-packages
                        )
-
-                       unset(_module_name)
                else()
                        install(
                                PROGRAMS ${TARGETDIR}/blender
@@ -311,13 +316,13 @@ if(UNIX AND NOT APPLE)
                )
                install(
                        DIRECTORY
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
-                                       ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
-                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/16x16
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/22x22
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/24x24
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/32x32
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/48x48
+                               ${CMAKE_SOURCE_DIR}/release/freedesktop/icons/256x256
+                       DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor
                        PATTERN ".svn" EXCLUDE
                        PATTERN "*.svg" EXCLUDE
                )
@@ -334,26 +339,25 @@ if(UNIX AND NOT APPLE)
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1
                )
                install(
-                       DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
+                       FILES ${BLENDER_TEXT_FILES}
                        DESTINATION ${CMAKE_INSTALL_PREFIX}/share/doc/blender
-                       PATTERN ".svn" EXCLUDE
                )
        endif()
 
        install(
                FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
-               DESTINATION ${TARGETDIR_VER}/config
+               DESTINATION ${TARGETDIR_VER}
        )
 
        if(WITH_INTERNATIONAL)
                install(
                        FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
-                       DESTINATION ${TARGETDIR_VER}/config
+                       DESTINATION ${TARGETDIR_VER}
                )
 
                install(
                        DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
-                       DESTINATION ${TARGETDIR_VER}/datafiles/
+                       DESTINATION ${TARGETDIR_VER}/datafiles
                        PATTERN ".svn" EXCLUDE
                )
        endif()
@@ -362,7 +366,7 @@ if(UNIX AND NOT APPLE)
                #
                # install(
                #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
-               #       DESTINATION ${TARGETDIR_VER}/
+               #       DESTINATION ${TARGETDIR_VER}
                #       PATTERN ".svn" EXCLUDE
                # )
 
@@ -370,7 +374,7 @@ if(UNIX AND NOT APPLE)
                # install(CODE "message(\"copying blender scripts...\")")
                install(
                        DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
-                       DESTINATION ${TARGETDIR_VER}/
+                       DESTINATION ${TARGETDIR_VER}
                        PATTERN ".svn" EXCLUDE
                        PATTERN "__pycache__" EXCLUDE
                )
@@ -381,9 +385,9 @@ if(UNIX AND NOT APPLE)
                        # install(CODE "message(\"copying a subset of the systems python...\")")
                        install(
                                DIRECTORY ${PYTHON_LIBPATH}/python${PYTHON_VERSION}
-                               DESTINATION ${TARGETDIR_VER}/python/lib/
+                               DESTINATION ${TARGETDIR_VER}/python/lib
                                PATTERN ".svn" EXCLUDE
-                               PATTERN "__pycache__" EXCLUDE               # ./distutils
+                               PATTERN "__pycache__" EXCLUDE               # * any cache *
                                PATTERN "distutils" EXCLUDE                 # ./distutils
                                PATTERN "lib2to3" EXCLUDE                   # ./lib2to3
                                PATTERN "config" EXCLUDE                    # ./config
@@ -391,8 +395,10 @@ if(UNIX AND NOT APPLE)
                                PATTERN "site-packages/*" EXCLUDE           # ./site-packages/*
                                PATTERN "tkinter" EXCLUDE                   # ./tkinter
                                PATTERN "lib-dynload/_tkinter.*" EXCLUDE    # ./lib-dynload/_tkinter.co
+                               PATTERN "idlelib" EXCLUDE                   # ./idlelib
                                PATTERN "test" EXCLUDE                      # ./test
                                PATTERN "turtledemo" EXCLUDE                # ./turtledemo
+                               PATTERN "turtle.py" EXCLUDE                                     # ./turtle.py
                        )
 
                        # # doesnt work, todo
@@ -409,42 +415,41 @@ elseif(WIN32)
        )
 
        install(  # same as linux!, deduplicate
-               DIRECTORY ${CMAKE_SOURCE_DIR}/release/text/
-               DESTINATION ${TARGETDIR}/
-               PATTERN ".svn" EXCLUDE
+               FILES ${BLENDER_TEXT_FILES}
+               DESTINATION ${TARGETDIR}
        )
 
        install(  # same as linux!, deduplicate
                FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
-               DESTINATION ${TARGETDIR_VER}/config
+               DESTINATION ${TARGETDIR_VER}
        )
 
        if(WITH_INTERNATIONAL) # same as linux!, deduplicate
                install(
                        FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.Blanguages
-                       DESTINATION ${TARGETDIR_VER}/config
+                       DESTINATION ${TARGETDIR_VER}
                )
                install(
                        DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
-                       DESTINATION ${TARGETDIR_VER}/datafiles/
+                       DESTINATION ${TARGETDIR_VER}/datafiles
                        PATTERN ".svn" EXCLUDE
                )
 
-               if(NOT CMAKE_CL_64)
-                       install(
-                               FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
-                               DESTINATION ${TARGETDIR}/
-                       )
+               install(
+                       FILES ${LIBDIR}/gettext/lib/gnu_gettext.dll
+                       DESTINATION ${TARGETDIR}
+               )
 
+               if(NOT CMAKE_CL_64)
                        install(
                                FILES ${LIBDIR}/iconv/lib/iconv.dll
-                               DESTINATION ${TARGETDIR}/
+                               DESTINATION ${TARGETDIR}
                        )
                endif()
        endif()
 
        install( # same as linux!, deduplicate
-               DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale/
+               DIRECTORY ${CMAKE_SOURCE_DIR}/release/bin/.blender/locale
                DESTINATION ${TARGETDIR_VER}/datafiles/locale
                PATTERN ".svn" EXCLUDE
        )
@@ -453,7 +458,7 @@ elseif(WIN32)
        #
        # install(
        #       DIRECTORY ${CMAKE_SOURCE_DIR}/release/plugins
-       #       DESTINATION ${TARGETDIR_VER}/
+       #       DESTINATION ${TARGETDIR_VER}
        #       PATTERN ".svn" EXCLUDE
        # )
 
@@ -461,19 +466,20 @@ elseif(WIN32)
                # install(CODE "message(\"copying blender scripts...\")")
                install(  # same as linux!, deduplicate
                        DIRECTORY ${CMAKE_SOURCE_DIR}/release/scripts
-                       DESTINATION ${TARGETDIR_VER}/
+                       DESTINATION ${TARGETDIR_VER}
                        PATTERN ".svn" EXCLUDE
                        PATTERN "__pycache__" EXCLUDE
                )
 
-               # TODO, multiple targets?
-               install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS Release)
-               install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS RelWithDebInfo)
-               install(FILES ${LIBDIR}/python/lib/python32.dll DESTINATION ${TARGETDIR}/ CONFIGURATIONS MinSizeRel)
+               install(
+                       FILES ${LIBDIR}/python/lib/python32.dll
+                       DESTINATION ${TARGETDIR}
+                       CONFIGURATIONS Release;RelWithDebInfo;MinSizeRel
+               )
 
                install(
                        FILES ${LIBDIR}/python/lib/python32_d.dll
-                       DESTINATION ${TARGETDIR}/
+                       DESTINATION ${TARGETDIR}
                        CONFIGURATIONS Debug
                )
 
@@ -485,8 +491,8 @@ elseif(WIN32)
                                CODE
                                "
                                message(\"creating ${TARGETDIR_VER}/python/lib\")
-                               file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python/\")
-                               file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python/lib/\")
+                               file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python\")
+                               file(MAKE_DIRECTORY \"${TARGETDIR_VER}/python/lib\")
                                message(\"done creating dir\")
                                "
                        )
@@ -494,34 +500,14 @@ elseif(WIN32)
                        install(
                                CODE
                                "
-                               execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
-                                       \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
-                               "
-                               CONFIGURATIONS Release
-                       )
-                       install(
-                               CODE
-                               "
-                               execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
-                                       \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
+                               if(\"\${CMAKE_INSTALL_CONFIG_NAME}\" STREQUAL \"Debug\")
+                                       execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
+                                               \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
+                               else()
+                                       execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib\"
+                                               \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
+                               endif()
                                "
-                               CONFIGURATIONS RelWithDebInfo
-                       )
-                       install(
-                               CODE
-                               "
-                               execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
-                                       \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
-                               "
-                               CONFIGURATIONS MinSizeRel
-                       )
-                       install(
-                               CODE
-                               "
-                               execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir \"${TARGETDIR_VER}/python/lib/\"
-                                       \"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32_d.tar.gz\")
-                               "
-                               CONFIGURATIONS Debug
                        )
 
                        # doesnt work, todo
@@ -533,80 +519,76 @@ elseif(WIN32)
                # gettext and png are statically linked on win64
                install(
                        FILES ${LIBDIR}/zlib/lib/zlib.dll
-                       DESTINATION ${TARGETDIR}/
+                       DESTINATION ${TARGETDIR}
                )
        else()
                install(
                        FILES
-                       ${LIBDIR}/png/lib/libpng.dll
-                       ${LIBDIR}/zlib/lib/zlib.dll
-                       DESTINATION ${TARGETDIR}/
+                               ${LIBDIR}/png/lib/libpng.dll
+                               ${LIBDIR}/zlib/lib/zlib.dll
+                       DESTINATION ${TARGETDIR}
                )
        endif()
 
        if(MSVC)
                install(
                        FILES ${LIBDIR}/pthreads/lib/pthreadVC2.dll
-                       DESTINATION ${TARGETDIR}/
+                       DESTINATION ${TARGETDIR}
                )
        else()
                install(
                        FILES ${LIBDIR}/pthreads/lib/pthreadGC2.dll
-                       DESTINATION ${TARGETDIR}/
+                       DESTINATION ${TARGETDIR}
                )
        endif()
 
        if(WITH_CODEC_FFMPEG)
                install(
                        FILES
-                       ${LIBDIR}/ffmpeg/lib/avcodec-52.dll
-                       ${LIBDIR}/ffmpeg/lib/avformat-52.dll
-                       ${LIBDIR}/ffmpeg/lib/avdevice-52.dll
-                       ${LIBDIR}/ffmpeg/lib/avutil-50.dll
-                       ${LIBDIR}/ffmpeg/lib/swscale-0.dll
-                       DESTINATION ${TARGETDIR}/
+                               ${LIBDIR}/ffmpeg/lib/avcodec-53.dll
+                               ${LIBDIR}/ffmpeg/lib/avformat-53.dll
+                               ${LIBDIR}/ffmpeg/lib/avdevice-53.dll
+                               ${LIBDIR}/ffmpeg/lib/avutil-51.dll
+                               ${LIBDIR}/ffmpeg/lib/swscale-2.dll
+                       DESTINATION ${TARGETDIR}
                )
 
        endif()
 
        if(WITH_CODEC_SNDFILE)
                install(
-                       FILES
-                       ${LIBDIR}/sndfile/lib/libsndfile-1.dll
-                       DESTINATION ${TARGETDIR}/
+                       FILES ${LIBDIR}/sndfile/lib/libsndfile-1.dll
+                       DESTINATION ${TARGETDIR}
                )
        endif()
 
        if(WITH_OPENAL)
                install(
                        FILES
-                       ${LIBDIR}/openal/lib/OpenAL32.dll
-                       ${LIBDIR}/openal/lib/wrap_oal.dll
-                       DESTINATION ${TARGETDIR}/
+                               ${LIBDIR}/openal/lib/OpenAL32.dll
+                               ${LIBDIR}/openal/lib/wrap_oal.dll
+                       DESTINATION ${TARGETDIR}
                )
        endif()
 
        if(WITH_SDL)
                if(NOT CMAKE_CL_64)
                        install(
-                               FILES
-                               ${LIBDIR}/sdl/lib/SDL.dll
-                               DESTINATION ${TARGETDIR}/
+                               FILES ${LIBDIR}/sdl/lib/SDL.dll
+                               DESTINATION ${TARGETDIR}
                        )
                endif()
        endif()
 
        if(NOT CMAKE_CL_64)
                install(
-                       FILES
-                       ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
-                       DESTINATION ${TARGETDIR}/
+                       FILES ${LIBDIR}/thumbhandler/lib/BlendThumb.dll
+                       DESTINATION ${TARGETDIR}
                )
        else()
                install(
-                       FILES
-                       ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
-                       DESTINATION ${TARGETDIR}/
+                       FILES ${LIBDIR}/thumbhandler/lib/BlendThumb64.dll
+                       DESTINATION ${TARGETDIR}
                )
        endif()
 
@@ -653,14 +635,14 @@ elseif(APPLE)
        endmacro()
 
        # install release and app files
-       install_dir(
-               ${CMAKE_SOURCE_DIR}/release/text/
-               \${TARGETDIR}
+       install(
+               FILES ${BLENDER_TEXT_FILES}
+               DESTINATION ${TARGETDIR}
        )
 
        install(
                FILES ${SOURCEDIR}/Contents/PkgInfo
-               DESTINATION ${TARGETDIR}/blender.app/Contents/
+               DESTINATION ${TARGETDIR}/blender.app/Contents
        )
 
        install_dir(
@@ -670,7 +652,7 @@ elseif(APPLE)
 
        install(
                FILES ${CMAKE_SOURCE_DIR}/release/bin/.blender/.bfont.ttf
-               DESTINATION ${TARGETDIR_VER}/datafiles
+               DESTINATION ${TARGETDIR_VER}
        )
 
        # localization
@@ -720,17 +702,26 @@ elseif(APPLE)
        endif()
 endif()
 
+unset(BLENDER_TEXT_FILES)
+
+
+# -----------------------------------------------------------------------------
+# Setup link libs
+
 add_dependencies(blender makesdna)
 
 get_property(BLENDER_LINK_LIBS GLOBAL PROPERTY BLENDER_LINK_LIBS)
 
-set(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
+set(BLENDER_LINK_LIBS
+       ${BLENDER_LINK_LIBS}
+       bf_windowmanager
+       bf_render
+)
 
 if(WITH_MOD_FLUID)
        list(APPEND BLENDER_LINK_LIBS bf_intern_elbeem)
 endif()
 
-
 #if(UNIX)
        # Sort libraries
        set(BLENDER_SORTED_LIBS
@@ -778,6 +769,7 @@ endif()
                bf_intern_opennl
                bf_python
                bf_python_ext
+               bf_python_mathutils
                bf_ikplugin
                bf_bmesh
                bf_modifiers
@@ -811,6 +803,7 @@ endif()
                extern_minilzo
                extern_lzma
                ge_logic_ketsji
+               extern_recastnavigation
                ge_phys_common
                ge_logic
                ge_rasterizer
@@ -818,7 +811,6 @@ endif()
                ge_logic_expressions
                ge_scenegraph
                ge_logic_network
-               bf_python # duplicate for BPY_driver_exec
                ge_logic_ngnetwork
                extern_bullet
                ge_logic_loopbacknetwork
@@ -875,6 +867,12 @@ endif()
                message(STATUS "Blender Skipping: (${REM_MSG})")
        endif()
        target_link_libraries(blender ${BLENDER_SORTED_LIBS})
+       
+       unset(SEARCHLIB)
+       unset(SORTLIB)
+       unset(REMLIB)
+       unset(REM_MSG)
+       
 #else()
 #      target_link_libraries(blender ${BLENDER_LINK_LIBS})
 #endif()