blob: 882dafc182feeca8ef48927b6186842252b4423a [file] [log] [blame]
agsantos1e7736c2020-10-28 14:39:13 -04001cmake_minimum_required(VERSION 3.10)
2
3# set the project name
4set (ProjectName PLUGINNAME)
5set (Version MANIFESTVERSION)
6
7project(${ProjectName} VERSION ${Version})
8
9set (DAEMON ${PROJECT_SOURCE_DIR}/../../daemon)
10set (JPL_FILE_NAME ${ProjectName}.jpl)
11set (DAEMON_SRC ${DAEMON}/src)
12set (CONTRIB_PATH ${DAEMON}/contrib)
13set (PLUGINS_LIB ${PROJECT_SOURCE_DIR}/../lib)
14set (JPL_DIRECTORY ${PROJECT_BINARY_DIR}/jpl)
15set (LIBS_DIR ${PROJECT_SOURCE_DIR}/../contrib/Libs)
16
17if(WIN32)
18 message(OS:\ WINDOWS\ ${CMAKE_SYSTEM_PROCESSOR})
19 if (NOT ${CMAKE_CL_64})
20 message( FATAL_ERROR "\nUse CMake only for x64 Windows" )
21 endif()
22 set (CONTRIB_PLATFORM_CURT x64)
23 set (CONTRIB_PLATFORM ${CONTRIB_PLATFORM_CURT}-windows)
24 set (LIBRARY_FILE_NAME ${ProjectName}.dll)
25 ---set (FFMPEG ${CONTRIB_PATH}/build/ffmpeg/Build/win32/x64)
26---else()
27 message( FATAL_ERROR "\nUse CMake only for Windows! For linux or Android (linux host), use our bash scripts." )
28endif()
29
30message(Building:\ ${ProjectName}\ ${Version})
31message(Build\ path:\ ${PROJECT_BINARY_DIR})
32message(JPL\ assembling\ path:\ ${JPL_DIRECTORY})
33message(JPL\ path:\ ${JPL_DIRECTORY}/../../../build/${ProjectName}/${JPL_FILE_NAME})
34
35set(CMAKE_CXX_STANDARD 17)
36set(CMAKE_CXX_STANDARD_REQUIRED True)
37set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
38set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
39
40set(plugin_SRC ---CPPFILENAME
41 ---../lib/accel.cppFFMPEGCPP
42 ---)
43
44set(plugin_HDR ---HFILENAME
45 ---../lib/accel.hFFMPEGH
46 ../lib/framescaler.h
47 ---../lib/pluglog.h
48 )
49
50add_library(${ProjectName} SHARED ${plugin_SRC}
51 ${plugin_HDR}
52 )
53
54target_include_directories(${ProjectName} PUBLIC ${PROJECT_BINARY_DIR}
55 ${PROJECT_SOURCE_DIR}
56 ${PLUGINS_LIB}
57 ${DAEMON_SRC}
58 ${CONTRIB_PATH}
59 ---${FFMPEG}/include---
60 )
61target_link_directories(${ProjectName} PUBLIC ${CONTRIB_PATH}
62 ---${FFMPEG}/bin---
63 )
64
65target_link_libraries(${ProjectName} PUBLIC ---swscale avutil---)
66
67add_custom_command(
68 TARGET ${ProjectName}
69 PRE_BUILD
70 COMMAND python3 ${PROJECT_SOURCE_DIR}/../SDK/jplManipulation.py --preassemble --plugin=${ProjectName}
71 COMMENT "Assembling Plugin files"
72)
73
74add_custom_command(
75 TARGET ${ProjectName}
76 POST_BUILD
77 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${ProjectName}.lib ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
78 COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/Release/${LIBRARY_FILE_NAME} ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
79 COMMAND python3 ${PROJECT_SOURCE_DIR}/../SDK/jplManipulation.py --assemble --plugin=${ProjectName}
80 COMMENT "Generating JPL archive"
81)