-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
130 lines (109 loc) · 4.46 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#This scripts will add all the cpp and h files under src and include folders, and
#assumes that your Ogre source code is in Dependencies/Ogre and that:
# In Windows you built Ogre into Dependencies/Ogre/build
# In Linux you built Release into Dependencies/Ogre/build/Release
# In Linux you built Debug into Dependencies/Ogre/build/Debug
#
# If your source code is not at "Dependencies/Ogre"; you can use "mklink /D" to create
# a symbolic link to where the source code is located on Windows.
# On Linux, you can use "ln -s"
#set( CMAKE_TOOLCHAIN_FILE CMake/iOS.cmake )
cmake_minimum_required( VERSION 3.0 )
project( EmptyProject )
set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" )
include( CMake/Bootstrap.cmake )
include( CMake/Dependencies/OGRE.cmake )
if( APPLE )
set( CMAKE_CXX_STANDARD 11 )
endif()
setupOgre( OGRE_SOURCE, OGRE_BINARIES, OGRE_LIBRARIES, FALSE, FALSE )
# Setup our application
set( EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}" )
if( MSVC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
if( NOT PLATFORM_X64 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")
endif()
add_definitions( -DUNICODE -D_UNICODE )
endif()
if( APPLE )
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c ${dir}/*.mm ${dir}/*.m )
endmacro()
else()
macro( add_recursive dir retVal )
file( GLOB_RECURSE ${retVal} ${dir}/*.h ${dir}/*.cpp ${dir}/*.c )
endmacro()
endif()
include_directories( "./include" )
# Ogre doesn't need this include, but we do because of Rapidjson in UnitTesting.cpp
include_directories( "./Dependencies/Ogre/Dependencies/include" )
add_recursive( ./src SOURCES )
add_recursive( ./include HEADERS )
if( APPLE )
if( APPLE_IOS )
file( GLOB_RECURSE RESOURCES ./src/*.storyboard )
endif()
set( RESOURCES ${RESOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/bin/Data )
if( APPLE_IOS )
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/src/OgreCommon/System/OSX/OSXUtils.mm
PROPERTIES HEADER_FILE_ONLY TRUE
)
else()
set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/src/OgreCommon/System/iOS/AppDelegate.mm
${CMAKE_CURRENT_SOURCE_DIR}/src/OgreCommon/System/iOS/GameViewController.mm
${CMAKE_CURRENT_SOURCE_DIR}/src/OgreCommon/System/iOS/iOSUtils.mm
PROPERTIES HEADER_FILE_ONLY TRUE
)
endif()
endif()
if( APPLE )
# Treat our *.c & *.cpp files as *.mm + Enable ARC on them
set_source_files_properties( ${SOURCES} PROPERTIES
COMPILE_FLAGS
"-x objective-c++ -fobjc-arc"
)
endif()
add_executable( ${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SOURCES} ${HEADERS} ${RESOURCES} )
target_link_libraries( ${PROJECT_NAME} ${OGRE_LIBRARIES} )
if( APPLE )
set_target_properties( ${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_ENABLE_BITCODE "NO" )
set_target_properties( ${PROJECT_NAME} PROPERTIES RESOURCE "${RESOURCES}" )
#set_target_properties( ${PROJECT_NAME} PROPERTIES MACOSX_BUNDLE_ICON_FILE SampleBrowser_OSX.icns)
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
-framework CoreGraphics -framework QuartzCore -framework Metal -framework StoreKit" )
if( APPLE_IOS )
# iPhone
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} \
-framework UIKit -framework CoreText -framework CoreMotion" )
# These must be global for all projects; or else they'll cause
# trouble or increased compiling times
set( CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "10.0" )
set( CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS "arm64" )
set_target_properties( ${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST
${CMAKE_CURRENT_SOURCE_DIR}/Scripts/Apple/iPhone/iOSApp.plist
# XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS
# "${CMAKE_CURRENT_SOURCE_DIR}/Scripts/Apple/iPhone/iOSEntitlements.plist"
)
else()
# macOS
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation" )
set_target_properties( ${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST
${CMAKE_CURRENT_SOURCE_DIR}/Scripts/Apple/macOS/macOSApp.plist
# XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS
# "${CMAKE_CURRENT_SOURCE_DIR}/Scripts/Apple/macOS/macOSEntitlements.plist"
)
endif()
endif()
#================= ImGui ==================
add_subdirectory(Dependencies)
target_link_libraries(${PROJECT_NAME} IMGUI)
target_include_directories(${PROJECT_NAME} PUBLIC Dependencies)
target_link_directories(${PROJECT_NAME} PRIVATE Dependencies)
target_include_directories(${PROJECT_NAME} PUBLIC src/ImguiOgre)
set(ImguiSrc ImguiManager.cpp ImguiRenderable.cpp src/ImguiOgre/ )