mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 09:54:26 +08:00
[cmake] move platform defines to common include
* Move platform specific settings to a common CMake include
This commit is contained in:
parent
15cf6b26b1
commit
f4b7c59915
@ -59,12 +59,6 @@ endif()
|
||||
# Include our extra modules
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/)
|
||||
|
||||
if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0"))
|
||||
set(UWP 1)
|
||||
add_definitions("-D_UWP")
|
||||
set(CMAKE_WINDOWS_VERSION "WIN10")
|
||||
endif()
|
||||
|
||||
# Check for cmake compatibility (enable/disable features)
|
||||
include(CheckCmakeCompat)
|
||||
|
||||
@ -214,16 +208,6 @@ if(FREEBSD)
|
||||
find_library(EPOLLSHIM_LIBS NAMES epoll-shim libepoll-shim HINTS /usr/local/lib)
|
||||
endif()
|
||||
|
||||
# Enable 64bit file support on linux and FreeBSD.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR FREEBSD)
|
||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
|
||||
# Use Standard conforming getpwnam_r() on Solaris.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
|
||||
add_definitions("-D_POSIX_PTHREAD_SEMANTICS")
|
||||
endif()
|
||||
|
||||
# Compiler-specific flags
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
|
||||
|
@ -28,6 +28,7 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "project default")
|
||||
endif()
|
||||
|
||||
include(PlatformDefaults)
|
||||
include(PreventInSourceBuilds)
|
||||
include(GNUInstallDirsWrapper)
|
||||
include(MSVCRuntime)
|
||||
|
23
cmake/PlatformDefaults.cmake
Normal file
23
cmake/PlatformDefaults.cmake
Normal file
@ -0,0 +1,23 @@
|
||||
# default defines or other required preferences per platform
|
||||
if((CMAKE_SYSTEM_NAME MATCHES "WindowsStore") AND (CMAKE_SYSTEM_VERSION MATCHES "10.0"))
|
||||
set(UWP 1 CACHE BOOL "platform default")
|
||||
add_definitions("-D_UWP")
|
||||
set(CMAKE_WINDOWS_VERSION "WIN10" CACHE STRING "platform default")
|
||||
endif()
|
||||
# Enable 64bit file support on linux and FreeBSD.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
|
||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES FREEBSD)
|
||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
|
||||
# Use Standard conforming getpwnam_r() on Solaris.
|
||||
# Use Standard conforming getpwnam_r() on Solaris.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "SunOS")
|
||||
add_definitions("-D_POSIX_PTHREAD_SEMANTICS")
|
||||
list(APPEND CMAKE_STANDARD_LIBRARIES rt)
|
||||
set(CMAKE_STANDARD_LIBRARIES ${CMAKE_STANDARD_LIBRARIES} CACHE STRING "platform default")
|
||||
set(WITH_SUN true CACHE BOOL "platform default")
|
||||
endif()
|
@ -47,10 +47,6 @@ if(WIN32)
|
||||
freerdp_library_add(cfgmgr32)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
|
||||
freerdp_library_add(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
@ -323,11 +323,6 @@ endif()
|
||||
|
||||
add_definitions(-DWINPR_EXPORTS)
|
||||
|
||||
# Enable 64bit file support on linux and FreeBSD.
|
||||
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux" OR FREEBSD)
|
||||
add_definitions("-D_FILE_OFFSET_BITS=64")
|
||||
endif()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
|
||||
|
||||
|
@ -36,14 +36,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <malloc/malloc.h>
|
||||
#elif defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
#include "../log.h"
|
||||
#define TAG WINPR_TAG("crt")
|
||||
|
||||
@ -108,7 +100,7 @@ void* winpr_aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
|
||||
/* malloc size + alignment to make sure we can align afterwards */
|
||||
#if defined(_ISOC11_SOURCE)
|
||||
base = aligned_alloc(alignment, alignsize);
|
||||
#elif _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600
|
||||
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) || (_XOPEN_SOURCE >= 600)
|
||||
if (posix_memalign(&base, alignment, alignsize) != 0)
|
||||
return NULL;
|
||||
#else
|
||||
|
@ -18,6 +18,3 @@
|
||||
|
||||
winpr_module_add(handle.c handle.h nonehandle.c nonehandle.h)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
|
||||
winpr_library_add_private(rt)
|
||||
endif()
|
||||
|
@ -21,10 +21,6 @@ winpr_library_add_private(
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${CMAKE_DL_LIBS})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
|
||||
winpr_library_add_private(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
@ -30,10 +30,6 @@ winpr_library_add_private(
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${CMAKE_DL_LIBS})
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
|
||||
winpr_library_add_private(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
@ -25,10 +25,6 @@ winpr_module_add(
|
||||
thread.h
|
||||
tls.c)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES SunOS)
|
||||
winpr_library_add_private(rt)
|
||||
endif()
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user