diff options
Diffstat (limited to 'build_files/cmake/macros.cmake')
-rw-r--r-- | build_files/cmake/macros.cmake | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake index 9671bffe2bd..db6c080d98d 100644 --- a/build_files/cmake/macros.cmake +++ b/build_files/cmake/macros.cmake @@ -187,9 +187,6 @@ macro(SETUP_LIBDIRS) if(WITH_CODEC_SNDFILE) link_directories(${SNDFILE_LIBPATH}) endif() - if(WITH_SAMPLERATE) - link_directories(${SAMPLERATE_LIBPATH}) - endif() if(WITH_FFTW3) link_directories(${FFTW3_LIBPATH}) endif() @@ -219,6 +216,7 @@ macro(setup_liblinks ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} + ${FREETYPE_LIBRARY} ${PLATFORM_LINKLIBS}) # since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions @@ -239,15 +237,8 @@ macro(setup_liblinks target_link_libraries(${target} ${GLEW_LIBRARY}) endif() - target_link_libraries(${target} - ${OPENGL_glu_LIBRARY} - ${JPEG_LIBRARIES} - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - ${FREETYPE_LIBRARY}) - if(WITH_INTERNATIONAL) - target_link_libraries(${target} ${GETTEXT_LIB}) + target_link_libraries(${target} ${GETTEXT_LIBRARIES}) if(WIN32 AND NOT UNIX) target_link_libraries(${target} ${ICONV_LIBRARIES}) @@ -266,9 +257,6 @@ macro(setup_liblinks if(WITH_CODEC_SNDFILE) target_link_libraries(${target} ${SNDFILE_LIBRARIES}) endif() - if(WITH_SAMPLERATE) - target_link_libraries(${target} ${SAMPLERATE_LIBRARIES}) - endif() if(WITH_SDL) target_link_libraries(${target} ${SDL_LIBRARY}) endif() @@ -298,6 +286,11 @@ macro(setup_liblinks target_link_libraries(${target} ${OPENJPEG_LIBRARIES}) endif() if(WITH_CODEC_FFMPEG) + + # Strange!, without this ffmpeg gives linking errors (on linux) + # even though its linked above + target_link_libraries(${target} ${OPENGL_glu_LIBRARY}) + target_link_libraries(${target} ${FFMPEG_LIBRARIES}) endif() if(WITH_OPENCOLLADA) @@ -338,44 +331,59 @@ macro(setup_liblinks endif() endmacro() -macro(TEST_SSE_SUPPORT) +macro(TEST_SSE_SUPPORT + _sse_flags + _sse2_flags) + include(CheckCSourceRuns) # message(STATUS "Detecting SSE support") - if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_REQUIRED_FLAGS "-msse -msse2") + if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang")) + set(${_sse_flags} "-msse") + set(${_sse2_flags} "-msse2") elseif(MSVC) - set(CMAKE_REQUIRED_FLAGS "/arch:SSE2") # TODO, SSE 1 ? + set(${_sse_flags} "/arch:SSE") + set(${_sse2_flags} "/arch:SSE2") + elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") + set(${_sse_flags} "") # icc defaults to -msse + set(${_sse2_flags} "-msse2") + else() + message(WARNING "SSE flags for this compiler: '${CMAKE_C_COMPILER_ID}' not known") + set(${_sse_flags}) + set(${_sse2_flags}) endif() - if(NOT DEFINED ${SUPPORT_SSE_BUILD}) + set(CMAKE_REQUIRED_FLAGS "${${_sse_flags}} ${${_sse2_flags}}") + + if(NOT DEFINED SUPPORT_SSE_BUILD) + # result cached check_c_source_runs(" #include <xmmintrin.h> - int main() { __m128 v = _mm_setzero_ps(); return 0; }" + int main(void) { __m128 v = _mm_setzero_ps(); return 0; }" SUPPORT_SSE_BUILD) - + if(SUPPORT_SSE_BUILD) message(STATUS "SSE Support: detected.") else() message(STATUS "SSE Support: missing.") endif() - set(${SUPPORT_SSE_BUILD} ${SUPPORT_SSE_BUILD} CACHE INTERNAL "SSE Test") - endif() + endif() - if(NOT DEFINED ${SUPPORT_SSE2_BUILD}) + if(NOT DEFINED SUPPORT_SSE2_BUILD) + # result cached check_c_source_runs(" #include <emmintrin.h> - int main() { __m128d v = _mm_setzero_pd(); return 0; }" + int main(void) { __m128d v = _mm_setzero_pd(); return 0; }" SUPPORT_SSE2_BUILD) if(SUPPORT_SSE2_BUILD) message(STATUS "SSE2 Support: detected.") else() message(STATUS "SSE2 Support: missing.") - endif() - set(${SUPPORT_SSE2_BUILD} ${SUPPORT_SSE2_BUILD} CACHE INTERNAL "SSE2 Test") + endif() endif() + unset(CMAKE_REQUIRED_FLAGS) endmacro() # when we have warnings as errors applied globally this @@ -494,7 +502,7 @@ macro(get_blender_version) if(${_out_version_char_empty}) set(BLENDER_VERSION_CHAR_INDEX "0") else() - 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 q y z) + 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) list(FIND _char_ls ${BLENDER_VERSION_CHAR} _out_version_char_index) math(EXPR BLENDER_VERSION_CHAR_INDEX "${_out_version_char_index} + 1") unset(_char_ls) @@ -511,7 +519,7 @@ endmacro() # hacks to override initial project settings -# these macros must be called directly before/after project(Blender) +# these macros must be called directly before/after project(Blender) macro(blender_project_hack_pre) # ---------------- # MINGW HACK START @@ -553,8 +561,10 @@ macro(blender_project_hack_post) # 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) - mark_as_advanced(CMAKE_C_STANDARD_LIBRARIES) - mark_as_advanced(CMAKE_CXX_STANDARD_LIBRARIES) + mark_as_advanced( + CMAKE_C_STANDARD_LIBRARIES + CMAKE_CXX_STANDARD_LIBRARIES + ) endif() unset(_reset_standard_libraries) |