2012-10-09 07:02:04 +04:00
|
|
|
# FreeRDP: A Remote Desktop Protocol Implementation
|
2012-08-14 07:19:51 +04:00
|
|
|
# libfreerdp cmake build script
|
|
|
|
#
|
|
|
|
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
2012-10-05 00:54:16 +04:00
|
|
|
set(MODULE_NAME "freerdp")
|
|
|
|
set(MODULE_PREFIX "FREERDP")
|
|
|
|
|
2013-05-16 22:45:49 +04:00
|
|
|
# Create imported targets for Intel IPP libraries
|
|
|
|
|
|
|
|
if(IPP_FOUND)
|
2015-07-31 12:35:54 +03:00
|
|
|
foreach(ipp_lib ${IPP_LIBRARIES})
|
|
|
|
add_library("${ipp_lib}_imported" STATIC IMPORTED)
|
2013-05-16 22:45:49 +04:00
|
|
|
set_property(TARGET "${ipp_lib}_imported" PROPERTY IMPORTED_LOCATION "${IPP_LIBRARY_DIRS}/${ipp_lib}")
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
set(LIBFREERDP_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(LIBFREERDP_SRCS "")
|
|
|
|
set(LIBFREERDP_LIBS "")
|
|
|
|
set(LIBFREERDP_INCLUDES "")
|
|
|
|
set(LIBFREERDP_DEFINITIONS "")
|
|
|
|
|
|
|
|
macro (freerdp_module_add)
|
2015-07-31 12:35:54 +03:00
|
|
|
file (RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
foreach (_src ${ARGN})
|
|
|
|
if (_relPath)
|
|
|
|
list (APPEND LIBFREERDP_SRCS "${_relPath}/${_src}")
|
|
|
|
else()
|
|
|
|
list (APPEND LIBFREERDP_SRCS "${_src}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (_relPath)
|
|
|
|
set (LIBFREERDP_SRCS ${LIBFREERDP_SRCS} PARENT_SCOPE)
|
|
|
|
endif()
|
2014-09-12 02:19:53 +04:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro (freerdp_include_directory_add)
|
2015-07-31 12:35:54 +03:00
|
|
|
file (RELATIVE_PATH _relPath "${LIBFREERDP_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
foreach (_inc ${ARGN})
|
2014-09-12 02:19:53 +04:00
|
|
|
if (IS_ABSOLUTE ${_inc})
|
|
|
|
list (APPEND LIBFREERDP_INCLUDES "${_inc}")
|
|
|
|
else()
|
|
|
|
if (_relPath)
|
|
|
|
list (APPEND LIBFREERDP_INCLUDES "${_relPath}/${_inc}")
|
|
|
|
else()
|
|
|
|
list (APPEND LIBFREERDP_INCLUDES "${_inc}")
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-07-31 12:35:54 +03:00
|
|
|
endforeach()
|
|
|
|
if (_relPath)
|
|
|
|
set (LIBFREERDP_INCLUDES ${LIBFREERDP_INCLUDES} PARENT_SCOPE)
|
|
|
|
endif()
|
2014-09-12 02:19:53 +04:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro (freerdp_library_add)
|
2015-07-31 12:35:54 +03:00
|
|
|
foreach (_lib ${ARGN})
|
|
|
|
list (APPEND LIBFREERDP_LIBS "${_lib}")
|
|
|
|
endforeach()
|
|
|
|
set (LIBFREERDP_LIBS ${LIBFREERDP_LIBS} PARENT_SCOPE)
|
2014-09-12 02:19:53 +04:00
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro (freerdp_definition_add)
|
2015-07-31 12:35:54 +03:00
|
|
|
foreach (_define ${ARGN})
|
|
|
|
list (APPEND LIBFREERDP_DEFINITIONS "${_define}")
|
|
|
|
endforeach()
|
|
|
|
set (LIBFREERDP_DEFINITIONS ${LIBFREERDP_DEFINITIONS} PARENT_SCOPE)
|
2014-09-12 02:19:53 +04:00
|
|
|
endmacro()
|
|
|
|
|
2012-10-05 00:54:16 +04:00
|
|
|
set(${MODULE_PREFIX}_SUBMODULES
|
2012-10-04 03:29:28 +04:00
|
|
|
utils
|
2012-11-18 07:03:04 +04:00
|
|
|
common
|
2012-10-04 03:29:28 +04:00
|
|
|
gdi
|
|
|
|
cache
|
|
|
|
crypto
|
|
|
|
locale
|
|
|
|
core)
|
|
|
|
|
2012-10-05 03:15:44 +04:00
|
|
|
foreach(${MODULE_PREFIX}_SUBMODULE ${${MODULE_PREFIX}_SUBMODULES})
|
2012-10-05 00:54:16 +04:00
|
|
|
add_subdirectory(${${MODULE_PREFIX}_SUBMODULE})
|
2012-10-04 03:29:28 +04:00
|
|
|
endforeach()
|
2012-08-14 07:19:51 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
## cmake source properties are only seen by targets in the same CMakeLists.txt
|
|
|
|
## therefore primitives and codecs need to be defined here
|
|
|
|
|
|
|
|
# codec
|
|
|
|
set(CODEC_SRCS
|
|
|
|
codec/dsp.c
|
|
|
|
codec/color.c
|
|
|
|
codec/audio.c
|
|
|
|
codec/planar.c
|
|
|
|
codec/bitmap.c
|
|
|
|
codec/interleaved.c
|
|
|
|
codec/progressive.c
|
|
|
|
codec/rfx_bitstream.h
|
|
|
|
codec/rfx_constants.h
|
|
|
|
codec/rfx_decode.c
|
|
|
|
codec/rfx_decode.h
|
|
|
|
codec/rfx_differential.c
|
|
|
|
codec/rfx_differential.h
|
|
|
|
codec/rfx_dwt.c
|
|
|
|
codec/rfx_dwt.h
|
|
|
|
codec/rfx_encode.c
|
|
|
|
codec/rfx_encode.h
|
|
|
|
codec/rfx_quantization.c
|
|
|
|
codec/rfx_quantization.h
|
|
|
|
codec/rfx_rlgr.c
|
|
|
|
codec/rfx_rlgr.h
|
|
|
|
codec/rfx_types.h
|
|
|
|
codec/rfx.c
|
|
|
|
codec/region.c
|
|
|
|
codec/nsc.c
|
|
|
|
codec/nsc_encode.c
|
|
|
|
codec/nsc_encode.h
|
|
|
|
codec/nsc_types.h
|
|
|
|
codec/ncrush.c
|
|
|
|
codec/xcrush.c
|
|
|
|
codec/mppc.c
|
|
|
|
codec/zgfx.c
|
|
|
|
codec/clear.c
|
|
|
|
codec/jpeg.c
|
|
|
|
codec/h264.c)
|
|
|
|
|
|
|
|
set(CODEC_SSE2_SRCS
|
|
|
|
codec/rfx_sse2.c
|
|
|
|
codec/rfx_sse2.h
|
|
|
|
codec/nsc_sse2.c
|
|
|
|
codec/nsc_sse2.h)
|
|
|
|
|
|
|
|
set(CODEC_NEON_SRCS
|
|
|
|
codec/rfx_neon.c
|
|
|
|
codec/rfx_neon.h)
|
|
|
|
|
|
|
|
if(WITH_SSE2)
|
|
|
|
set(CODEC_SRCS ${CODEC_SRCS} ${CODEC_SSE2_SRCS})
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "-msse2" )
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
set_source_files_properties(${CODEC_SSE2_SRCS} PROPERTIES COMPILE_FLAGS "/arch:SSE2" )
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_NEON)
|
2015-05-02 00:35:21 +03:00
|
|
|
set_source_files_properties(${CODEC_NEON_SRCS} PROPERTIES COMPILE_FLAGS "-mfpu=neon -Wno-unused-variable" )
|
2014-09-12 02:19:53 +04:00
|
|
|
set(CODEC_SRCS ${CODEC_SRCS} ${CODEC_NEON_SRCS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_JPEG)
|
|
|
|
freerdp_include_directory_add(${JPEG_INCLUDE_DIR})
|
|
|
|
freerdp_library_add(${JPEG_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2015-07-28 23:01:34 +03:00
|
|
|
if(WITH_X264)
|
|
|
|
freerdp_definition_add(-DWITH_X264)
|
|
|
|
freerdp_include_directory_add(${X264_INCLUDE_DIR})
|
|
|
|
freerdp_library_add(${X264_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
if(WITH_OPENH264)
|
|
|
|
freerdp_definition_add(-DWITH_OPENH264)
|
|
|
|
freerdp_include_directory_add(${OPENH264_INCLUDE_DIR})
|
|
|
|
freerdp_library_add(${OPENH264_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_LIBAVCODEC)
|
|
|
|
freerdp_definition_add(-DWITH_LIBAVCODEC)
|
|
|
|
find_library(LIBAVCODEC_LIB avcodec)
|
|
|
|
find_library(LIBAVUTIL_LIB avutil)
|
|
|
|
freerdp_library_add(${LIBAVCODEC_LIB} ${LIBAVUTIL_LIB})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
freerdp_module_add(${CODEC_SRCS})
|
|
|
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
add_subdirectory(codec/test)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# /codec
|
|
|
|
|
|
|
|
# primitives
|
|
|
|
|
|
|
|
set(PRIMITIVES_SRCS
|
|
|
|
primitives/prim_16to32bpp.c
|
|
|
|
primitives/prim_add.c
|
|
|
|
primitives/prim_andor.c
|
|
|
|
primitives/prim_alphaComp.c
|
|
|
|
primitives/prim_colors.c
|
|
|
|
primitives/prim_copy.c
|
|
|
|
primitives/prim_set.c
|
|
|
|
primitives/prim_shift.c
|
|
|
|
primitives/prim_sign.c
|
|
|
|
primitives/prim_YUV.c
|
|
|
|
primitives/prim_YCoCg.c
|
|
|
|
primitives/primitives.c
|
|
|
|
primitives/prim_internal.h)
|
|
|
|
|
|
|
|
set(PRIMITIVES_OPT_SRCS
|
|
|
|
primitives/prim_16to32bpp_opt.c
|
|
|
|
primitives/prim_add_opt.c
|
|
|
|
primitives/prim_andor_opt.c
|
|
|
|
primitives/prim_alphaComp_opt.c
|
|
|
|
primitives/prim_colors_opt.c
|
|
|
|
primitives/prim_set_opt.c
|
|
|
|
primitives/prim_shift_opt.c
|
|
|
|
primitives/prim_sign_opt.c
|
|
|
|
primitives/prim_YUV_opt.c
|
|
|
|
primitives/prim_YCoCg_opt.c)
|
|
|
|
|
|
|
|
freerdp_definition_add(-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
|
|
|
|
|
|
|
### IPP Variable debugging
|
|
|
|
if(WITH_IPP)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
foreach(INCLDIR ${IPP_INCLUDE_DIRS})
|
|
|
|
set(OPTIMIZATION "${OPTIMIZATION} -I${INCLDIR}")
|
|
|
|
endforeach(INCLDIR)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WITH_SSE2)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set(OPTIMIZATION "${OPTIMIZATION} -msse2 -mssse3 -O2 -Wdeclaration-after-statement")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
set(OPTIMIZATION "${OPTIMIZATION} /arch:SSE2")
|
|
|
|
endif()
|
|
|
|
elseif(WITH_NEON)
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
2015-08-19 10:02:20 +03:00
|
|
|
set(OPTIMIZATION "${OPTIMIZATION} -mfpu=neon")
|
2014-09-12 02:19:53 +04:00
|
|
|
endif()
|
|
|
|
# TODO: Add MSVC equivalent
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(DEFINED OPTIMIZATION)
|
|
|
|
set_source_files_properties(${PRIMITIVES_OPT_SRCS} PROPERTIES COMPILE_FLAGS ${OPTIMIZATION})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
# always compile with optimization
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set_source_files_properties(${PRIMITIVES_SRCS} PROPERTIES COMPILE_FLAGS "-O2")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(PRIMITIVES_SRCS ${PRIMITIVES_SRCS} ${PRIMITIVES_OPT_SRCS})
|
|
|
|
|
|
|
|
freerdp_module_add(${PRIMITIVES_SRCS})
|
|
|
|
|
|
|
|
if(IPP_FOUND)
|
|
|
|
freerdp_include_directory_add(${IPP_INCLUDE_DIRS})
|
2015-07-31 12:35:54 +03:00
|
|
|
foreach(ipp_lib ${IPP_LIBRARIES})
|
2014-09-12 02:19:53 +04:00
|
|
|
freerdp_library_add("${ipp_lib}_imported")
|
2012-10-04 03:29:28 +04:00
|
|
|
endforeach()
|
2014-09-12 02:19:53 +04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_TESTING AND NOT WIN32 AND NOT APPLE)
|
|
|
|
add_subdirectory(primitives/test)
|
|
|
|
endif()
|
|
|
|
|
2012-10-04 03:29:28 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
# /primitives
|
2012-08-15 03:55:48 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
list(REMOVE_DUPLICATES LIBFREERDP_DEFINITIONS)
|
|
|
|
list(REMOVE_DUPLICATES LIBFREERDP_LIBS)
|
|
|
|
list(REMOVE_DUPLICATES LIBFREERDP_INCLUDES)
|
|
|
|
include_directories(${LIBFREERDP_INCLUDES})
|
2014-10-03 17:17:40 +04:00
|
|
|
|
|
|
|
# On windows create dll version information.
|
|
|
|
# Vendor, product and year are already set in top level CMakeLists.txt
|
|
|
|
if (WIN32)
|
|
|
|
set (RC_VERSION_MAJOR ${FREERDP_VERSION_MAJOR})
|
|
|
|
set (RC_VERSION_MINOR ${FREERDP_VERSION_MINOR})
|
|
|
|
set (RC_VERSION_BUILD ${FREERDP_VERSION_REVISION})
|
|
|
|
set (RC_VERSION_FILE "${CMAKE_SHARED_LIBRARY_PREFIX}${MODULE_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" )
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_SOURCE_DIR}/cmake/WindowsDLLVersion.rc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.rc
|
|
|
|
@ONLY)
|
|
|
|
|
|
|
|
set (LIBFREERDP_SRCS ${LIBFREERDP_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
|
|
|
endif()
|
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
add_library(${MODULE_NAME} ${LIBFREERDP_SRCS})
|
|
|
|
add_definitions(${LIBFREERDP_DEFINITIONS})
|
2012-08-14 08:31:06 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C)
|
2014-02-11 06:07:05 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
if (WITH_LIBRARY_VERSIONING)
|
2015-08-19 10:02:20 +03:00
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${FREERDP_VERSION} SOVERSION ${FREERDP_API_VERSION})
|
2014-09-12 02:19:53 +04:00
|
|
|
endif()
|
2014-09-15 12:30:07 +04:00
|
|
|
|
2012-10-17 21:07:29 +04:00
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
target_link_libraries(${MODULE_NAME} ${LIBFREERDP_LIBS} winpr)
|
|
|
|
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT FreeRDPTargets)
|
2015-07-31 12:35:54 +03:00
|
|
|
if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS)
|
2015-08-19 10:02:20 +03:00
|
|
|
install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols)
|
2015-07-31 12:35:54 +03:00
|
|
|
endif()
|
|
|
|
|
2014-09-12 02:19:53 +04:00
|
|
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/libfreerdp")
|