forked from ladislav-zezula/CascLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
153 lines (132 loc) · 4.57 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
cmake_minimum_required(VERSION 2.6)
project(CascLib)
set(HEADER_FILES
src/CascCommon.h
src/CascLib.h
src/CascPort.h
src/common/Array.h
src/common/Common.h
src/common/Csv.h
src/common/FileStream.h
src/common/FileTree.h
src/common/ListFile.h
src/common/Map.h
src/jenkins/lookup.h
)
set(SRC_FILES
src/common/Common.cpp
src/common/Directory.cpp
src/common/Csv.cpp
src/common/FileStream.cpp
src/common/FileTree.cpp
src/common/ListFile.cpp
src/common/Map.cpp
src/common/RootHandler.cpp
src/jenkins/lookup3.c
src/CascCommon.cpp
src/CascDecompress.cpp
src/CascDecrypt.cpp
src/CascDumpData.cpp
src/CascFiles.cpp
src/CascFindFile.cpp
src/CascOpenFile.cpp
src/CascOpenStorage.cpp
src/CascReadFile.cpp
src/CascRootFile_Diablo3.cpp
src/CascRootFile_MNDX.cpp
src/CascRootFile_Text.cpp
src/CascRootFile_TVFS.cpp
src/CascRootFile_OW.cpp
src/CascRootFile_WoW6.cpp
)
set(TOMCRYPT_FILES
src/libtomcrypt/src/hashes/hash_memory.c
src/libtomcrypt/src/hashes/md5.c
src/libtomcrypt/src/misc/crypt_argchk.c
src/libtomcrypt/src/misc/crypt_hash_descriptor.c
src/libtomcrypt/src/misc/crypt_hash_is_valid.c
src/libtomcrypt/src/misc/crypt_libc.c
)
set(ZLIB_FILES
src/zlib/adler32.c
src/zlib/crc32.c
src/zlib/inffast.c
src/zlib/inflate.c
src/zlib/inftrees.c
src/zlib/zutil.c
)
set(TEST_SRC_FILES
test/CascTest.cpp
)
add_definitions(-D_7ZIP_ST -DBZ_STRICT_ANSI)
if(WIN32)
if(MSVC)
message(STATUS "Using MSVC")
add_definitions(-D_7ZIP_ST)
else()
message(STATUS "Using mingw")
endif()
set(SRC_ADDITIONAL_FILES ${ZLIB_FILES} ${TOMCRYPT_FILES})
set(LINK_LIBS wininet)
endif()
if(APPLE)
message(STATUS "Using Mac OS X port")
set(LINK_LIBS z bz2)
set(SRC_ADDITIONAL_FILES ${TOMCRYPT_FILES})
endif()
if (${CMAKE_SYSTEM_NAME} STREQUAL Linux)
message(STATUS "Using Linux port")
option(WITH_LIBTOMCRYPT "Use system LibTomCrypt library" OFF)
if(WITH_LIBTOMCRYPT)
set(LINK_LIBS tomcrypt)
else()
set(LINK_LIBS)
set(SRC_ADDITIONAL_FILES ${ZLIB_FILES} ${TOMCRYPT_FILES})
endif()
endif()
option(CASC_BUILD_SHARED_LIB "Compile dynamically linked library" ON)
if(CASC_BUILD_SHARED_LIB)
message(STATUS "Build dynamically linked library")
add_library(casc SHARED ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc ${LINK_LIBS})
install(TARGETS casc RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
# On Win32, build CascLib.dll
if(WIN32)
set_target_properties(casc PROPERTIES OUTPUT_NAME CascLib)
endif()
if(APPLE)
set_target_properties(casc PROPERTIES FRAMEWORK true)
set_target_properties(casc PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
set_target_properties(casc PROPERTIES LINK_FLAGS "-framework Carbon")
endif()
if(UNIX)
set_target_properties(casc PROPERTIES VERSION 1.0.0)
set_target_properties(casc PROPERTIES SOVERSION 1)
endif()
endif()
option(CASC_BUILD_TESTS "Build Test application" OFF)
if(CASC_BUILD_TESTS)
set(CASC_BUILD_STATIC_LIB ON CACHE BOOL "Force Static library building to link test app")
message(STATUS "Build Test application")
add_executable(casc_test ${TEST_SRC_FILES})
target_link_libraries(casc_test casc_static)
install(TARGETS casc_test RUNTIME DESTINATION bin)
endif()
option(CASC_BUILD_STATIC_LIB "Build static linked library" OFF)
if(CASC_BUILD_STATIC_LIB)
message(STATUS "Build static linked library")
add_library(casc_static STATIC ${SRC_FILES} ${HEADER_FILES} ${SRC_ADDITIONAL_FILES})
target_link_libraries(casc_static ${LINK_LIBS})
set_target_properties(casc_static PROPERTIES OUTPUT_NAME casc)
install(TARGETS casc_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} FRAMEWORK DESTINATION /Library/Frameworks)
if(APPLE)
set_target_properties(casc_static PROPERTIES FRAMEWORK true)
set_target_properties(casc_static PROPERTIES PUBLIC_HEADER "src/CascLib.h src/CascPort.h")
set_target_properties(casc_static PROPERTIES LINK_FLAGS "-framework Carbon")
endif()
if(UNIX)
set_target_properties(casc_static PROPERTIES VERSION 1.0.0)
set_target_properties(casc_static PROPERTIES SOVERSION 1)
endif()
endif()
install(FILES src/CascLib.h src/CascPort.h DESTINATION include)