summaryrefslogtreecommitdiffstats
path: root/tests/Generating/CMakeLists.txt
blob: 31cfc5c24e44a534466ad11decdfdda9120cb901 (plain) (blame)
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
cmake_minimum_required(VERSION 3.0.2)
enable_testing()

include_directories(${CMAKE_SOURCE_DIR}/src/)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_definitions(-DTEST_GLOBALS=1)

set (SHARED_SRCS
	${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
	${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
	${CMAKE_SOURCE_DIR}/src/Cuboid.cpp
	${CMAKE_SOURCE_DIR}/src/ChunkData.cpp
	${CMAKE_SOURCE_DIR}/src/StringCompression.cpp
	${CMAKE_SOURCE_DIR}/src/StringUtils.cpp

	${CMAKE_SOURCE_DIR}/src/Bindings/LuaState.cpp

	${CMAKE_SOURCE_DIR}/src/Generating/ChunkDesc.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/PiecePool.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/Prefab.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/PrefabPiecePool.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/VerticalLimit.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/VerticalStrategy.cpp

	${CMAKE_SOURCE_DIR}/src/Noise/Noise.cpp

	${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
	${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp
	${CMAKE_SOURCE_DIR}/src/OSSupport/File.cpp
	${CMAKE_SOURCE_DIR}/src/OSSupport/GZipFile.cpp
	${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.cpp
	${CMAKE_SOURCE_DIR}/src/OSSupport/WinStackWalker.cpp

	${CMAKE_SOURCE_DIR}/src/WorldStorage/FastNBT.cpp
	${CMAKE_SOURCE_DIR}/src/WorldStorage/SchematicFileSerializer.cpp
)

set (SHARED_HDRS
	${CMAKE_SOURCE_DIR}/src/BiomeDef.h
	${CMAKE_SOURCE_DIR}/src/BlockArea.h
	${CMAKE_SOURCE_DIR}/src/Cuboid.h
	${CMAKE_SOURCE_DIR}/src/ChunkData.h
	${CMAKE_SOURCE_DIR}/src/Globals.h
	${CMAKE_SOURCE_DIR}/src/StringCompression.h
	${CMAKE_SOURCE_DIR}/src/StringUtils.h

	${CMAKE_SOURCE_DIR}/src/Bindings/LuaState.h

	${CMAKE_SOURCE_DIR}/src/Generating/ChunkDesc.h
	${CMAKE_SOURCE_DIR}/src/Generating/PiecePool.h
	${CMAKE_SOURCE_DIR}/src/Generating/Prefab.h
	${CMAKE_SOURCE_DIR}/src/Generating/PrefabPiecePool.h
	${CMAKE_SOURCE_DIR}/src/Generating/VerticalLimit.h
	${CMAKE_SOURCE_DIR}/src/Generating/VerticalStrategy.h

	${CMAKE_SOURCE_DIR}/src/Noise/Noise.h

	${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h
	${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h
	${CMAKE_SOURCE_DIR}/src/OSSupport/File.h
	${CMAKE_SOURCE_DIR}/src/OSSupport/GZipFile.h
	${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.h
	${CMAKE_SOURCE_DIR}/src/OSSupport/WinStackWalker.h

	${CMAKE_SOURCE_DIR}/src/WorldStorage/FastNBT.h
	${CMAKE_SOURCE_DIR}/src/WorldStorage/SchematicFileSerializer.h
)

set (STUBS
	Stubs.cpp
	LuaState_Typedefs.inc
	LuaState_Declaration.inc
	Bindings.h
)


if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
	add_flags_cxx("-Wno-error=global-constructors")
	add_flags_cxx("-Wno-error=switch-enum")
endif()



add_library(GeneratorTestingSupport STATIC ${SHARED_SRCS} ${SHARED_HDRS} ${STUBS})
target_link_libraries(GeneratorTestingSupport tolualib zlib fmt::fmt)
source_group("Stubs" FILES ${STUBS})





# LoadablePieces test:
source_group("Data files" FILES Test.cubeset Test1.schematic)
add_executable(LoadablePieces LoadablePieces.cpp Test.cubeset Test1.schematic)
target_link_libraries(LoadablePieces GeneratorTestingSupport)
add_test(NAME LoadablePieces-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LoadablePieces)





# PieceRotation test:
add_executable(PieceRotation PieceRotationTest.cpp)
target_link_libraries(PieceRotation GeneratorTestingSupport)
add_test(NAME PieceRotation-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND PieceRotation)





# PieceGeneratorBFSTree test:
add_executable(PieceGeneratorBFSTree
	PieceGeneratorBFSTreeTest.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/PieceGeneratorBFSTree.cpp
	${CMAKE_SOURCE_DIR}/src/Generating/PieceGeneratorBFSTree.h
)
target_link_libraries(PieceGeneratorBFSTree GeneratorTestingSupport)
add_test(NAME PieceGeneratorBFSTree-test WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/Server/Prefabs/PieceStructures COMMAND PieceGeneratorBFSTree)





# Put the projects into solution folders (MSVC):
set_target_properties(
	GeneratorTestingSupport
	LoadablePieces
	PieceGeneratorBFSTree
	PieceRotation
	PROPERTIES FOLDER Tests/Generating
)