2012-05-27 13:22:43 +00:00
|
|
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# The Original Code is: all of this file.
|
|
|
|
#
|
|
|
|
# Contributor(s): Jacques Beaurain.
|
|
|
|
#
|
|
|
|
# ***** END GPL LICENSE BLOCK *****
|
2011-06-19 06:57:56 +00:00
|
|
|
|
2012-07-16 08:26:42 +00:00
|
|
|
macro(list_insert_after
|
|
|
|
list_id item_check item_add
|
|
|
|
)
|
|
|
|
set(_index)
|
2012-09-13 01:52:58 +00:00
|
|
|
list(FIND "${list_id}" "${item_check}" _index)
|
|
|
|
if("${_index}" MATCHES "-1")
|
|
|
|
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
|
|
|
|
endif()
|
2012-07-16 08:26:42 +00:00
|
|
|
math(EXPR _index "${_index} + 1")
|
|
|
|
list(INSERT ${list_id} "${_index}" ${item_add})
|
|
|
|
unset(_index)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(list_insert_before
|
|
|
|
list_id item_check item_add
|
|
|
|
)
|
|
|
|
set(_index)
|
2012-09-13 01:52:58 +00:00
|
|
|
list(FIND "${list_id}" "${item_check}" _index)
|
|
|
|
if("${_index}" MATCHES "-1")
|
|
|
|
message(FATAL_ERROR "'${list_id}' doesn't contain '${item_check}'")
|
|
|
|
endif()
|
2012-07-16 08:26:42 +00:00
|
|
|
list(INSERT ${list_id} "${_index}" ${item_add})
|
|
|
|
unset(_index)
|
|
|
|
endmacro()
|
|
|
|
|
2011-06-19 06:57:56 +00:00
|
|
|
# foo_bar.spam --> foo_barMySuffix.spam
|
|
|
|
macro(file_suffix
|
|
|
|
file_name_new file_name file_suffix
|
|
|
|
)
|
|
|
|
|
|
|
|
get_filename_component(_file_name_PATH ${file_name} PATH)
|
|
|
|
get_filename_component(_file_name_NAME_WE ${file_name} NAME_WE)
|
|
|
|
get_filename_component(_file_name_EXT ${file_name} EXT)
|
|
|
|
set(${file_name_new} "${_file_name_PATH}/${_file_name_NAME_WE}${file_suffix}${_file_name_EXT}")
|
|
|
|
|
|
|
|
unset(_file_name_PATH)
|
|
|
|
unset(_file_name_NAME_WE)
|
|
|
|
unset(_file_name_EXT)
|
|
|
|
endmacro()
|
|
|
|
|
2011-10-23 17:52:20 +00:00
|
|
|
# useful for adding debug suffix to library lists:
|
2011-06-19 06:57:56 +00:00
|
|
|
# /somepath/foo.lib --> /somepath/foo_d.lib
|
|
|
|
macro(file_list_suffix
|
|
|
|
fp_list_new fp_list fn_suffix
|
|
|
|
)
|
|
|
|
|
|
|
|
# incase of empty list
|
|
|
|
set(_fp)
|
|
|
|
set(_fp_suffixed)
|
|
|
|
|
|
|
|
set(fp_list_new)
|
|
|
|
|
|
|
|
foreach(_fp ${fp_list})
|
|
|
|
file_suffix(_fp_suffixed "${_fp}" "${fn_suffix}")
|
|
|
|
list(APPEND "${fp_list_new}" "${_fp_suffixed}")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
unset(_fp)
|
|
|
|
unset(_fp_suffixed)
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
2011-06-26 17:18:37 +00:00
|
|
|
|
|
|
|
macro(target_link_libraries_optimized TARGET LIBS)
|
|
|
|
foreach(_LIB ${LIBS})
|
|
|
|
target_link_libraries(${TARGET} optimized "${_LIB}")
|
|
|
|
endforeach()
|
|
|
|
unset(_LIB)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(target_link_libraries_debug TARGET LIBS)
|
|
|
|
foreach(_LIB ${LIBS})
|
|
|
|
target_link_libraries(${TARGET} debug "${_LIB}")
|
|
|
|
endforeach()
|
|
|
|
unset(_LIB)
|
|
|
|
endmacro()
|
|
|
|
|
2010-12-22 22:15:20 +00:00
|
|
|
# Nicer makefiles with -I/1/foo/ instead of -I/1/2/3/../../foo/
|
|
|
|
# use it instead of include_directories()
|
|
|
|
macro(blender_include_dirs
|
|
|
|
includes)
|
2011-06-11 06:00:28 +00:00
|
|
|
set(_ALL_INCS "")
|
|
|
|
foreach(_INC ${ARGV})
|
|
|
|
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
|
|
|
list(APPEND _ALL_INCS ${_ABS_INC})
|
2011-08-08 05:43:04 +00:00
|
|
|
# for checking for invalid includes, disable for regular use
|
|
|
|
##if(NOT EXISTS "${_ABS_INC}/")
|
|
|
|
## message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
|
|
|
|
##endif()
|
2010-12-22 22:15:20 +00:00
|
|
|
endforeach()
|
2011-06-11 06:00:28 +00:00
|
|
|
include_directories(${_ALL_INCS})
|
|
|
|
unset(_INC)
|
|
|
|
unset(_ABS_INC)
|
|
|
|
unset(_ALL_INCS)
|
2010-12-22 22:15:20 +00:00
|
|
|
endmacro()
|
2010-06-06 13:32:58 +00:00
|
|
|
|
2011-05-31 01:15:44 +00:00
|
|
|
macro(blender_include_dirs_sys
|
|
|
|
includes)
|
2011-06-11 06:00:28 +00:00
|
|
|
set(_ALL_INCS "")
|
|
|
|
foreach(_INC ${ARGV})
|
|
|
|
get_filename_component(_ABS_INC ${_INC} ABSOLUTE)
|
|
|
|
list(APPEND _ALL_INCS ${_ABS_INC})
|
2011-08-08 05:43:04 +00:00
|
|
|
##if(NOT EXISTS "${_ABS_INC}/")
|
|
|
|
## message(FATAL_ERROR "Include not found: ${_ABS_INC}/")
|
|
|
|
##endif()
|
2011-05-31 01:15:44 +00:00
|
|
|
endforeach()
|
2011-06-11 06:00:28 +00:00
|
|
|
include_directories(SYSTEM ${_ALL_INCS})
|
|
|
|
unset(_INC)
|
|
|
|
unset(_ABS_INC)
|
|
|
|
unset(_ALL_INCS)
|
2011-05-31 01:15:44 +00:00
|
|
|
endmacro()
|
2010-11-05 04:18:53 +00:00
|
|
|
|
2011-05-28 04:53:17 +00:00
|
|
|
macro(blender_source_group
|
|
|
|
sources)
|
2010-11-05 04:18:53 +00:00
|
|
|
|
|
|
|
# Group by location on disk
|
2010-12-08 08:43:06 +00:00
|
|
|
source_group("Source Files" FILES CMakeLists.txt)
|
2011-05-28 04:53:17 +00:00
|
|
|
|
2011-06-11 06:00:28 +00:00
|
|
|
foreach(_SRC ${sources})
|
|
|
|
get_filename_component(_SRC_EXT ${_SRC} EXT)
|
2013-02-26 23:08:42 +00:00
|
|
|
if((${_SRC_EXT} MATCHES ".h") OR
|
|
|
|
(${_SRC_EXT} MATCHES ".hpp") OR
|
|
|
|
(${_SRC_EXT} MATCHES ".hh"))
|
2011-06-11 06:00:28 +00:00
|
|
|
source_group("Header Files" FILES ${_SRC})
|
2010-12-08 08:43:06 +00:00
|
|
|
else()
|
2011-06-11 06:00:28 +00:00
|
|
|
source_group("Source Files" FILES ${_SRC})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2011-06-11 06:00:28 +00:00
|
|
|
|
|
|
|
unset(_SRC)
|
|
|
|
unset(_SRC_EXT)
|
2010-12-08 08:43:06 +00:00
|
|
|
endmacro()
|
2010-11-05 04:18:53 +00:00
|
|
|
|
2011-05-28 04:53:17 +00:00
|
|
|
|
|
|
|
# only MSVC uses SOURCE_GROUP
|
|
|
|
macro(blender_add_lib_nolist
|
|
|
|
name
|
|
|
|
sources
|
2011-05-31 01:15:44 +00:00
|
|
|
includes
|
|
|
|
includes_sys)
|
2011-05-28 04:53:17 +00:00
|
|
|
|
|
|
|
# message(STATUS "Configuring library ${name}")
|
|
|
|
|
|
|
|
# include_directories(${includes})
|
2011-05-31 01:15:44 +00:00
|
|
|
# include_directories(SYSTEM ${includes_sys})
|
2011-05-28 04:53:17 +00:00
|
|
|
blender_include_dirs("${includes}")
|
2011-05-31 01:15:44 +00:00
|
|
|
blender_include_dirs_sys("${includes_sys}")
|
2011-05-28 04:53:17 +00:00
|
|
|
|
|
|
|
add_library(${name} ${sources})
|
|
|
|
|
|
|
|
# works fine without having the includes
|
|
|
|
# listed is helpful for IDE's (QtCreator/MSVC)
|
|
|
|
blender_source_group("${sources}")
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
2010-11-05 04:18:53 +00:00
|
|
|
|
2010-12-22 23:09:30 +00:00
|
|
|
macro(blender_add_lib
|
2010-06-06 13:32:58 +00:00
|
|
|
name
|
|
|
|
sources
|
2011-05-31 01:15:44 +00:00
|
|
|
includes
|
|
|
|
includes_sys)
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2011-05-31 01:15:44 +00:00
|
|
|
blender_add_lib_nolist(${name} "${sources}" "${includes}" "${includes_sys}")
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
set_property(GLOBAL APPEND PROPERTY BLENDER_LINK_LIBS ${name})
|
|
|
|
endmacro()
|
2006-11-17 02:27:12 +00:00
|
|
|
|
2011-05-28 04:53:17 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
macro(SETUP_LIBDIRS)
|
|
|
|
link_directories(${JPEG_LIBPATH} ${PNG_LIBPATH} ${ZLIB_LIBPATH} ${FREETYPE_LIBPATH})
|
|
|
|
|
2011-03-24 00:14:49 +00:00
|
|
|
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
2010-12-08 08:43:06 +00:00
|
|
|
link_directories(${PYTHON_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_SDL)
|
|
|
|
link_directories(${SDL_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_CODEC_FFMPEG)
|
|
|
|
link_directories(${FFMPEG_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_IMAGE_OPENEXR)
|
|
|
|
link_directories(${OPENEXR_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_IMAGE_TIFF)
|
|
|
|
link_directories(${TIFF_LIBPATH})
|
|
|
|
endif()
|
2011-11-07 15:44:09 +00:00
|
|
|
if(WITH_BOOST)
|
|
|
|
link_directories(${BOOST_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_OPENIMAGEIO)
|
|
|
|
link_directories(${OPENIMAGEIO_LIBPATH})
|
|
|
|
endif()
|
2012-09-15 10:03:17 +00:00
|
|
|
if(WITH_OPENCOLORIO)
|
|
|
|
link_directories(${OPENCOLORIO_LIBPATH})
|
|
|
|
endif()
|
2012-06-23 14:23:44 +00:00
|
|
|
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
|
2011-02-15 19:04:51 +00:00
|
|
|
link_directories(${OPENJPEG_LIBPATH})
|
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_CODEC_QUICKTIME)
|
|
|
|
link_directories(${QUICKTIME_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_OPENAL)
|
|
|
|
link_directories(${OPENAL_LIBPATH})
|
|
|
|
endif()
|
2013-03-27 07:19:54 +00:00
|
|
|
if(WITH_JACK AND NOT WITH_JACK_DYNLOAD)
|
2010-12-08 08:43:06 +00:00
|
|
|
link_directories(${JACK_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_CODEC_SNDFILE)
|
|
|
|
link_directories(${SNDFILE_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_FFTW3)
|
|
|
|
link_directories(${FFTW3_LIBPATH})
|
|
|
|
endif()
|
|
|
|
if(WITH_OPENCOLLADA)
|
|
|
|
link_directories(${OPENCOLLADA_LIBPATH})
|
|
|
|
link_directories(${PCRE_LIBPATH})
|
|
|
|
link_directories(${EXPAT_LIBPATH})
|
|
|
|
endif()
|
2012-10-06 11:00:45 +00:00
|
|
|
if(WITH_LLVM)
|
|
|
|
link_directories(${LLVM_LIB_DIR})
|
|
|
|
endif()
|
2011-05-12 11:16:32 +00:00
|
|
|
if(WITH_MEM_JEMALLOC)
|
|
|
|
link_directories(${JEMALLOC_LIBPATH})
|
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
|
|
|
|
if(WIN32 AND NOT UNIX)
|
|
|
|
link_directories(${PTHREADS_LIBPATH})
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(setup_liblinks
|
2010-06-06 13:32:58 +00:00
|
|
|
target)
|
2011-06-28 02:49:49 +00:00
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${PLATFORM_LINKFLAGS}")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${PLATFORM_LINKFLAGS_DEBUG}")
|
2009-08-17 18:07:40 +00:00
|
|
|
|
2011-06-15 13:42:02 +00:00
|
|
|
target_link_libraries(${target}
|
|
|
|
${OPENGL_gl_LIBRARY}
|
|
|
|
${OPENGL_glu_LIBRARY}
|
|
|
|
${PNG_LIBRARIES}
|
|
|
|
${ZLIB_LIBRARIES}
|
2012-06-28 12:32:06 +00:00
|
|
|
${FREETYPE_LIBRARY})
|
2010-06-06 13:32:58 +00:00
|
|
|
|
|
|
|
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
|
2011-03-24 00:14:49 +00:00
|
|
|
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
|
2010-12-08 08:43:06 +00:00
|
|
|
target_link_libraries(${target} ${PYTHON_LINKFLAGS})
|
|
|
|
|
|
|
|
if(WIN32 AND NOT UNIX)
|
2011-06-19 06:57:56 +00:00
|
|
|
file_list_suffix(PYTHON_LIBRARIES_DEBUG "${PYTHON_LIBRARIES}" "_d")
|
2011-06-26 17:18:37 +00:00
|
|
|
target_link_libraries_debug(${target} "${PYTHON_LIBRARIES_DEBUG}")
|
|
|
|
target_link_libraries_optimized(${target} "${PYTHON_LIBRARIES}")
|
2011-06-19 06:57:56 +00:00
|
|
|
unset(PYTHON_LIBRARIES_DEBUG)
|
2010-12-08 08:43:06 +00:00
|
|
|
else()
|
2011-06-19 06:57:56 +00:00
|
|
|
target_link_libraries(${target} ${PYTHON_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-06-23 13:42:14 +00:00
|
|
|
if(WITH_SYSTEM_GLEW)
|
2011-04-05 23:31:01 +00:00
|
|
|
target_link_libraries(${target} ${GLEW_LIBRARY})
|
|
|
|
endif()
|
2013-01-03 00:23:52 +00:00
|
|
|
if(WITH_BULLET AND WITH_SYSTEM_BULLET)
|
|
|
|
target_link_libraries(${target} ${BULLET_LIBRARIES})
|
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_OPENAL)
|
|
|
|
target_link_libraries(${target} ${OPENAL_LIBRARY})
|
|
|
|
endif()
|
2010-12-22 22:15:20 +00:00
|
|
|
if(WITH_FFTW3)
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${FFTW3_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
2013-03-27 07:19:54 +00:00
|
|
|
if(WITH_JACK AND NOT WITH_JACK_DYNLOAD)
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${JACK_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
if(WITH_CODEC_SNDFILE)
|
2011-06-18 12:12:19 +00:00
|
|
|
target_link_libraries(${target} ${SNDFILE_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
if(WITH_SDL)
|
|
|
|
target_link_libraries(${target} ${SDL_LIBRARY})
|
|
|
|
endif()
|
|
|
|
if(WITH_CODEC_QUICKTIME)
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${QUICKTIME_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
if(WITH_IMAGE_TIFF)
|
|
|
|
target_link_libraries(${target} ${TIFF_LIBRARY})
|
|
|
|
endif()
|
2011-11-07 15:44:09 +00:00
|
|
|
if(WITH_OPENIMAGEIO)
|
|
|
|
target_link_libraries(${target} ${OPENIMAGEIO_LIBRARIES})
|
|
|
|
endif()
|
2012-09-15 10:03:17 +00:00
|
|
|
if(WITH_OPENCOLORIO)
|
|
|
|
target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
|
|
|
|
endif()
|
2011-11-07 15:44:09 +00:00
|
|
|
if(WITH_BOOST)
|
|
|
|
target_link_libraries(${target} ${BOOST_LIBRARIES})
|
2012-11-19 08:51:35 +00:00
|
|
|
if(Boost_USE_STATIC_LIBS AND Boost_USE_ICU)
|
|
|
|
target_link_libraries(${target} ${ICU_LIBRARIES})
|
|
|
|
endif()
|
2011-11-07 15:44:09 +00:00
|
|
|
endif()
|
2012-04-22 14:33:40 +00:00
|
|
|
target_link_libraries(${target} ${JPEG_LIBRARIES})
|
2011-06-15 14:00:50 +00:00
|
|
|
if(WITH_IMAGE_OPENEXR)
|
2011-11-09 18:50:48 +00:00
|
|
|
if(WIN32 AND NOT UNIX AND NOT CMAKE_COMPILER_IS_GNUCC)
|
2011-06-19 06:57:56 +00:00
|
|
|
file_list_suffix(OPENEXR_LIBRARIES_DEBUG "${OPENEXR_LIBRARIES}" "_d")
|
2011-06-26 17:18:37 +00:00
|
|
|
target_link_libraries_debug(${target} "${OPENEXR_LIBRARIES_DEBUG}")
|
|
|
|
target_link_libraries_optimized(${target} "${OPENEXR_LIBRARIES}")
|
2011-06-19 06:57:56 +00:00
|
|
|
unset(OPENEXR_LIBRARIES_DEBUG)
|
2010-12-08 08:43:06 +00:00
|
|
|
else()
|
2011-06-15 12:09:02 +00:00
|
|
|
target_link_libraries(${target} ${OPENEXR_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2012-06-23 14:23:44 +00:00
|
|
|
if(WITH_IMAGE_OPENJPEG AND WITH_SYSTEM_OPENJPEG)
|
2011-06-19 07:46:24 +00:00
|
|
|
target_link_libraries(${target} ${OPENJPEG_LIBRARIES})
|
2011-02-15 19:04:51 +00:00
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WITH_CODEC_FFMPEG)
|
2011-09-30 16:54:11 +00:00
|
|
|
|
|
|
|
# Strange!, without this ffmpeg gives linking errors (on linux)
|
|
|
|
# even though its linked above
|
|
|
|
target_link_libraries(${target} ${OPENGL_glu_LIBRARY})
|
|
|
|
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${FFMPEG_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
if(WITH_OPENCOLLADA)
|
|
|
|
if(WIN32 AND NOT UNIX)
|
2011-06-19 06:57:56 +00:00
|
|
|
file_list_suffix(OPENCOLLADA_LIBRARIES_DEBUG "${OPENCOLLADA_LIBRARIES}" "_d")
|
2011-06-26 17:18:37 +00:00
|
|
|
target_link_libraries_debug(${target} "${OPENCOLLADA_LIBRARIES_DEBUG}")
|
|
|
|
target_link_libraries_optimized(${target} "${OPENCOLLADA_LIBRARIES}")
|
2011-06-19 06:57:56 +00:00
|
|
|
unset(OPENCOLLADA_LIBRARIES_DEBUG)
|
|
|
|
|
2011-09-12 13:58:13 +00:00
|
|
|
file_list_suffix(PCRE_LIBRARIES_DEBUG "${PCRE_LIBRARIES}" "_d")
|
|
|
|
target_link_libraries_debug(${target} "${PCRE_LIBRARIES_DEBUG}")
|
|
|
|
target_link_libraries_optimized(${target} "${PCRE_LIBRARIES}")
|
|
|
|
unset(PCRE_LIBRARIES_DEBUG)
|
2011-06-19 06:57:56 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
if(EXPAT_LIB)
|
2011-06-19 06:57:56 +00:00
|
|
|
file_list_suffix(EXPAT_LIB_DEBUG "${EXPAT_LIB}" "_d")
|
2011-06-26 17:18:37 +00:00
|
|
|
target_link_libraries_debug(${target} "${EXPAT_LIB_DEBUG}")
|
|
|
|
target_link_libraries_optimized(${target} "${EXPAT_LIB}")
|
2011-06-19 06:57:56 +00:00
|
|
|
unset(EXPAT_LIB_DEBUG)
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
else()
|
2011-06-15 13:42:02 +00:00
|
|
|
target_link_libraries(${target}
|
2011-06-18 14:12:54 +00:00
|
|
|
${OPENCOLLADA_LIBRARIES}
|
2011-09-12 13:58:13 +00:00
|
|
|
${PCRE_LIBRARIES}
|
|
|
|
${XML2_LIBRARIES}
|
2011-06-15 13:42:02 +00:00
|
|
|
${EXPAT_LIB})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2011-05-12 11:16:32 +00:00
|
|
|
if(WITH_MEM_JEMALLOC)
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${JEMALLOC_LIBRARIES})
|
2011-05-12 11:16:32 +00:00
|
|
|
endif()
|
2011-08-02 05:52:27 +00:00
|
|
|
if(WITH_INPUT_NDOF)
|
2011-08-02 06:32:53 +00:00
|
|
|
target_link_libraries(${target} ${NDOF_LIBRARIES})
|
2011-07-21 21:34:28 +00:00
|
|
|
endif()
|
2012-06-28 12:32:06 +00:00
|
|
|
if(WITH_MOD_CLOTH_ELTOPO)
|
|
|
|
target_link_libraries(${target} ${LAPACK_LIBRARIES})
|
|
|
|
endif()
|
2012-09-10 06:18:20 +00:00
|
|
|
if(WITH_CYCLES_OSL)
|
|
|
|
target_link_libraries(${target} ${OSL_LIBRARIES})
|
|
|
|
endif()
|
2012-10-06 11:00:45 +00:00
|
|
|
if(WITH_LLVM)
|
|
|
|
target_link_libraries(${target} ${LLVM_LIBRARY})
|
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
if(WIN32 AND NOT UNIX)
|
2011-06-18 14:12:54 +00:00
|
|
|
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
2012-04-22 14:33:40 +00:00
|
|
|
|
|
|
|
target_link_libraries(${target} ${PLATFORM_LINKLIBS})
|
2010-12-08 08:43:06 +00:00
|
|
|
endmacro()
|
|
|
|
|
2011-10-01 18:29:40 +00:00
|
|
|
macro(TEST_SSE_SUPPORT
|
|
|
|
_sse_flags
|
|
|
|
_sse2_flags)
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
include(CheckCSourceRuns)
|
|
|
|
|
2010-12-16 12:48:30 +00:00
|
|
|
# message(STATUS "Detecting SSE support")
|
2011-10-02 16:43:39 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
|
2011-10-01 18:29:40 +00:00
|
|
|
set(${_sse_flags} "-msse")
|
|
|
|
set(${_sse2_flags} "-msse2")
|
2010-12-08 08:43:06 +00:00
|
|
|
elseif(MSVC)
|
2011-10-01 18:29:40 +00:00
|
|
|
set(${_sse_flags} "/arch:SSE")
|
|
|
|
set(${_sse2_flags} "/arch:SSE2")
|
2011-09-30 16:37:46 +00:00
|
|
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
|
2011-10-02 17:16:28 +00:00
|
|
|
set(${_sse_flags} "") # icc defaults to -msse
|
|
|
|
set(${_sse2_flags} "-msse2")
|
2011-09-30 16:37:46 +00:00
|
|
|
else()
|
2011-10-01 18:29:40 +00:00
|
|
|
message(WARNING "SSE flags for this compiler: '${CMAKE_C_COMPILER_ID}' not known")
|
2011-10-01 19:52:33 +00:00
|
|
|
set(${_sse_flags})
|
|
|
|
set(${_sse2_flags})
|
2011-10-01 18:29:40 +00:00
|
|
|
endif()
|
|
|
|
|
2011-10-01 19:52:33 +00:00
|
|
|
set(CMAKE_REQUIRED_FLAGS "${${_sse_flags}} ${${_sse2_flags}}")
|
2010-12-08 08:43:06 +00:00
|
|
|
|
2011-10-01 19:52:33 +00:00
|
|
|
if(NOT DEFINED SUPPORT_SSE_BUILD)
|
|
|
|
# result cached
|
2010-12-21 03:32:51 +00:00
|
|
|
check_c_source_runs("
|
|
|
|
#include <xmmintrin.h>
|
2011-10-01 19:52:33 +00:00
|
|
|
int main(void) { __m128 v = _mm_setzero_ps(); return 0; }"
|
2010-12-21 03:32:51 +00:00
|
|
|
SUPPORT_SSE_BUILD)
|
2011-09-30 15:51:58 +00:00
|
|
|
|
2010-12-21 03:32:51 +00:00
|
|
|
if(SUPPORT_SSE_BUILD)
|
|
|
|
message(STATUS "SSE Support: detected.")
|
|
|
|
else()
|
|
|
|
message(STATUS "SSE Support: missing.")
|
|
|
|
endif()
|
2011-09-30 15:51:58 +00:00
|
|
|
endif()
|
2010-08-11 08:23:48 +00:00
|
|
|
|
2011-10-01 19:52:33 +00:00
|
|
|
if(NOT DEFINED SUPPORT_SSE2_BUILD)
|
|
|
|
# result cached
|
2010-12-21 03:32:51 +00:00
|
|
|
check_c_source_runs("
|
|
|
|
#include <emmintrin.h>
|
2011-10-01 19:52:33 +00:00
|
|
|
int main(void) { __m128d v = _mm_setzero_pd(); return 0; }"
|
2010-12-21 03:32:51 +00:00
|
|
|
SUPPORT_SSE2_BUILD)
|
2010-08-11 08:23:48 +00:00
|
|
|
|
2010-12-21 03:32:51 +00:00
|
|
|
if(SUPPORT_SSE2_BUILD)
|
|
|
|
message(STATUS "SSE2 Support: detected.")
|
|
|
|
else()
|
|
|
|
message(STATUS "SSE2 Support: missing.")
|
2011-09-30 15:51:58 +00:00
|
|
|
endif()
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
2010-08-11 08:23:48 +00:00
|
|
|
|
2011-10-01 19:52:33 +00:00
|
|
|
unset(CMAKE_REQUIRED_FLAGS)
|
2010-12-08 08:43:06 +00:00
|
|
|
endmacro()
|
2010-07-04 18:40:59 +00:00
|
|
|
|
2013-01-01 12:47:58 +00:00
|
|
|
macro(TEST_STDBOOL_SUPPORT)
|
|
|
|
# This program will compile correctly if and only if
|
|
|
|
# this C compiler supports C99 stdbool.
|
|
|
|
check_c_source_runs("
|
|
|
|
#include <stdbool.h>
|
|
|
|
int main(void) { return (int)false; }"
|
|
|
|
HAVE_STDBOOL_H)
|
|
|
|
endmacro()
|
|
|
|
|
2010-10-24 03:57:07 +00:00
|
|
|
# when we have warnings as errors applied globally this
|
|
|
|
# needs to be removed for some external libs which we dont maintain.
|
|
|
|
|
|
|
|
# utility macro
|
2011-10-27 07:26:41 +00:00
|
|
|
macro(remove_cc_flag
|
2010-10-24 03:57:07 +00:00
|
|
|
flag)
|
2010-12-22 22:15:20 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
|
|
|
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
|
|
|
|
string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
2011-10-27 07:26:41 +00:00
|
|
|
macro(add_cc_flag
|
|
|
|
flag)
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
|
|
|
|
endmacro()
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
macro(remove_strict_flags)
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2011-10-27 07:26:41 +00:00
|
|
|
remove_cc_flag("-Wstrict-prototypes")
|
2012-09-15 01:52:28 +00:00
|
|
|
remove_cc_flag("-Wmissing-prototypes")
|
2011-10-27 07:26:41 +00:00
|
|
|
remove_cc_flag("-Wunused-parameter")
|
|
|
|
remove_cc_flag("-Wwrite-strings")
|
2013-03-11 20:27:38 +00:00
|
|
|
remove_cc_flag("-Wredundant-decls")
|
2011-10-27 07:26:41 +00:00
|
|
|
remove_cc_flag("-Wundef")
|
|
|
|
remove_cc_flag("-Wshadow")
|
2013-03-15 22:55:10 +00:00
|
|
|
remove_cc_flag("-Wold-style-definition")
|
2011-10-27 07:26:41 +00:00
|
|
|
remove_cc_flag("-Werror=[^ ]+")
|
|
|
|
remove_cc_flag("-Werror")
|
|
|
|
|
|
|
|
# negate flags implied by '-Wall'
|
2011-11-01 00:34:09 +00:00
|
|
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
|
|
|
|
2012-06-28 12:32:06 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
remove_cc_flag("-Wunused-parameter")
|
|
|
|
remove_cc_flag("-Wunused-variable")
|
2013-02-26 21:58:06 +00:00
|
|
|
remove_cc_flag("-Werror=[^ ]+")
|
2012-06-28 12:32:06 +00:00
|
|
|
remove_cc_flag("-Werror")
|
2013-03-14 07:25:54 +00:00
|
|
|
|
|
|
|
# negate flags implied by '-Wall'
|
|
|
|
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
|
2012-06-28 12:32:06 +00:00
|
|
|
endif()
|
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
if(MSVC)
|
2010-10-24 03:57:07 +00:00
|
|
|
# TODO
|
2010-12-08 08:43:06 +00:00
|
|
|
endif()
|
2010-10-24 03:57:07 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
endmacro()
|
2010-10-24 03:57:07 +00:00
|
|
|
|
2011-10-23 17:52:20 +00:00
|
|
|
# note, we can only append flags on a single file so we need to negate the options.
|
|
|
|
# at the moment we cant shut up ffmpeg deprecations, so use this, but will
|
|
|
|
# probably add more removals here.
|
|
|
|
macro(remove_strict_flags_file
|
|
|
|
filenames)
|
|
|
|
|
|
|
|
foreach(_SOURCE ${ARGV})
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set_source_files_properties(${_SOURCE}
|
|
|
|
PROPERTIES
|
2011-10-30 04:48:00 +00:00
|
|
|
COMPILE_FLAGS "${CC_REMOVE_STRICT_FLAGS}"
|
2011-10-23 17:52:20 +00:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
# TODO
|
|
|
|
endif()
|
|
|
|
|
2012-10-21 05:46:41 +00:00
|
|
|
endforeach()
|
2011-10-23 17:52:20 +00:00
|
|
|
|
|
|
|
unset(_SOURCE)
|
|
|
|
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
2010-12-16 09:55:35 +00:00
|
|
|
macro(ADD_CHECK_C_COMPILER_FLAG
|
|
|
|
_CFLAGS
|
2010-12-21 03:32:51 +00:00
|
|
|
_CACHE_VAR
|
2010-12-16 09:55:35 +00:00
|
|
|
_FLAG)
|
|
|
|
|
2011-02-17 11:38:02 +00:00
|
|
|
include(CheckCCompilerFlag)
|
2010-12-16 09:55:35 +00:00
|
|
|
|
2011-02-17 11:38:02 +00:00
|
|
|
CHECK_C_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
2010-12-21 03:32:51 +00:00
|
|
|
if(${_CACHE_VAR})
|
2010-12-16 12:48:30 +00:00
|
|
|
# message(STATUS "Using CFLAG: ${_FLAG}")
|
|
|
|
set(${_CFLAGS} "${${_CFLAGS}} ${_FLAG}")
|
2010-12-16 09:55:35 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "Unsupported CFLAG: ${_FLAG}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(ADD_CHECK_CXX_COMPILER_FLAG
|
|
|
|
_CXXFLAGS
|
2010-12-21 03:32:51 +00:00
|
|
|
_CACHE_VAR
|
2010-12-16 09:55:35 +00:00
|
|
|
_FLAG)
|
|
|
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
2010-12-21 03:32:51 +00:00
|
|
|
CHECK_CXX_COMPILER_FLAG("${_FLAG}" "${_CACHE_VAR}")
|
|
|
|
if(${_CACHE_VAR})
|
2010-12-16 12:48:30 +00:00
|
|
|
# message(STATUS "Using CXXFLAG: ${_FLAG}")
|
|
|
|
set(${_CXXFLAGS} "${${_CXXFLAGS}} ${_FLAG}")
|
2010-12-16 09:55:35 +00:00
|
|
|
else()
|
|
|
|
message(STATUS "Unsupported CXXFLAG: ${_FLAG}")
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2010-08-02 16:23:58 +00:00
|
|
|
|
2010-12-08 08:43:06 +00:00
|
|
|
macro(get_blender_version)
|
2011-02-21 08:31:00 +00:00
|
|
|
# So cmake depends on BKE_blender.h, beware of inf-loops!
|
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h ${CMAKE_BINARY_DIR}/source/blender/blenkernel/BKE_blender.h.done)
|
2010-12-22 22:15:20 +00:00
|
|
|
|
2011-02-21 08:31:00 +00:00
|
|
|
file(STRINGS ${CMAKE_SOURCE_DIR}/source/blender/blenkernel/BKE_blender.h _contents REGEX "^#define[ \t]+BLENDER_.*$")
|
2010-12-22 22:15:20 +00:00
|
|
|
|
2011-02-21 08:31:00 +00:00
|
|
|
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION[ \t]+([0-9]+).*" "\\1" _out_version "${_contents}")
|
|
|
|
string(REGEX REPLACE ".*#define[ \t]+BLENDER_SUBVERSION[ \t]+([0-9]+).*" "\\1" _out_subversion "${_contents}")
|
|
|
|
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CHAR[ \t]+([a-z]+).*" "\\1" _out_version_char "${_contents}")
|
|
|
|
string(REGEX REPLACE ".*#define[ \t]+BLENDER_VERSION_CYCLE[ \t]+([a-z]+).*" "\\1" _out_version_cycle "${_contents}")
|
2010-12-22 22:15:20 +00:00
|
|
|
|
2011-02-21 08:31:00 +00:00
|
|
|
if(NOT ${_out_version} MATCHES "[0-9]+")
|
|
|
|
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION")
|
|
|
|
endif()
|
2010-07-14 20:26:46 +00:00
|
|
|
|
2011-02-21 08:31:00 +00:00
|
|
|
if(NOT ${_out_subversion} MATCHES "[0-9]+")
|
|
|
|
message(FATAL_ERROR "Version parsing failed for BLENDER_SUBVERSION")
|
|
|
|
endif()
|
|
|
|
|
2011-04-03 07:48:33 +00:00
|
|
|
# clumsy regex, only single char are ok but it could be unset
|
|
|
|
|
|
|
|
string(LENGTH "${_out_version_char}" _out_version_char_len)
|
|
|
|
if(NOT _out_version_char_len EQUAL 1)
|
|
|
|
set(_out_version_char "")
|
|
|
|
elseif(NOT ${_out_version_char} MATCHES "[a-z]+")
|
2011-02-21 08:31:00 +00:00
|
|
|
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CHAR")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT ${_out_version_cycle} MATCHES "[a-z]+")
|
|
|
|
message(FATAL_ERROR "Version parsing failed for BLENDER_VERSION_CYCLE")
|
|
|
|
endif()
|
|
|
|
|
2011-03-03 17:23:59 +00:00
|
|
|
math(EXPR BLENDER_VERSION_MAJOR "${_out_version} / 100")
|
|
|
|
math(EXPR BLENDER_VERSION_MINOR "${_out_version} % 100")
|
2011-02-21 08:31:00 +00:00
|
|
|
set(BLENDER_VERSION "${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}")
|
|
|
|
|
|
|
|
set(BLENDER_SUBVERSION ${_out_subversion})
|
|
|
|
set(BLENDER_VERSION_CHAR ${_out_version_char})
|
|
|
|
set(BLENDER_VERSION_CYCLE ${_out_version_cycle})
|
2010-12-22 22:15:20 +00:00
|
|
|
|
2011-02-26 06:27:54 +00:00
|
|
|
# for packaging, alpha to numbers
|
2011-04-12 16:20:41 +00:00
|
|
|
string(COMPARE EQUAL "${BLENDER_VERSION_CHAR}" "" _out_version_char_empty)
|
|
|
|
if(${_out_version_char_empty})
|
2011-02-26 06:27:54 +00:00
|
|
|
set(BLENDER_VERSION_CHAR_INDEX "0")
|
|
|
|
else()
|
2011-09-26 06:29:58 +00:00
|
|
|
set(_char_ls a b c d e f g h i j k l m n o p q r s t u v w x y z)
|
2011-02-26 06:27:54 +00:00
|
|
|
list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index)
|
2011-03-03 17:23:59 +00:00
|
|
|
math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1")
|
2011-02-26 06:27:54 +00:00
|
|
|
unset(_char_ls)
|
|
|
|
unset(_out_version_char_index)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_out_subversion)
|
|
|
|
unset(_out_version_char)
|
2011-04-12 16:20:41 +00:00
|
|
|
unset(_out_version_char_empty)
|
2011-02-26 06:27:54 +00:00
|
|
|
unset(_out_version_cycle)
|
|
|
|
|
2011-02-21 08:31:00 +00:00
|
|
|
# message(STATUS "Version (Internal): ${BLENDER_VERSION}.${BLENDER_SUBVERSION}, Version (external): ${BLENDER_VERSION}${BLENDER_VERSION_CHAR}-${BLENDER_VERSION_CYCLE}")
|
2010-12-08 08:43:06 +00:00
|
|
|
endmacro()
|
2011-05-23 14:56:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
# hacks to override initial project settings
|
2011-09-30 15:51:58 +00:00
|
|
|
# these macros must be called directly before/after project(Blender)
|
2011-05-23 14:56:14 +00:00
|
|
|
macro(blender_project_hack_pre)
|
|
|
|
# ----------------
|
|
|
|
# MINGW HACK START
|
|
|
|
# ignore system set flag, use our own
|
|
|
|
# must be before project(...)
|
|
|
|
# if the user wants to add their own its ok after first run.
|
|
|
|
if(DEFINED CMAKE_C_STANDARD_LIBRARIES)
|
|
|
|
set(_reset_standard_libraries OFF)
|
|
|
|
else()
|
|
|
|
set(_reset_standard_libraries ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# ------------------
|
|
|
|
# GCC -O3 HACK START
|
|
|
|
# needed because O3 can cause problems but
|
|
|
|
# allow the builder to set O3 manually after.
|
|
|
|
if(DEFINED CMAKE_C_FLAGS_RELEASE)
|
|
|
|
set(_reset_standard_cflags_rel OFF)
|
|
|
|
else()
|
|
|
|
set(_reset_standard_cflags_rel ON)
|
|
|
|
endif()
|
|
|
|
if(DEFINED CMAKE_CXX_FLAGS_RELEASE)
|
|
|
|
set(_reset_standard_cxxflags_rel OFF)
|
|
|
|
else()
|
|
|
|
set(_reset_standard_cxxflags_rel ON)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
|
|
|
|
macro(blender_project_hack_post)
|
|
|
|
# --------------
|
|
|
|
# MINGW HACK END
|
|
|
|
if (_reset_standard_libraries)
|
2012-08-11 12:26:43 +00:00
|
|
|
# Must come after projecINCt(...)
|
2011-05-23 14:56:14 +00:00
|
|
|
#
|
|
|
|
# MINGW workaround for -ladvapi32 being included which surprisingly causes
|
|
|
|
# string formatting of floats, eg: printf("%.*f", 3, value). to crash blender
|
|
|
|
# with a meaningless stack trace. by overriding this flag we ensure we only
|
|
|
|
# have libs we define and that cmake & scons builds match.
|
|
|
|
set(CMAKE_C_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "" FORCE)
|
2011-09-30 15:51:58 +00:00
|
|
|
mark_as_advanced(
|
|
|
|
CMAKE_C_STANDARD_LIBRARIES
|
|
|
|
CMAKE_CXX_STANDARD_LIBRARIES
|
|
|
|
)
|
2011-05-23 14:56:14 +00:00
|
|
|
endif()
|
|
|
|
unset(_reset_standard_libraries)
|
|
|
|
|
|
|
|
|
|
|
|
# ----------------
|
|
|
|
# GCC -O3 HACK END
|
|
|
|
if(_reset_standard_cflags_rel)
|
|
|
|
string(REGEX REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
|
|
|
|
mark_as_advanced(CMAKE_C_FLAGS_RELEASE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_reset_standard_cxxflags_rel)
|
|
|
|
string(REGEX REPLACE "-O3" "-O2" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "" FORCE)
|
|
|
|
mark_as_advanced(CMAKE_CXX_FLAGS_RELEASE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_reset_standard_cflags_rel)
|
|
|
|
unset(_reset_standard_cxxflags_rel)
|
2011-06-11 06:00:28 +00:00
|
|
|
|
2011-06-14 00:24:50 +00:00
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# workaround for omission in cmake 2.8.4's GNU.cmake, fixed in 2.8.5
|
2011-06-11 06:00:28 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
if(NOT DARWIN)
|
|
|
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2011-05-23 14:56:14 +00:00
|
|
|
endmacro()
|
2011-11-07 15:53:40 +00:00
|
|
|
|
|
|
|
# pair of macros to allow libraries to be specify files to install, but to
|
|
|
|
# only install them at the end so the directories don't get cleared with
|
|
|
|
# the files in them. used by cycles to install addon.
|
|
|
|
macro(delayed_install
|
|
|
|
base
|
|
|
|
files
|
|
|
|
destination)
|
|
|
|
|
|
|
|
foreach(f ${files})
|
2012-11-15 17:16:27 +00:00
|
|
|
if(IS_ABSOLUTE ${f})
|
|
|
|
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${f})
|
|
|
|
else()
|
|
|
|
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_FILES ${base}/${f})
|
|
|
|
endif()
|
2011-11-07 15:53:40 +00:00
|
|
|
set_property(GLOBAL APPEND PROPERTY DELAYED_INSTALL_DESTINATIONS ${destination})
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
# note this is a function instead of a macro so that ${BUILD_TYPE} in targetdir
|
|
|
|
# does not get expanded in calling but is preserved
|
|
|
|
function(delayed_do_install
|
|
|
|
targetdir)
|
|
|
|
|
|
|
|
get_property(files GLOBAL PROPERTY DELAYED_INSTALL_FILES)
|
|
|
|
get_property(destinations GLOBAL PROPERTY DELAYED_INSTALL_DESTINATIONS)
|
|
|
|
|
|
|
|
if(files)
|
|
|
|
list(LENGTH files n)
|
|
|
|
math(EXPR n "${n}-1")
|
|
|
|
|
|
|
|
foreach(i RANGE ${n})
|
|
|
|
list(GET files ${i} f)
|
|
|
|
list(GET destinations ${i} d)
|
|
|
|
install(FILES ${f} DESTINATION ${targetdir}/${d})
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2011-12-30 22:10:48 +00:00
|
|
|
macro(set_lib_path
|
|
|
|
lvar
|
|
|
|
lproj)
|
|
|
|
|
2012-08-04 20:25:04 +00:00
|
|
|
if(MSVC10)
|
|
|
|
set(${lvar} ${LIBDIR}/${lproj}/vc2010)
|
2011-12-30 22:10:48 +00:00
|
|
|
else()
|
|
|
|
set(${lvar} ${LIBDIR}/${lproj})
|
|
|
|
endif()
|
2012-04-22 14:33:40 +00:00
|
|
|
endmacro()
|
2012-08-08 16:03:42 +00:00
|
|
|
|
|
|
|
|
2012-08-11 12:26:43 +00:00
|
|
|
macro(data_to_c
|
2012-08-11 16:25:31 +00:00
|
|
|
file_from file_to
|
2012-08-11 12:26:43 +00:00
|
|
|
list_to_add)
|
2012-08-08 16:03:42 +00:00
|
|
|
|
2012-08-11 12:26:43 +00:00
|
|
|
list(APPEND ${list_to_add} ${file_to})
|
2012-08-08 16:03:42 +00:00
|
|
|
|
2012-08-11 16:25:31 +00:00
|
|
|
get_filename_component(_file_to_path ${file_to} PATH)
|
|
|
|
|
2012-08-11 12:26:43 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${file_to}
|
2012-08-11 16:25:31 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
2012-08-11 18:39:38 +00:00
|
|
|
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${file_from} ${file_to}
|
|
|
|
DEPENDS ${file_from} datatoc)
|
2012-08-11 16:25:31 +00:00
|
|
|
unset(_file_to_path)
|
2012-08-11 12:26:43 +00:00
|
|
|
endmacro()
|
2012-08-08 16:03:42 +00:00
|
|
|
|
2012-08-11 18:47:09 +00:00
|
|
|
|
2012-08-11 13:32:19 +00:00
|
|
|
# same as above but generates the var name and output automatic.
|
|
|
|
macro(data_to_c_simple
|
|
|
|
file_from
|
|
|
|
list_to_add)
|
|
|
|
|
2012-08-11 18:39:38 +00:00
|
|
|
# remove ../'s
|
|
|
|
get_filename_component(_file_from ${CMAKE_CURRENT_SOURCE_DIR}/${file_from} REALPATH)
|
|
|
|
get_filename_component(_file_to ${CMAKE_CURRENT_BINARY_DIR}/${file_from}.c REALPATH)
|
2012-08-11 13:32:19 +00:00
|
|
|
|
2012-08-11 18:39:38 +00:00
|
|
|
list(APPEND ${list_to_add} ${_file_to})
|
2012-08-11 13:32:19 +00:00
|
|
|
|
2012-08-11 16:25:31 +00:00
|
|
|
get_filename_component(_file_to_path ${_file_to} PATH)
|
|
|
|
|
2012-08-11 13:32:19 +00:00
|
|
|
add_custom_command(
|
2012-08-11 18:39:38 +00:00
|
|
|
OUTPUT ${_file_to}
|
2012-08-11 16:25:31 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${_file_to_path}
|
2012-08-11 18:39:38 +00:00
|
|
|
COMMAND ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/datatoc ${_file_from} ${_file_to}
|
|
|
|
DEPENDS ${_file_from} datatoc)
|
2012-08-11 13:32:19 +00:00
|
|
|
|
2012-08-11 18:39:38 +00:00
|
|
|
unset(_file_from)
|
2012-08-11 16:25:31 +00:00
|
|
|
unset(_file_to)
|
|
|
|
unset(_file_to_path)
|
2012-08-11 13:32:19 +00:00
|
|
|
endmacro()
|