| 1 |
file(GLOB SOURCES Source/*.cpp Contrib/fastlz/fastlz.c) |
| 2 |
|
| 3 |
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
| 4 |
|
| 5 |
if(NOT SDL2_ROOT_DIR) |
| 6 |
if(WIN32) |
| 7 |
set(SDL2_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Contrib/SDL") |
| 8 |
elseif(APPLE) |
| 9 |
set(SDL2_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Bin") |
| 10 |
endif() |
| 11 |
endif() |
| 12 |
|
| 13 |
find_package(OpenGL REQUIRED) |
| 14 |
if(APPLE) |
| 15 |
find_library(SDL2_LIBRARY |
| 16 |
NAMES SDL2 |
| 17 |
PATHS ${SDL2_ROOT_DIR} |
| 18 |
REQUIRED) |
| 19 |
else() |
| 20 |
find_package(SDL2 REQUIRED) |
| 21 |
endif() |
| 22 |
|
| 23 |
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR}) |
| 24 |
include_directories(SYSTEM Contrib/fastlz) |
| 25 |
include_directories(SYSTEM Contrib) |
| 26 |
include_directories(../DebugUtils/Include) |
| 27 |
include_directories(../Detour/Include) |
| 28 |
include_directories(../DetourCrowd/Include) |
| 29 |
include_directories(../DetourTileCache/Include) |
| 30 |
include_directories(../Recast/Include) |
| 31 |
include_directories(Include) |
| 32 |
include_directories(Contrib/SDL/include) |
| 33 |
if(APPLE) |
| 34 |
include_directories(${SDL2_LIBRARY}/Headers) |
| 35 |
endif() |
| 36 |
|
| 37 |
if (WIN32) |
| 38 |
add_executable(RecastDemo WIN32 ${SOURCES}) |
| 39 |
elseif(APPLE) |
| 40 |
add_executable(RecastDemo MACOSX_BUNDLE ${SOURCES}) |
| 41 |
else() |
| 42 |
add_executable(RecastDemo ${SOURCES}) |
| 43 |
endif() |
| 44 |
|
| 45 |
if( WIN32 ) |
| 46 |
if ( "${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild" ) |
| 47 |
add_custom_command(TARGET RecastDemo |
| 48 |
POST_BUILD |
| 49 |
COMMAND ${CMAKE_COMMAND} -E copy "${SDL2_RUNTIME_LIBRARY}" ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/ |
| 50 |
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/Meshes ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/Meshes |
| 51 |
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/TestCases ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/TestCases |
| 52 |
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Bin/DroidSans.ttf ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/ |
| 53 |
) |
| 54 |
elseif ( MINGW ) |
| 55 |
add_custom_command(TARGET RecastDemo |
| 56 |
POST_BUILD |
| 57 |
COMMAND ${CMAKE_COMMAND} -E copy "${SDL2_RUNTIME_LIBRARY}" ${CMAKE_BINARY_DIR}/RecastDemo/ |
| 58 |
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/Meshes ${CMAKE_BINARY_DIR}/RecastDemo/Meshes |
| 59 |
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/TestCases ${CMAKE_BINARY_DIR}/RecastDemo/TestCases |
| 60 |
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Bin/DroidSans.ttf ${CMAKE_BINARY_DIR}/RecastDemo/ |
| 61 |
) |
| 62 |
endif() |
| 63 |
else() |
| 64 |
file(COPY Bin/Meshes DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) |
| 65 |
file(COPY Bin/TestCases DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) |
| 66 |
file(COPY Bin/DroidSans.ttf DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) |
| 67 |
endif() |
| 68 |
|
| 69 |
|
| 70 |
add_dependencies(RecastDemo DebugUtils Detour DetourCrowd DetourTileCache Recast) |
| 71 |
if(APPLE) |
| 72 |
target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} DebugUtils Detour DetourCrowd DetourTileCache Recast) |
| 73 |
else() |
| 74 |
target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} SDL2::SDL2main DebugUtils Detour DetourCrowd DetourTileCache Recast) |
| 75 |
endif() |
| 76 |
|
| 77 |
|
| 78 |
install(TARGETS RecastDemo |
| 79 |
RUNTIME DESTINATION bin |
| 80 |
BUNDLE DESTINATION bin) |
| 81 |
install(DIRECTORY Bin/Meshes DESTINATION bin) |
| 82 |
install(DIRECTORY Bin/TestCases DESTINATION bin) |
| 83 |
install(FILES Bin/DroidSans.ttf DESTINATION bin) |
| 84 |
|
| 85 |
if (WIN32) |
| 86 |
install(FILES "${SDL2_RUNTIME_LIBRARY}" DESTINATION bin) |
| 87 |
endif() |