-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
116 lines (95 loc) · 3.87 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
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" CACHE STRING "" FORCE)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "" FORCE)
endif()
project(TheTraitor)
include(ExternalProject)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_INSTALL_RPATH ".")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
if(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gm- /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Gm- /MP")
endif()
file(GLOB SRC_LIST "src/*.cpp" "src/*.h")
add_executable(${PROJECT_NAME} WIN32 ${SRC_LIST})
add_custom_target(DumpSymbols SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/DumpSymbols.cmake)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/DumpSymbols.cmake PROPERTIES HEADER_FILE_ONLY TRUE)
externalproject_add(Urho3D
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Urho3D
CMAKE_ARGS -DURHO3D_64BIT=1 -DURHO3D_ANGELSCRIPT=0 -DURHO3D_NETWORK=1 -DURHO3D_URHO2D=0 -DURHO3D_TOOLS=1 -DURHO3D_MINIDUMPS=0 -DURHO3D_FILEWATCHER=0 -DURHO3D_OPENGL=1 -DURHO3D_LIB_TYPE=STATIC -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}
BUILD_IN_SOURCE 0
INSTALL_COMMAND ""
TEST_COMMAND ""
)
# Yet another hack.
add_definitions(-DURHO3D_STATIC_DEFINE -DURHO3D_PROFILING -DURHO3D_LOGGING -DURHO3D_OPENGL)
add_definitions(-DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" -DCMAKE_GENERATOR="${CMAKE_GENERATOR}" -DCMAKE_CXX_COMPILER_ID="${CMAKE_CXX_COMPILER_ID}")
externalproject_get_property(Urho3D BINARY_DIR)
set(URHO3D_BUILD_DIR ${BINARY_DIR})
include_directories(${URHO3D_BUILD_DIR}/include)
include_directories(${URHO3D_BUILD_DIR}/include/Urho3D/ThirdParty)
if(UNIX)
set(URHO3D_STATIC_LIB ${URHO3D_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Urho3D${CMAKE_STATIC_LIBRARY_SUFFIX})
find_library(AUDIOUNIT_FRAMEWORK AudioUnit)
find_library(CARBON_FRAMEWORK Carbon)
find_library(COCOA_FRAMEWORK Cocoa)
find_library(COREAUDIO_FRAMEWORK CoreAudio)
find_library(FORCEFEEDBACK_FRAMEWORK ForceFeedback)
find_library(IOKIT_FRAMEWORK IOKit)
find_library(OPENGL_FRAMEWORK OpenGL)
set(URHO3D_REQUIRED_LIBS
${AUDIOUNIT_FRAMEWORK}
${CARBON_FRAMEWORK}
${COCOA_FRAMEWORK}
${COREAUDIO_FRAMEWORK}
${FORCEFEEDBACK_FRAMEWORK}
${IOKIT_FRAMEWORK}
${OPENGL_FRAMEWORK}
)
else()
set(URHO3D_STATIC_LIB ${URHO3D_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Urho3D$<$<CONFIG:Debug>:_d>.lib)
set(URHO3D_REQUIRED_LIBS
"Winmm.lib"
"Opengl32.lib"
"Version.lib"
"Imm32.lib"
)
endif()
target_link_libraries(${PROJECT_NAME} ${URHO3D_STATIC_LIB} ${URHO3D_REQUIRED_LIBS})
add_dependencies(${PROJECT_NAME} Urho3D)
if(TRUE)
add_definitions(-DGOOGLE_BREAKPAD)
add_subdirectory(Breakpad)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/Breakpad)
add_dependencies(${PROJECT_NAME} Breakpad)
target_link_libraries(${PROJECT_NAME} Breakpad)
endif()
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -DDUMP_SYMS=$<TARGET_FILE:dump_syms> -DBINARY_PATH=$<TARGET_FILE:${PROJECT_NAME}> -P ${CMAKE_CURRENT_SOURCE_DIR}/DumpSymbols.cmake
)
if(UNIX)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E create_symlink
${CMAKE_SOURCE_DIR}/data $<TARGET_FILE_DIR:${PROJECT_NAME}>/data
COMMAND ${CMAKE_COMMAND} -E create_symlink
${URHO3D_BUILD_DIR}/bin/tool/AssetImporter${CMAKE_EXECUTABLE_SUFFIX} $<TARGET_FILE_DIR:${PROJECT_NAME}>/AssetImporter${CMAKE_EXECUTABLE_SUFFIX}
)
else()
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:${PROJECT_NAME}>/data
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/data $<TARGET_FILE_DIR:${PROJECT_NAME}>/data
COMMAND ${CMAKE_COMMAND} -E copy
${URHO3D_BUILD_DIR}/bin/tool/AssetImporter${CMAKE_EXECUTABLE_SUFFIX} $<TARGET_FILE_DIR:${PROJECT_NAME}>/AssetImporter${CMAKE_EXECUTABLE_SUFFIX}
)
endif()