forked from StrataSource/VTFLib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
91 lines (78 loc) · 2.56 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
cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0091 NEW)
project(vtflib C CXX)
option(VTFLIB_STATIC "If enabled, builds VTFLIB as a static library" ON)
option(VTFLIB_SHARED "If enabled, builds VTFLIB as a shared library" ON)
set(CMAKE_CXX_STANDARD 17)
include_directories(thirdparty/include thirdparty/miniz)
if (UNIX)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
endif()
# MT/MTd specification for Windows
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#
# VTFLIB
#
set(VTFLIB_SRCS
VTFLib/Resource.rc
VTFLib/Error.cpp
VTFLib/FileReader.cpp
VTFLib/FileWriter.cpp
VTFLib/Float16.cpp
VTFLib/MemoryReader.cpp
VTFLib/MemoryWriter.cpp
VTFLib/Proc.cpp
VTFLib/ProcReader.cpp
VTFLib/ProcWriter.cpp
VTFLib/VMTFile.cpp
VTFLib/VMTGroupNode.cpp
VTFLib/VMTIntegerNode.cpp
VTFLib/VMTNode.cpp
VTFLib/VMTSingleNode.cpp
VTFLib/VMTStringNode.cpp
VTFLib/VMTValueNode.cpp
VTFLib/VMTWrapper.cpp
VTFLib/VTFFile.cpp
VTFLib/VTFLib.cpp
VTFLib/VTFMathlib.cpp
VTFLib/VTFWrapper.cpp
# Miniz sources
thirdparty/miniz/miniz.c)
if (VTFLIB_STATIC)
add_library(vtflib_static STATIC ${VTFLIB_SRCS})
target_compile_definitions(vtflib_static PUBLIC VTFLIB_STATIC)
endif()
if (VTFLIB_SHARED)
add_library(vtflib SHARED ${VTFLIB_SRCS})
endif()
# Link against compressonator libs & set runtime lib
if (UNIX)
if (VTFLIB_SHARED)
target_link_directories(vtflib PUBLIC thirdparty/lib/x64)
target_link_libraries(vtflib PUBLIC CMP_Compressonator pthread)
endif()
if (VTFLIB_STATIC)
target_link_directories(vtflib_static PUBLIC thirdparty/lib/x64)
target_link_libraries(vtflib_static PUBLIC CMP_Compressonator pthread)
endif()
else()
if (VTFLIB_SHARED)
target_link_directories(vtflib PUBLIC thirdparty/lib)
target_link_libraries(vtflib PUBLIC "Compressonator_MT$<$<CONFIG:Debug>:d>")
endif()
if (VTFLIB_STATIC)
target_link_libraries(vtflib_static PUBLIC "Compressonator_MT$<$<CONFIG:Debug>:d>")
target_link_directories(vtflib_static PUBLIC thirdparty/lib)
endif()
endif()
if (VTFLIB_SHARED)
target_compile_definitions(vtflib PRIVATE VTFLIB_EXPORTS)
target_precompile_headers(vtflib PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/VTFLib/stdafx.h>")
target_include_directories(vtflib PUBLIC lib)
endif()
if (VTFLIB_STATIC)
target_compile_definitions(vtflib_static PRIVATE VTFLIB_EXPORTS)
target_precompile_headers(vtflib_static PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CMAKE_CURRENT_SOURCE_DIR}/VTFLib/stdafx.h>")
target_include_directories(vtflib_static PUBLIC lib)
endif()