-
Notifications
You must be signed in to change notification settings - Fork 38
/
CMakeLists.txt
109 lines (86 loc) · 3.74 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#-------------------------------------------------------------------------------------------
# Copyright (C) Electronic Arts Inc. All rights reserved.
#-------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.1)
project(EACopy CXX)
# NOTE: Only used in multi-configuration environments
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "My multi config types" FORCE)
#-------------------------------------------------------------------------------------------
# Options
#-------------------------------------------------------------------------------------------
option(EACOPY_BUILD_TESTS "Enable generation of build files for tests" OFF)
if (WIN32)
SET(CMAKE_CXX_FLAGS "/GR-")
endif(WIN32)
if (UNIX)
find_package (Threads)
endif (UNIX)
#-------------------------------------------------------------------------------------------
# Zstd
#-------------------------------------------------------------------------------------------
set(ZSTD_BUILD_PROGRAMS OFF)
set(ZSTD_BUILD_SHARED OFF)
set(ZSTD_BUILD_TESTS OFF)
set(ZSTD_STATIC_LINKING_ONLY ON)
add_subdirectory(external/zstd/build/cmake)
if (WIN32)
target_compile_options(libzstd_static PUBLIC "$<$<CONFIG:RELEASE>:/Oi>")
endif(WIN32)
#-------------------------------------------------------------------------------------------
# lzma
#-------------------------------------------------------------------------------------------
add_subdirectory(external/lzma)
if (WIN32)
target_compile_options(lzma PUBLIC "$<$<CONFIG:RELEASE>:/Oi>")
endif(WIN32)
#-------------------------------------------------------------------------------------------
# xdelta
#-------------------------------------------------------------------------------------------
add_compile_definitions(SIZEOF_SIZE_T=8 SIZEOF_UNSIGNED_LONG_LONG=8 _WIN32=1 XD3_USE_LARGEFILE64=1 SECONDARY_DJW=1 SECONDARY_LZMA=1 SECONDARY_FGK=1 XD3_WIN32=1 LZMA_API_STATIC)
add_subdirectory(external/xdelta)
target_include_directories(xdelta PRIVATE external/lzma/liblzma/api)
if (WIN32)
target_compile_options(xdelta PUBLIC "$<$<CONFIG:RELEASE>:/Oi>")
endif(WIN32)
#-------------------------------------------------------------------------------------------
# Library definitions
#-------------------------------------------------------------------------------------------
set(EACOPY_EXTERNAL_LIBS libzstd_static xdelta lzma)
set(EACOPY_SHARED_FILES
${CMAKE_CURRENT_SOURCE_DIR}/include/EACopyNetwork.h
${CMAKE_CURRENT_SOURCE_DIR}/source/EACopyNetwork.cpp
${CMAKE_CURRENT_SOURCE_DIR}/include/EACopyShared.h
${CMAKE_CURRENT_SOURCE_DIR}/source/EACopyShared.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/Addition.manifest)
add_definitions(-DEACOPY_ALLOW_DELTA_COPY)
set(EACOPY_SHARED_FILES
${EACOPY_SHARED_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/include/EACopyDelta.h
${CMAKE_CURRENT_SOURCE_DIR}/source/EACopyDelta.cpp
${CMAKE_CURRENT_SOURCE_DIR}/source/EACopyDeltaZstd.h
${CMAKE_CURRENT_SOURCE_DIR}/source/EACopyDeltaXDelta.h)
add_executable(EACopy
source/EACopy.cpp
include/EACopyClient.h
source/EACopyClient.cpp
${EACOPY_SHARED_FILES})
target_include_directories(EACopy PUBLIC include)
if (WIN32)
target_link_libraries(EACopy ${EACOPY_EXTERNAL_LIBS})
endif(WIN32)
if (UNIX)
target_link_libraries(EACopy ${EACOPY_EXTERNAL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
endif (UNIX)
if (WIN32)
add_executable(EACopyService
source/EACopyService.cpp
include/EACopyServer.h
source/EACopyServer.cpp
${EACOPY_SHARED_FILES})
target_include_directories(EACopyService PUBLIC include)
target_link_libraries(EACopyService ${EACOPY_EXTERNAL_LIBS})
endif(WIN32)
if(EACOPY_BUILD_TESTS)
include(CTest)
add_subdirectory(test)
endif()