-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (67 loc) · 2.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
cmake_minimum_required(VERSION 3.15)
project(sim VERSION "1.2.1")
configure_file("src/version.h.in" "version.h" @ONLY)
include_directories(${PROJECT_BINARY_DIR})
set(CMAKE_CXX_STANDARD 17)
if(MSVC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
find_package(raylib 3.5 QUIET)
if(NOT raylib_FOUND) # If there's none, fetch and build raylib
include(FetchContent)
FetchContent_Declare(raylib URL https://github.com/raysan5/raylib/archive/refs/tags/3.5.0.tar.gz)
FetchContent_GetProperties(raylib)
if(NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES
OFF
CACHE BOOL "" FORCE) # don't build the supplied examples
# build raylib
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()
add_executable(
${PROJECT_NAME}
"src/agent.h"
"src/config.h"
"src/config.cpp"
"src/grid.h"
"src/gui.h"
"src/gui.cpp"
"src/main.cpp"
"src/map.h"
"src/map.cpp"
"src/pathfinder.cpp"
"src/pathfinder.h"
"src/platform.h"
"src/platform.cpp"
"src/scripting.h"
"src/scripting.cpp"
"src/simulation.h"
"src/simulation.cpp"
"src/util.h"
"src/util.cpp")
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "third_party" "third_party/luajit/src")
target_link_libraries(${PROJECT_NAME} raylib)
if(MSVC)
target_link_directories(${PROJECT_NAME} PUBLIC "bin")
target_link_libraries(${PROJECT_NAME} lua51)
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bin/lua51.dll
${PROJECT_BINARY_DIR}
COMMENT "Copying lua51.dll to output directory...")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND powershell.exe -File "\"${CMAKE_CURRENT_SOURCE_DIR}/release.ps1\"" ${PROJECT_VERSION}
$<TARGET_FILE:sim>
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Packing release...")
endif()
else()
target_link_libraries(${PROJECT_NAME} luajit-5.1)
endif()