forked from TESSkyblivion/skyblivion-niflib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
150 lines (124 loc) · 4.25 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
cmake_minimum_required (VERSION 2.8.12)
project ( niflib )
#It seems Cmake does not set default build type so we force it
if( NOT CMAKE_BUILD_TYPE )
set( CMAKE_BUILD_TYPE Debug CACHE STRING "Debug" FORCE )
endif()
# Fix for wrong scoping from the main project
if (MSVC)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(/MTd)
else()
add_definitions(/MT)
endif()
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
message(STATUS "detected Win64 build, adding /bigobj")
add_definitions(/bigobj)
endif()
endif()
include_directories(${PROJECT_SOURCE_DIR}/lib/v-hacd/src/VHACD_Lib/public )
add_subdirectory(lib/mikktspace)
add_subdirectory(lib/v-hacd/src)
#include_directories(${PROJECT_SOURCE_DIR}/lib/mikktspace )
#include_directories(${PROJECT_SOURCE_DIR}/lib/eigen )
#include_directories(${PROJECT_SOURCE_DIR}/lib/libigl/include )
#include_directories(${PROJECT_SOURCE_DIR}/lib/bounding-mesh/src/boundingmesh )
add_subdirectory(test)
add_custom_target(
check_niflib
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/gen/checknifxml.cmake
DEPENDS
${PROJECT_SOURCE_DIR}/gen/nifxml/nif.xml
COMMENT "Checking if NIF.XML is changed"
WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/gen
SOURCES
${PROJECT_SOURCE_DIR}/gen/nifxml/nif.xml
)
include_directories(${PROJECT_SOURCE_DIR}/include )
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF)
message(STATUS "BUILDING PROJECT niflib")
message(STATUS "SOURCE DIR IS: " ${PROJECT_SOURCE_DIR})
if (MSVC)
message(STATUS "Lowering warning level to W3")
add_definitions(/W3)
message(STATUS "Adding MSVC parallel build")
add_definitions(/MP)
endif()
set(sources
src/BSComplexShape.cpp
src/ComplexShape.cpp
src/half.cpp
src/Inertia.cpp
src/kfm.cpp
src/MatTexCollection.cpp
src/niflib.cpp
src/nifqhull.cpp
src/NIF_IO.cpp
src/nif_math.cpp
src/ObjectRegistry.cpp
src/RefObject.cpp
src/Type.cpp
src/nif_members_expr.cpp
)
set(custom_types
src/custom_types/BSVertexData.cpp
src/custom_types/BSVertexDesc.cpp
)
set(interfaces
src/interfaces/interpolators.cpp
src/interfaces/misc.cpp
)
#Game-Specific Documentation
set(game_specific
include/game_specific/skyrim.h
include/game_specific/oblivion.h
)
if(EXISTS ${PROJECT_SOURCE_DIR}/sources.cmake)
include("sources.cmake")
else()
message(STATUS "Generating sources...")
execute_process(COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/gen/checknifxml.cmake
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/gen
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_ver)
message(STATUS "Done: " + ${git_result})
include("sources.cmake")
endif()
source_group(Core FILES ${sources})
source_group(CustomTypes FILES ${custom_types})
source_group(Interfaces FILES ${interfaces})
source_group(GeneratedMisc FILES ${misc})
source_group(GeneratedCompounds FILES ${compounds})
source_group(GeneratedObjects FILES ${niobjects})
source_group(GameSpecifics FILES ${game_specific})
add_library(niflib ${sources} ${custom_types} ${misc} ${compounds} ${niobjects} ${interfaces} ${game_specific} ${PROJECT_SOURCE_DIR}/README.md ${PROJECT_SOURCE_DIR}/LICENSE.md)
add_dependencies(niflib check_niflib)
if (NOT BUILD_SHARED_LIBS)
target_compile_definitions(niflib PUBLIC "NIFLIB_STATIC_LINK")
endif()
target_compile_definitions(niflib PUBLIC "_CRT_SECURE_NO_DEPRECATE")
target_compile_definitions(niflib PUBLIC "_CRT_NONSTDC_NO_DEPRECATE")
target_compile_definitions(niflib PUBLIC "_SCL_SECURE_NO_WARNINGS")
############################################################################
#Documentation
############################################################################
find_package(Doxygen)
if(BUILD_DOCUMENTATION)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
endif()
set(doxyfile_in ${PROJECT_SOURCE_DIR}/doc/niflib.doxygen)
set(doxyfile ${PROJECT_SOURCE_DIR}/build)
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
message("Doxygen build started.")
add_custom_target(
doc ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile_in}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/doc
COMMENT "Generating API documentation with Doxygen"
VERBATIM
)
# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
endif()