diff --git a/server/shadow/CMakeLists.txt b/server/shadow/CMakeLists.txt index 73427d8f7..55597dbf8 100644 --- a/server/shadow/CMakeLists.txt +++ b/server/shadow/CMakeLists.txt @@ -74,7 +74,7 @@ add_library(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) list(APPEND ${MODULE_PREFIX}_LIBS freerdp) list(APPEND ${MODULE_PREFIX}_LIBS freerdp-server) list(APPEND ${MODULE_PREFIX}_LIBS winpr) -list(APPEND ${MODULE_PREFIX}_LIBS winpr-makecert-tool) +list(APPEND ${MODULE_PREFIX}_LIBS winpr-tools) list(APPEND ${MODULE_PREFIX}_LIBS rdtk) target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${${MODULE_PREFIX}_LIBS}) diff --git a/winpr/.gitignore b/winpr/.gitignore index c2fee8dd4..487041de6 100644 --- a/winpr/.gitignore +++ b/winpr/.gitignore @@ -1,2 +1 @@ -tools/hash/winpr-hash tools/reg/winpr-reg diff --git a/winpr/tools/.gitignore b/winpr/tools/.gitignore new file mode 100644 index 000000000..daf12636c --- /dev/null +++ b/winpr/tools/.gitignore @@ -0,0 +1,2 @@ +makecert-cli/winpr-makecert +hash-cli/winpr-hash diff --git a/winpr/tools/CMakeLists.txt b/winpr/tools/CMakeLists.txt index f1aa6f6a6..f792a9b14 100644 --- a/winpr/tools/CMakeLists.txt +++ b/winpr/tools/CMakeLists.txt @@ -2,6 +2,7 @@ # winpr cmake build script # # Copyright 2012 Marc-Andre Moreau +# Copyright 2016 Thincast Technologies GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,6 +16,110 @@ # See the License for the specific language governing permissions and # limitations under the License. -add_subdirectory(hash) +# Soname versioning - use winpr version +set(WINPR_TOOLS_VERSION_MAJOR "${WINPR_VERSION_MAJOR}") +set(WINPR_TOOLS_VERSION_MINOR "${WINPR_VERSION_MINOR}") +set(WINPR_TOOLS_VERSION_REVISION "${WINPR_VERSION_REVISION}") + +set(WINPR_TOOLS_API_VERSION "${WINPR_TOOLS_VERSION_MAJOR}") +set(WINPR_TOOLS_VERSION "${WINPR_TOOLS_VERSION_MAJOR}.${WINPR_TOOLS_VERSION_MINOR}.${WINPR_TOOLS_VERSION_REVISION}") +set(WINPR_TOOLS_VERSION_FULL "${WINPR_TOOLS_VERSION}") +set(WINPR_TOOLS_API_VERSION "${WINPR_TOOLS_VERSION_MAJOR}") + +set(WINPR_TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(WINPR_TOOLS_SRCS "") +set(WINPR_TOOLS_LIBS "") +set(WINPR_TOOLS_INCLUDES "") +set(WINPR_TOOLS_DEFINITIONS "") + +macro (winpr_tools_module_add) + file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_src ${ARGN}) + if (_relPath) + list (APPEND WINPR_TOOLS_SRCS "${_relPath}/${_src}") + else() + list (APPEND WINPR_TOOLS_SRCS "${_src}") + endif() + endforeach() + if (_relPath) + set (WINPR_TOOLS_SRCS ${WINPR_TOOLS_SRCS} PARENT_SCOPE) + endif() +endmacro() + +macro (winpr_tools_include_directory_add) + file (RELATIVE_PATH _relPath "${WINPR_TOOLS_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}") + foreach (_inc ${ARGN}) + if (IS_ABSOLUTE ${_inc}) + list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") + else() + if (_relPath) + list (APPEND WINPR_TOOLS_INCLUDES "${_relPath}/${_inc}") + else() + list (APPEND WINPR_TOOLS_INCLUDES "${_inc}") + endif() + endif() + endforeach() + if (_relPath) + set (WINPR_TOOLS_INCLUDES ${WINPR_TOOLS_INCLUDES} PARENT_SCOPE) + endif() +endmacro() + +macro (winpr_tools_library_add) + foreach (_lib ${ARGN}) + list (APPEND WINPR_TOOLS_LIBS "${_lib}") + endforeach() + set (WINPR_TOOLS_LIBS ${WINPR_TOOLS_LIBS} PARENT_SCOPE) +endmacro() + +macro (winpr_tools_definition_add) + foreach (_define ${ARGN}) + list (APPEND WINPR_TOOLS_DEFINITONS "${_define}") + endforeach() + set (WINPR_TOOLS_DEFINITONS ${WINPR_TOOLS_DEFINITONS} PARENT_SCOPE) +endmacro() + add_subdirectory(makecert) +set(MODULE_NAME winpr-tools) +list(REMOVE_DUPLICATES WINPR_TOOLS_DEFINITIONS) +list(REMOVE_DUPLICATES WINPR_TOOLS_LIBS) +list(REMOVE_DUPLICATES WINPR_TOOLS_INCLUDES) +include_directories(${WINPR_TOOLS_INCLUDES}) + +# 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_TOOLS_SRCS ${WINPR_TOOLS_SRCS} ${CMAKE_CURRENT_BINARY_DIR}/version.rc) +endif() + +add_library(${MODULE_NAME} ${WINPR_TOOLS_SRCS}) +set_target_properties(${MODULE_NAME} PROPERTIES LINKER_LANGUAGE C) +if (WITH_LIBRARY_VERSIONING) + set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_TOOLS_VERSION} SOVERSION ${WINPR_TOOLS_API_VERSION}) +endif() + +add_definitions(${WINPR_DEFINITIONS}) +target_link_libraries(${MODULE_NAME} ${PRIVATE_KEYWORD} ${WINPR_TOOLS_LIBS}) + +install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets) +if (WITH_DEBUG_SYMBOLS AND MSVC AND BUILD_SHARED_LIBS) + install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT symbols) +endif() +set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") + +# Add all command line utilities +add_subdirectory(makecert-cli) +add_subdirectory(hash-cli) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/winpr-tools.pc.in ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/winpr-tools${WINPR_TOOLS_VERSION_MAJOR}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) diff --git a/winpr/tools/hash/CMakeLists.txt b/winpr/tools/hash-cli/CMakeLists.txt similarity index 100% rename from winpr/tools/hash/CMakeLists.txt rename to winpr/tools/hash-cli/CMakeLists.txt diff --git a/winpr/tools/hash/hash.c b/winpr/tools/hash-cli/hash.c similarity index 100% rename from winpr/tools/hash/hash.c rename to winpr/tools/hash-cli/hash.c diff --git a/winpr/tools/makecert/cli/CMakeLists.txt b/winpr/tools/makecert-cli/CMakeLists.txt similarity index 95% rename from winpr/tools/makecert/cli/CMakeLists.txt rename to winpr/tools/makecert-cli/CMakeLists.txt index f175e72d5..afc17daca 100644 --- a/winpr/tools/makecert/cli/CMakeLists.txt +++ b/winpr/tools/makecert-cli/CMakeLists.txt @@ -2,6 +2,7 @@ # winpr-makecert cmake build script # # Copyright 2012 Marc-Andre Moreau +# Copyright 2016 Thincast Technologies GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -18,8 +19,6 @@ set(MODULE_NAME "winpr-makecert") set(MODULE_PREFIX "WINPR_MAKECERT") -include_directories(..) - set(${MODULE_PREFIX}_SRCS main.c) @@ -41,7 +40,7 @@ endif() add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS}) -set(${MODULE_PREFIX}_LIBS winpr-makecert-tool) +set(${MODULE_PREFIX}_LIBS winpr-tools) target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) @@ -51,4 +50,3 @@ install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT too if (WITH_DEBUG_SYMBOLS AND MSVC) install(FILES ${CMAKE_PDB_BINARY_DIR}/${MODULE_NAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT symbols) endif() - diff --git a/winpr/tools/makecert/cli/main.c b/winpr/tools/makecert-cli/main.c similarity index 100% rename from winpr/tools/makecert/cli/main.c rename to winpr/tools/makecert-cli/main.c diff --git a/winpr/tools/makecert/.gitignore b/winpr/tools/makecert/.gitignore index e46d9e979..275ece245 100644 --- a/winpr/tools/makecert/.gitignore +++ b/winpr/tools/makecert/.gitignore @@ -1,4 +1,2 @@ -winpr-makecert *.key *.crt - diff --git a/winpr/tools/makecert/CMakeLists.txt b/winpr/tools/makecert/CMakeLists.txt index 3e021e033..89f7af95c 100644 --- a/winpr/tools/makecert/CMakeLists.txt +++ b/winpr/tools/makecert/CMakeLists.txt @@ -21,16 +21,15 @@ set(MODULE_PREFIX "WINPR_MAKECERT_TOOL") set(${MODULE_PREFIX}_SRCS makecert.c) if(OPENSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) + winpr_tools_include_directory_add(${OPENSSL_INCLUDE_DIR}) endif() if(MBEDTLS_FOUND) - include_directories(${MBEDTLS_INCLUDE_DIR}) + winpr_tools_include_directory_add(${MBEDTLS_INCLUDE_DIR}) endif() -add_library(${MODULE_NAME} STATIC ${${MODULE_PREFIX}_SRCS}) -set(${MODULE_PREFIX}_LIBS winpr) +winpr_tools_module_add(${${MODULE_PREFIX}_SRCS}) if(OPENSSL_FOUND) if(WIN32) @@ -46,11 +45,5 @@ if(MBEDTLS_FOUND) list(APPEND ${MODULE_PREFIX}_LIBS ${MBEDTLS_LIBRARIES}) endif() -target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS}) -install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries EXPORT WinPRTargets) - -add_subdirectory(cli) - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR/Tools") -export_complex_library(LIBNAME ${MODULE_NAME}) +winpr_tools_library_add(${${MODULE_PREFIX}_LIBS} winpr) diff --git a/winpr/tools/winpr-tools.pc.in b/winpr/tools/winpr-tools.pc.in new file mode 100644 index 000000000..cd05c9a61 --- /dev/null +++ b/winpr/tools/winpr-tools.pc.in @@ -0,0 +1,15 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=${prefix}/@WINPR_INCLUDE_DIR@ +libs=-lwinpr-tools + +Name: WinPR +Description: WinPR: Windows Portable Runtime +URL: http://www.freerdp.com/ +Version: @WINPR_TOOLS_VERSION@ +Requires: +Requires.private: winpr@WINPR_VERSION_MAJOR@ libssl +Libs: -L${libdir} ${libs} +Libs.private: -lcrypto +Cflags: -I${includedir}