Przeglądaj źródła

Split CMakeLists.txt

Thomas Buck 10 lat temu
rodzic
commit
4d2079fccb
3 zmienionych plików z 123 dodań i 124 usunięć
  1. 3
    119
      CMakeLists.txt
  2. 4
    5
      README.md
  3. 116
    0
      src/CMakeLists.txt

+ 3
- 119
CMakeLists.txt Wyświetl plik

@@ -9,26 +9,6 @@ set (OpenRaider_VERSION_MICRO 2)
9 9
 # Build Host
10 10
 set (OpenRaider_BUILD_HOST ${CMAKE_HOST_SYSTEM})
11 11
 
12
-# Apple specific bundling
13
-if (APPLE)
14
-
15
-    # Mac Bundle Data
16
-    set (MACOSX_BUNDLE_INFO_STRING "Open Tomb Raider Engine")
17
-    set (MACOSX_BUNDLE_ICON_FILE "AppIcon")
18
-    set (MACOSX_BUNDLE_GUI_IDENTIFIER "de.xythobuz.OpenRaider")
19
-    set (MACOSX_BUNDLE_LONG_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
20
-    set (MACOSX_BUNDLE_BUNDLE_NAME "OpenRaider")
21
-    set (MACOSX_BUNDLE_SHORT_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
22
-    set (MACOSX_BUNDLE_BUNDLE_VERSION "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
23
-    set (MACOSX_BUNDLE_COPYRIGHT "2001 - 2014")
24
-
25
-    # Copy Icon
26
-    set (MAC_ICON "${PROJECT_SOURCE_DIR}/data/AppIcon.icns")
27
-    set_source_files_properties(${MAC_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
28
-    set (SRCS ${SRCS} ${MAC_ICON})
29
-
30
-endif (APPLE)
31
-
32 12
 # Configuration Header file
33 13
 configure_file (
34 14
     "${PROJECT_SOURCE_DIR}/include/Config.h.in"
@@ -36,114 +16,18 @@ configure_file (
36 16
 )
37 17
 include_directories ("${PROJECT_BINARY_DIR}")
38 18
 
39
-# Executable, Source files
40
-add_executable (OpenRaider MACOSX_BUNDLE
41
-    src/Camera.cpp
42
-    src/Emitter.cpp
43
-    src/GLString.cpp
44
-    src/MatMath.cpp
45
-    src/Matrix.cpp
46
-    src/Mesh.cpp
47
-    src/Network.cpp
48
-    src/OpenRaider.cpp
49
-    src/Particle.cpp
50
-    src/Quaternion.cpp
51
-    src/Render.cpp
52
-    src/SDLSystem.cpp
53
-    src/SkeletalModel.cpp
54
-    src/Sound.cpp
55
-    src/System.cpp
56
-    src/Texture.cpp
57
-    src/TombRaider.cpp
58
-    src/Vector3d.cpp
59
-    src/ViewVolume.cpp
60
-    src/World.cpp
61
-    src/tga.cpp
62
-    ${SRCS}
63
-)
64
-
65 19
 # Default to Debug build
66 20
 set (CMAKE_BUILD_TYPE "Debug")
67 21
 
68
-# Debug build warnings
69
-set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed")
70
-set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
71
-set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
72
-set (WARNINGS "${WARNINGS} -Wno-missing-prototypes -Wno-missing-variable-declarations")
73
-set (WARNINGS "${WARNINGS} -Wno-disabled-macro-expansion")
74
-
75
-set (WARNINGS "${WARNINGS} -Wno-shorten-64-to-32 -Wno-sign-conversion")
76
-
77
-# Flags for all builds
78
-set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
79
-set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_EMITTER")
80
-
81
-# Flags for Debug build
82
-set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -g -O0 ${WARNINGS}")
83
-set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
84
-set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DEXPERIMENTAL")
85
-
86
-# Flags for Releasae builds
87
-set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -ffast-math -funroll-loops")
88
-set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -fomit-frame-pointer -O2")
89
-
90
-# Apply Flags
91
-set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenRaider_CXX_FLAGS}")
92
-set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
93
-set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
94
-
95
-# Include directory
96
-include_directories ("${PROJECT_SOURCE_DIR}/include")
97
-
98
-# Include External Modules
99
-set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
100
-
101
-# Add Math Library
102
-set (LIBS ${LIBS} m)
103
-
104
-# Add SDL2 Library
105
-find_package (SDL2 REQUIRED)
106
-include_directories (SYSTEM ${SDL2_INCLUDE_DIR})
107
-set (LIBS ${LIBS} ${SDL2_LIBRARY})
108
-
109
-# Add SDL2_ttf Library
110
-find_package (SDL2TTF REQUIRED)
111
-include_directories (SYSTEM ${SDL2TTF_INCLUDE_DIR})
112
-set (LIBS ${LIBS} ${SDL2TTF_LIBRARY})
113
-
114
-# Add OpenGL Library
115
-find_package (OpenGL REQUIRED)
116
-include_directories (SYSTEM ${OPENGL_INCLUDE_DIRS})
117
-set (LIBS ${LIBS} ${OPENGL_LIBRARIES})
118
-
119
-# Add OpenAL Library
120
-find_package (OpenAL REQUIRED)
121
-include_directories (SYSTEM ${OPENAL_INCLUDE_DIRS})
122
-set (LIBS ${LIBS} ${OPENAL_LIBRARIES})
123
-
124
-# Add ALUT Library
125
-find_package (ALUT REQUIRED)
126
-include_directories (SYSTEM ${ALUT_INCLUDE_DIRS})
127
-set (LIBS ${LIBS} ${ALUT_LIBRARIES})
128
-
129
-# Add Z Library
130
-find_package (ZLIB REQUIRED)
131
-include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
132
-set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
133
-
134
-# Add Thread Library
135
-find_package (Threads REQUIRED)
136
-set (LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
137
-
138
-# Link to all found libs
139
-target_link_libraries (OpenRaider ${LIBS})
22
+# Add src Folder
23
+add_subdirectory ("src")
140 24
 
141 25
 # Preparing the bundle on install
142 26
 # http://www.cmake.org/Wiki/BundleUtilitiesExample
143 27
 # Why does it even work?
144 28
 if (APPLE)
145 29
     set (plugin_dest_dir OpenRaider.app/Contents/MacOS)
146
-    set (APPS "${PROJECT_BINARY_DIR}/OpenRaider.app")
30
+    set (APPS "${PROJECT_BINARY_DIR}/src/OpenRaider.app")
147 31
     set (DIRS ${QT_LIBRARY_DIRS})
148 32
     install (CODE "
149 33
         file(GLOB_RECURSE PLUGINS

+ 4
- 5
README.md Wyświetl plik

@@ -57,16 +57,15 @@ Linux Distributions will probably provide an ALUT library ready to install with
57 57
 
58 58
 ## Building
59 59
 
60
-If you installed the dependencies using MacPorts, you'll need to have `/opt/local/bin` in your `$PATH` before you can execute make.
61
-If you're using Bash, the MacPorts installer should have automatically edited your configuration.
62
-
63
-Just do a cmake out-of-tree build and specify if you want the Debug or Release configuration, then run the resulting executable:
60
+Do a standard cmake build and then run the resulting executable:
64 61
 
65 62
     mkdir build
66 63
     cd build
67 64
     cmake -DCMAKE_BUILD_TYPE=Debug ..
68 65
     make
69
-    ./OpenRaider
66
+    ./src/OpenRaider
67
+
68
+On Mac OS X, running make install will produce a distributable OpenRaider.app bundle.
70 69
 
71 70
 ## Usage
72 71
 

+ 116
- 0
src/CMakeLists.txt Wyświetl plik

@@ -0,0 +1,116 @@
1
+# Set Source files
2
+set (SRCS ${SRCS} Camera.cpp)
3
+set (SRCS ${SRCS} Emitter.cpp)
4
+set (SRCS ${SRCS} GLString.cpp)
5
+set (SRCS ${SRCS} MatMath.cpp)
6
+set (SRCS ${SRCS} Matrix.cpp)
7
+set (SRCS ${SRCS} Mesh.cpp)
8
+set (SRCS ${SRCS} Network.cpp)
9
+set (SRCS ${SRCS} OpenRaider.cpp)
10
+set (SRCS ${SRCS} Particle.cpp)
11
+set (SRCS ${SRCS} Quaternion.cpp)
12
+set (SRCS ${SRCS} Render.cpp)
13
+set (SRCS ${SRCS} SDLSystem.cpp)
14
+set (SRCS ${SRCS} SkeletalModel.cpp)
15
+set (SRCS ${SRCS} Sound.cpp)
16
+set (SRCS ${SRCS} System.cpp)
17
+set (SRCS ${SRCS} Texture.cpp)
18
+set (SRCS ${SRCS} TombRaider.cpp)
19
+set (SRCS ${SRCS} Vector3d.cpp)
20
+set (SRCS ${SRCS} ViewVolume.cpp)
21
+set (SRCS ${SRCS} World.cpp)
22
+set (SRCS ${SRCS} tga.cpp)
23
+
24
+# Apple specific bundling
25
+if (APPLE)
26
+    # Mac Bundle Data
27
+    set (MACOSX_BUNDLE_INFO_STRING "OpenSource TombRaider Game Engine")
28
+    set (MACOSX_BUNDLE_ICON_FILE "AppIcon")
29
+    set (MACOSX_BUNDLE_GUI_IDENTIFIER "de.xythobuz.OpenRaider")
30
+    set (MACOSX_BUNDLE_LONG_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
31
+    set (MACOSX_BUNDLE_BUNDLE_NAME "OpenRaider")
32
+    set (MACOSX_BUNDLE_SHORT_VERSION_STRING "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
33
+    set (MACOSX_BUNDLE_BUNDLE_VERSION "${OpenRaider_VERSION_MAJOR}.${OpenRaider_VERSION_MINOR}.${OpenRaider_VERSION_MICRO}")
34
+    set (MACOSX_BUNDLE_COPYRIGHT "2001 - 2014")
35
+
36
+    # Copy Icon
37
+    set (MAC_ICON "../data/AppIcon.icns")
38
+    set_source_files_properties(${MAC_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
39
+    set (SRCS ${SRCS} ${MAC_ICON})
40
+endif (APPLE)
41
+
42
+# Add Executable
43
+add_executable (OpenRaider MACOSX_BUNDLE ${SRCS})
44
+
45
+# Debug build warnings
46
+set (WARNINGS "${WARNINGS} -Weverything -Wno-padded -Wno-packed")
47
+set (WARNINGS "${WARNINGS} -Wno-global-constructors -Wno-exit-time-destructors")
48
+set (WARNINGS "${WARNINGS} -Wno-documentation-unknown-command -Wno-c++98-compat-pedantic")
49
+set (WARNINGS "${WARNINGS} -Wno-missing-prototypes -Wno-missing-variable-declarations")
50
+set (WARNINGS "${WARNINGS} -Wno-disabled-macro-expansion")
51
+
52
+set (WARNINGS "${WARNINGS} -Wno-shorten-64-to-32 -Wno-sign-conversion")
53
+
54
+# Flags for all builds
55
+set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -std=c++11")
56
+set (OpenRaider_CXX_FLAGS "${OpenRaider_CXX_FLAGS} -DUSING_EMITTER")
57
+
58
+# Flags for Debug build
59
+set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -g -O0 ${WARNINGS}")
60
+set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DDEBUG")
61
+set (OpenRaider_CXX_FLAGS_DEBUG "${OpenRaider_CXX_FLAGS_DEBUG} -DEXPERIMENTAL")
62
+
63
+# Flags for Releasae builds
64
+set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -ffast-math -funroll-loops")
65
+set (OpenRaider_CXX_FLAGS_RELEASE "${OpenRaider_CXX_FLAGS_RELEASE} -fomit-frame-pointer -O2")
66
+
67
+# Apply Flags
68
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenRaider_CXX_FLAGS}")
69
+set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_DEBUG}")
70
+set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OpenRaider_CXX_FLAGS} ${OpenRaider_CXX_FLAGS_RELEASE}")
71
+
72
+# Include directory
73
+include_directories ("${PROJECT_SOURCE_DIR}/include")
74
+
75
+# Include External Modules
76
+set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
77
+
78
+# Add Math Library
79
+set (LIBS ${LIBS} m)
80
+
81
+# Add SDL2 Library
82
+find_package (SDL2 REQUIRED)
83
+include_directories (SYSTEM ${SDL2_INCLUDE_DIR})
84
+set (LIBS ${LIBS} ${SDL2_LIBRARY})
85
+
86
+# Add SDL2_ttf Library
87
+find_package (SDL2TTF REQUIRED)
88
+include_directories (SYSTEM ${SDL2TTF_INCLUDE_DIR})
89
+set (LIBS ${LIBS} ${SDL2TTF_LIBRARY})
90
+
91
+# Add OpenGL Library
92
+find_package (OpenGL REQUIRED)
93
+include_directories (SYSTEM ${OPENGL_INCLUDE_DIRS})
94
+set (LIBS ${LIBS} ${OPENGL_LIBRARIES})
95
+
96
+# Add OpenAL Library
97
+find_package (OpenAL REQUIRED)
98
+include_directories (SYSTEM ${OPENAL_INCLUDE_DIRS})
99
+set (LIBS ${LIBS} ${OPENAL_LIBRARIES})
100
+
101
+# Add ALUT Library
102
+find_package (ALUT REQUIRED)
103
+include_directories (SYSTEM ${ALUT_INCLUDE_DIRS})
104
+set (LIBS ${LIBS} ${ALUT_LIBRARIES})
105
+
106
+# Add Z Library
107
+find_package (ZLIB REQUIRED)
108
+include_directories (SYSTEM ${ZLIB_INCLUDE_DIRS})
109
+set (LIBS ${LIBS} ${ZLIB_LIBRARIES})
110
+
111
+# Add Thread Library
112
+find_package (Threads REQUIRED)
113
+set (LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
114
+
115
+# Link to all found libs
116
+target_link_libraries (OpenRaider ${LIBS})

Ładowanie…
Anuluj
Zapisz