2012-08-14 23:49:39 +04:00
|
|
|
# WinPR: Windows Portable Runtime
|
|
|
|
# winpr 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.
|
|
|
|
|
|
|
|
if (APPLE)
|
|
|
|
# flat_namespace should be avoided, but is required for -undefined warning. Since WinPR currently has
|
|
|
|
# a lot of undefined symbols in use, use this hack until they're filled out.
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-flat_namespace,-undefined,warning")
|
|
|
|
endif()
|
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
set(WINPR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
set(WINPR_SRCS "")
|
|
|
|
set(WINPR_LIBS "")
|
|
|
|
set(WINPR_INCLUDES "")
|
|
|
|
set(WINPR_DEFINITIONS "")
|
2012-08-14 23:49:39 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
macro (winpr_module_add)
|
|
|
|
file (RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
|
|
foreach (_src ${ARGN})
|
|
|
|
if (_relPath)
|
|
|
|
list (APPEND WINPR_SRCS "${_relPath}/${_src}")
|
|
|
|
else()
|
|
|
|
list (APPEND WINPR_SRCS "${_src}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
if (_relPath)
|
|
|
|
set (WINPR_SRCS ${WINPR_SRCS} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2012-10-04 03:50:48 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
macro (winpr_include_directory_add)
|
|
|
|
file (RELATIVE_PATH _relPath "${WINPR_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
|
2014-07-10 19:40:27 +04:00
|
|
|
foreach (_inc ${ARGN})
|
|
|
|
if (IS_ABSOLUTE ${_inc})
|
|
|
|
list (APPEND WINPR_INCLUDES "${_inc}")
|
|
|
|
else()
|
|
|
|
if (_relPath)
|
|
|
|
list (APPEND WINPR_INCLUDES "${_relPath}/${_inc}")
|
|
|
|
else()
|
|
|
|
list (APPEND WINPR_INCLUDES "${_inc}")
|
|
|
|
endif()
|
|
|
|
endif()
|
2014-07-10 02:03:20 +04:00
|
|
|
endforeach()
|
|
|
|
if (_relPath)
|
|
|
|
set (WINPR_INCLUDES ${WINPR_INCLUDES} PARENT_SCOPE)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2012-10-04 03:29:28 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
macro (winpr_library_add)
|
|
|
|
foreach (_lib ${ARGN})
|
|
|
|
list (APPEND WINPR_LIBS "${_lib}")
|
|
|
|
endforeach()
|
|
|
|
set (WINPR_LIBS ${WINPR_LIBS} PARENT_SCOPE)
|
|
|
|
endmacro()
|
2012-08-14 23:49:39 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
macro (winpr_definition_add)
|
|
|
|
foreach (_define ${ARGN})
|
|
|
|
list (APPEND WINPR_DEFINITIONS "${_define}")
|
|
|
|
endforeach()
|
|
|
|
set (WINPR_DEFINITIONS ${WINPR_DEFINITIONS} PARENT_SCOPE)
|
|
|
|
endmacro()
|
2012-10-04 03:29:28 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
# Level "1" API as defined for MinCore.lib
|
|
|
|
set(WINPR_CORE synch locale library file comm pipe interlocked security
|
2015-03-05 00:56:48 +03:00
|
|
|
environment crypto registry credentials path io memory input shell
|
2014-07-10 02:03:20 +04:00
|
|
|
heap utils error com timezone sysinfo pool handle thread)
|
2012-10-04 03:29:28 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
foreach(DIR ${WINPR_CORE})
|
|
|
|
add_subdirectory(${DIR})
|
|
|
|
endforeach()
|
2012-08-15 03:55:48 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
set(WINPR_LEVEL2 winsock sspi winhttp asn1 sspicli crt bcrypt rpc credui
|
2014-10-17 23:19:05 +04:00
|
|
|
wtsapi dsparse wnd smartcard nt clipboard)
|
2012-08-14 23:49:39 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
foreach(DIR ${WINPR_LEVEL2})
|
|
|
|
add_subdirectory(${DIR})
|
|
|
|
endforeach()
|
2013-07-26 05:59:21 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
set(MODULE_NAME winpr)
|
|
|
|
list(REMOVE_DUPLICATES WINPR_DEFINITIONS)
|
|
|
|
list(REMOVE_DUPLICATES WINPR_LIBS)
|
|
|
|
list(REMOVE_DUPLICATES WINPR_INCLUDES)
|
|
|
|
include_directories(${WINPR_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 ${WINPR_VERSION_MAJOR})
|
|
|
|
set (RC_VERSION_MINOR ${WINPR_VERSION_MINOR})
|
|
|
|
set (RC_VERSION_BUILD ${WINPR_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 (WINPR_SRCS ${WINPR_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
|
|
|
|
endif()
|
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
add_library(${MODULE_NAME} ${WINPR_SRCS})
|
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C)
|
2014-04-29 11:42:18 +04:00
|
|
|
if (WITH_LIBRARY_VERSIONING)
|
|
|
|
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION})
|
|
|
|
endif()
|
2014-09-15 12:30:07 +04:00
|
|
|
|
2014-07-10 02:03:20 +04:00
|
|
|
add_definitions(${WINPR_DEFINITIONS})
|
|
|
|
target_link_libraries(${MODULE_NAME} ${WINPR_LIBS})
|
|
|
|
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets)
|
|
|
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/libwinpr")
|