Commit 4f917521 authored by jerem's avatar jerem Committed by jeremad

Add homebrew for mac

parent cebf09b6
......@@ -212,7 +212,7 @@ endif(NOT CMAKE_EXTERNAL_DEPS)
set(CMAKE_EXTERNAL_LIB "${CMAKE_EXTERNAL_DEPS}/lib")
set(CMAKE_EXTERNAL_INCLUDE "${CMAKE_EXTERNAL_DEPS}/include")
if(NOT EXISTS ${CMAKE_EXTERNAL_DEPS} AND NOT APPLE_MACPORTS AND NOT LINUX_PKG)
if(NOT EXISTS ${CMAKE_EXTERNAL_DEPS} AND NOT APPLE_MACPORTS AND NOT APPLE_BREW AND NOT LINUX_PKG)
message(FATAL_ERROR "external_deps folder not found and no system package manager set")
endif()
......
if(DISABLE_AV)
return()
endif(DISABLE_AV)
endif()
set(SOURCE_FILES
src/avWriter.cpp
......@@ -37,8 +37,8 @@ function(setup_av_plugin PLUGIN_NAME BACKEND_NAME USE_CUDA)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UP} ${VS_GPU_PLUGIN_DIR_${OUTPUTCONFIG_UP}})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UP} ${VS_GPU_PLUGIN_DIR_${OUTPUTCONFIG_UP}})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG_UP} ${VS_GPU_PLUGIN_DIR_${OUTPUTCONFIG_UP}})
endforeach(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
endif(WINDOWS)
endforeach()
endif()
vs_add_IO_library(${PLUGIN_NAME} SHARED ${SOURCE_FILES} ${HEADER_FILES} $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:format_cuda_${USE_CUDA}>)
include_lib_vs_headers(${PLUGIN_NAME})
......@@ -61,6 +61,8 @@ function(setup_av_plugin PLUGIN_NAME BACKEND_NAME USE_CUDA)
set(FFMPEG_INCLUDE_PATH ${CMAKE_EXTERNAL_DEPS}/include/ffmpeg)
if(APPLE_MACPORTS)
set(FFMPEG_INCLUDE_PATH /opt/local/include)
elseif(APPLE_BREW)
set(FFMPEG_INCLUDE_PATH /usr/local/include)
endif()
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE ${FFMPEG_INCLUDE_PATH})
......@@ -105,10 +107,9 @@ if(WINDOWS)
if(GPU_BACKEND_OPENCL)
setup_av_plugin("av_opencl" "opencl" "OFF")
endif()
else(WINDOWS)
else()
setup_av_plugin("avPlugin" "" ${GPU_BACKEND_CUDA})
endif(WINDOWS)
endif()
# make I/O plugin list available to parent CMake project
set(VS_IO_LIBRARIES ${VS_IO_LIBRARIES} PARENT_SCOPE)
......@@ -66,6 +66,11 @@ function(setup_format BACKEND_NAME USE_CUDA)
find_library(FFMPEG_avformat NAMES avformat)
find_library(FFMPEG_avutil NAMES avutil)
target_include_directories(${LIST_NAME} PRIVATE /opt/local/include)
elseif(APPLE_BREW)
find_library(FFMPEG_avcodec NAMES avcodec)
find_library(FFMPEG_avformat NAMES avformat)
find_library(FFMPEG_avutil NAMES avutil)
target_include_directories(${LIST_NAME} PRIVATE /usr/local/include)
else()
find_library(FFMPEG_avcodec NAMES avcodec avcodec.57 PATHS ${CMAKE_EXTERNAL_DEPS}/lib/ffmpeg NO_DEFAULT_PATH)
find_library(FFMPEG_avformat NAMES avformat avformat.57 PATHS ${CMAKE_EXTERNAL_DEPS}/lib/ffmpeg NO_DEFAULT_PATH)
......
if(DISABLE_JPEG)
return()
endif(DISABLE_JPEG)
endif()
set(SOURCE_FILES
src/export.cpp
......@@ -14,9 +14,9 @@ set(HEADER_FILES
if(WINDOWS)
set(PLUGIN_NAME jpg)
else(WINDOWS)
else()
set(PLUGIN_NAME jpgPlugin)
endif(WINDOWS)
endif()
vs_add_IO_library(${PLUGIN_NAME} SHARED ${SOURCE_FILES} ${HEADER_FILES} $<TARGET_OBJECTS:common>)
......@@ -37,21 +37,24 @@ if(LINUX)
endif()
elseif(APPLE_MACPORTS)
find_library(JPEG NAMES jpeg PATHS /opt/local/lib)
elseif(APPLE_BREW)
find_library(JPEG NAMES jpeg PATHS /usr/local/lib)
else()
find_library(TURBO_JPEG NAMES turbojpeg turbojpeg.0 PATHS "${CMAKE_EXTERNAL_DEPS}/lib/libjpeg-turbo" NO_DEFAULT_PATH)
find_library(JPEG NAMES jpeg jpeg.62 PATHS "${CMAKE_EXTERNAL_DEPS}/lib/libjpeg-turbo" NO_DEFAULT_PATH)
endif(LINUX)
endif()
if(APPLE_MACPORTS)
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE /opt/local/include)
elseif(APPLE_BREW)
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE /usr/local/include)
else()
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE "${CMAKE_EXTERNAL_DEPS}/include/libjpeg-turbo")
endif()
if(APPLE_MACPORTS OR LINUX_PKG)
if(APPLE_MACPORTS OR LINUX_PKG OR APPLE_BREW)
target_link_libraries(${PLUGIN_NAME} PRIVATE ${JPEG} ${VS_DISCOVERY})
else()
target_link_libraries(${PLUGIN_NAME} PRIVATE ${TURBO_JPEG} ${JPEG} ${VS_DISCOVERY})
endif()
link_target_to_libvideostitch(${PLUGIN_NAME})
......@@ -256,19 +256,16 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE ${libmfxhw64} ${libva} ${libva_drm}
endif(LINUX OR ANDROID)
if(APPLE)
if(APPLE_MACPORTS)
if(APPLE_MACPORTS OR APPLE_BREW)
find_library(librtmp rtmp REQUIRED)
find_library(libx264 x264 REQUIRED)
else()
find_library(librtmp rtmp HINTS ${CMAKE_EXTERNAL_LIB}/librtmp REQUIRED NO_DEFAULT_PATH)
find_library(libx264 x264 HINTS ${CMAKE_EXTERNAL_LIB}/ffmpeg REQUIRED NO_DEFAULT_PATH)
endif()
find_library(libfaac faac REQUIRED)
find_library(libfaad faad.2 REQUIRED)
find_library(libmp3lame mp3lame REQUIRED)
if(APPLE_MACPORTS)
find_library(libx264 x264 REQUIRED)
else()
find_library(libx264 x264 HINTS ${CMAKE_EXTERNAL_LIB}/ffmpeg REQUIRED NO_DEFAULT_PATH)
endif()
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE ${CMAKE_EXTERNAL_DEPS}/include/librtmp)
target_include_directories(${PLUGIN_NAME} SYSTEM PRIVATE ${CMAKE_EXTERNAL_DEPS}/include/ffmpeg/x264)
# Use libfaac and libfaac from MacPorts
......
if (WINDOWS)
if(WINDOWS)
find_debug_and_optimized_library(OpenCV_CORE_LIBS "opencv2/Debug" "opencv_core310d" "opencv2/Release" "opencv_core310")
find_debug_and_optimized_library(OpenCV_CALIB_LIBS "opencv2/Debug" "opencv_calib3d310d" "opencv2/Release" "opencv_calib3d310")
find_debug_and_optimized_library(OpenCV_FEATURES_LIBS "opencv2/Debug" "opencv_features2d310d" "opencv2/Release" "opencv_features2d310")
......@@ -9,10 +8,10 @@ if (WINDOWS)
find_debug_and_optimized_library(OpenCV_VIDEO_LIBS "opencv2/Debug" "opencv_video310d" "opencv2/Release" "opencv_video310")
set(OpenCV_LIBRARIES ${OpenCV_CORE_LIBS} ${OpenCV_CALIB_LIBS} ${OpenCV_FEATURES_LIBS} ${OpenCV_IMGPROC_LIBS} ${OpenCV_FLANN_LIBS} ${OpenCV_VIDEO_LIBS})
set(OpenCV_INCLUDE_DIRS ${CMAKE_EXTERNAL_DEPS}/include/opencv2)
endif(WINDOWS)
endif()
if (LINUX OR ANDROID)
if(LINUX OR ANDROID)
if(LINUX_PKG)
find_library(OpenCV_CORE_LIBS NAMES "opencv_core")
find_library(OpenCV_CALIB_LIBS NAMES "opencv_calib3d")
......@@ -20,15 +19,15 @@ if (LINUX OR ANDROID)
find_library(OpenCV_IMGPROC_LIBS NAMES "opencv_imgproc")
find_library(OpenCV_FLANN_LIBS NAMES "opencv_flann")
find_library(OpenCV_VIDEO_LIBS NAMES "opencv_video")
else(LINUX_PKG)
else()
find_library(OpenCV_CORE_LIBS NAMES "opencv_core" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_library(OpenCV_CALIB_LIBS NAMES "opencv_calib3d" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_library(OpenCV_FEATURES_LIBS NAMES "opencv_features2d" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_library(OpenCV_IMGPROC_LIBS NAMES "opencv_imgproc" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_library(OpenCV_FLANN_LIBS NAMES "opencv_flann" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
find_library(OpenCV_VIDEO_LIBS NAMES "opencv_video" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif(LINUX_PKG)
set(OpenCV_INCLUDE_DIRS ${CMAKE_EXTERNAL_DEPS}/include/opencv2)
endif()
set(OpenCV_LIBRARIES
${OpenCV_CALIB_LIBS}
......@@ -37,23 +36,21 @@ if (LINUX OR ANDROID)
${OpenCV_VIDEO_LIBS}
${OpenCV_IMGPROC_LIBS}
${OpenCV_CORE_LIBS})
set(OpenCV_INCLUDE_DIRS ${CMAKE_EXTERNAL_DEPS}/include/opencv2)
endif(LINUX OR ANDROID)
endif()
if (ANDROID)
if(ANDROID)
find_library(OpenCV_HAL_LIBS NAMES "opencv_hal" PATHS ${CMAKE_EXTERNAL_DEPS}/lib NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
set(OpenCV_LIBRARIES
${OpenCV_LIBRARIES}
${OpenCV_HAL_LIBS})
endif(ANDROID)
endif()
if(APPLE)
if(APPLE_MACPORTS)
find_package(OpenCV REQUIRED core calib3d features2d imgproc flann video PATHS /opt/local NO_DEFAULT_PATH)
elseif(APPLE_BREW)
find_package(OpenCV REQUIRED core calib3d features2d imgproc flann video PATHS "/usr/local/opt/opencv@3" "/usr/local" NO_DEFAULT_PATH)
else()
find_package(OpenCV REQUIRED core calib3d features2d imgproc flann video PATHS ${CMAKE_EXTERNAL_DEPS}/lib/opencv2/share/OpenCV NO_DEFAULT_PATH)
endif()
endif(APPLE)
# TODO print path
endif()
if(APPLE_MACPORTS)
find_path(OpenEXR_ROOT_DIR include/openexr/half.h HINTS /opt/local)
elseif(APPLE_BREW)
find_path(OpenEXR_ROOT_DIR include/openexr/half.h HINTS /usr/local)
else()
find_path(OpenEXR_ROOT_DIR include/openexr/half.h HINTS "${CMAKE_EXTERNAL_DEPS}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif()
if (APPLE)
if(APPLE)
if(APPLE_MACPORTS)
find_path(OpenEXR_LIBRARY_DIR libHalf.dylib HINTS /opt/local/lib)
elseif(APPLE_BREW)
find_path(OpenEXR_LIBRARY_DIR libHalf.dylib HINTS /usr/local/lib)
else()
find_path(OpenEXR_LIBRARY_DIR libHalf.dylib HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES lib/openexr/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif()
......@@ -15,8 +19,8 @@ elseif (LINUX OR ANDROID)
find_library(OpenEXR_LIBRARY_DIR libHalf.so)
else(LINUX_PKG)
find_path(OpenEXR_LIBRARY_DIR libHalf.so HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES lib/openexr/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif(LINUX_PKG)
elseif (WIN32)
endif()
elseif(WINDOWS)
find_path(OpenEXR_LIBRARY_DIR Half.lib HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES lib/openexr/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif()
......@@ -24,12 +28,13 @@ if(LINUX_PKG)
find_path(OpenEXR_INCLUDE_DIR OpenEXR/half.h)
elseif(APPLE_MACPORTS)
find_path(OpenEXR_INCLUDE_DIR OpenEXR/half.h HINTS /opt/local/include)
elseif(APPLE_BREW)
find_path(OpenEXR_INCLUDE_DIR OpenEXR/half.h HINTS /usr/local/include)
else()
find_path(OpenEXR_INCLUDE_DIR openexr/half.h HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES include/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif()
if(LINUX_PKG OR APPLE_MACPORTS)
if(LINUX_PKG OR APPLE_MACPORTS OR APPLE_BREW)
if(OpenEXR_INCLUDE_DIR AND EXISTS "${OpenEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h")
file(STRINGS
${OpenEXR_INCLUDE_DIR}/OpenEXR/OpenEXRConfig.h
......@@ -37,9 +42,7 @@ if(LINUX_PKG OR APPLE_MACPORTS)
REGEX "#define OPENEXR_VERSION_STRING.*$")
string(REGEX MATCHALL "[0-9.]+" OPENEXR_VERSION ${TMP})
endif()
else()
if(OpenEXR_INCLUDE_DIR AND EXISTS "${OpenEXR_INCLUDE_DIR}/openexr/OpenEXRConfig.h")
file(STRINGS
${OpenEXR_INCLUDE_DIR}/openexr/OpenEXRConfig.h
......@@ -50,13 +53,13 @@ else()
endif()
foreach(OpenEXR_LIB Half Iex Imath IlmImf IlmThread)
if (LINUX OR ANDROID)
if(LINUX OR ANDROID)
if(LINUX_PKG)
find_library(OpenEXR_${OpenEXR_LIB}_LIBRARY ${OpenEXR_LIB})
else()
find_library(OpenEXR_${OpenEXR_LIB}_LIBRARY ${OpenEXR_LIB} NO_DEFAULT_PATH HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES lib/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif()
elseif (APPLE_MACPORTS)
elseif(APPLE_MACPORTS OR APPLE_BREW)
find_library(OpenEXR_${OpenEXR_LIB}_LIBRARY ${OpenEXR_LIB} NO_DEFAULT_PATH HINTS ${OpenEXR_ROOT_DIR} PATH_SUFFIXES lib/)
else()
find_library(OpenEXR_${OpenEXR_LIB}_LIBRARY ${OpenEXR_LIB} NO_DEFAULT_PATH HINTS "${CMAKE_EXTERNAL_DEPS}" PATH_SUFFIXES lib/openexr/ NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
......@@ -65,7 +68,7 @@ foreach(OpenEXR_LIB Half Iex Imath IlmImf IlmThread)
if(OpenEXR_${OpenEXR_LIB}_LIBRARY)
list(APPEND OpenEXR_LIBRARIES ${OpenEXR_${OpenEXR_LIB}_LIBRARY})
endif()
endforeach(OpenEXR_LIB)
endforeach()
# So #include <half.h> works
list(APPEND OpenEXR_INCLUDE_DIRS ${OpenEXR_INCLUDE_DIR})
......
......@@ -362,17 +362,17 @@ set(CORE_LIB_SOURCES
)
if(NOT ANDROID)
set(CORE_LIB_SOURCES
set(CORE_LIB_SOURCES
${CORE_LIB_SOURCES}
src/overlay/overlayer.cpp
)
if(NOT DISABLE_EXR)
set(CORE_LIB_SOURCES
)
if(NOT DISABLE_EXR)
set(CORE_LIB_SOURCES
${CORE_LIB_SOURCES}
src/util/exrutil.cpp
)
endif()
endif()
endif(NOT ANDROID)
set(CORE_LIB_HEADERS
src/audio/asrc.hpp
......
......@@ -6,11 +6,15 @@ set(VS_LIB_SYSTEM_INCLUDES
find_library(IO_KIT IOKit REQUIRED)
if(APPLE_MACPORTS)
if(APPLE_MACPORTS OR APPLE_BREW)
find_package(Ceres REQUIRED)
set(CERES_LIBS general ${CERES_LIBRARIES})
if(APPLE_MACPORTS)
set(EIGEN3_INCLUDE_DIRS /opt/local/include/eigen3)
else()
set(EIGEN3_INCLUDE_DIRS /usr/local/include/eigen3)
endif()
else()
find_library(CERES_OPTIMIZED_LIBRARY NAMES ceres ceres.1 PATHS ${CMAKE_EXTERNAL_DEPS}/lib/ceres)
set(CERES_LIBS
......
......@@ -67,15 +67,13 @@ set(CL_BACKEND_SOURCES
if(NOT ANDROID)
find_package(OpenCL REQUIRED)
if(WINDOWS)
find_library(GLEW NAMES glew32s PATHS ${CMAKE_EXTERNAL_DEPS}/lib/GL NO_DEFAULT_PATH)
else(WINDOWS)
else()
find_package(GLEW REQUIRED)
endif(WINDOWS)
endif()
find_package(OpenGL REQUIRED)
endif(NOT ANDROID)
endif()
message(STATUS "--- OpenCL GPU backend ---")
message(STATUS "OpenCL version: ${OpenCL_VERSION_STRING}")
......
......@@ -13,9 +13,13 @@ if(LINUX)
find_library(GLFW glfw HINTS "${CMAKE_EXTERNAL_LIB}" REQUIRED NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
endif(LINUX_PKG)
elseif(APPLE)
if(APPLE_MACPORTS)
if(APPLE_MACPORTS OR APPLE_BREW)
find_library(GLFW glfw HINTS "${CMAKE_EXTERNAL_LIB}/glfw" REQUIRED)
if(APPLE_MACPORTS)
target_include_directories(${CMD_NAME} PRIVATE /opt/local/include)
else()
target_include_directories(${CMD_NAME} PRIVATE /usr/local/include)
endif()
else()
find_library(GLFW glfw HINTS "${CMAKE_EXTERNAL_LIB}/glfw" REQUIRED NO_DEFAULT_PATH)
endif()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment