-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists_with_tf.txt
51 lines (40 loc) · 1.68 KB
/
CMakeLists_with_tf.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
cmake_minimum_required(VERSION 3.14)
project(MicroSociety LANGUAGES CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Option to build shared or static libraries
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# Automatically fetch SFML and nlohmann_json libraries
include(FetchContent)
FetchContent_Declare(SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.1
GIT_SHALLOW ON
EXCLUDE_FROM_ALL
SYSTEM)
FetchContent_Declare(nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.10.5
GIT_SHALLOW ON
EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(SFML nlohmann_json)
# Find TensorFlowCC package
find_package(TensorflowCC REQUIRED)
# Add include directory
include_directories(${CMAKE_SOURCE_DIR}/include)
# Add source files
file(GLOB SOURCES "src/*.cpp")
# Add executable for the main project
add_executable(MicroSociety ${SOURCES})
# Link TensorFlow C++ and other dependencies
target_link_libraries(MicroSociety PRIVATE sfml-graphics sfml-audio sfml-system sfml-window nlohmann_json::nlohmann_json TensorflowCC::TensorflowCC)
# Platform-specific settings
if(UNIX)
target_link_libraries(MicroSociety PRIVATE pthread)
endif()
# Add the test executable for unit tests
add_executable(TestTerrain tests/test_terrain.cpp src/Game.cpp include/Tile.hpp include/Object.hpp)
target_link_libraries(TestTerrain PRIVATE sfml-graphics sfml-audio sfml-system sfml-window nlohmann_json::nlohmann_json TensorflowCC::TensorflowCC)
add_executable(TestEntity tests/test_entity.cpp)
target_link_libraries(TestEntity PRIVATE sfml-graphics sfml-audio sfml-system sfml-window)