-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
112 lines (98 loc) · 3.79 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
cmake_minimum_required(VERSION 3.1)
# Project Description
project(Fireworks VERSION 2.0
DESCRIPTION "Fireworks Engine"
)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
# set(CMAKE_CXX_STANDARD_REQUIRED True)
# Add source files
file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/*.c
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/*.cpp)
# Add source header files
file(GLOB_RECURSE HEADER_FILES
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/*.h
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/fireworks.h
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Sandbox/examples/*.h
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/*.hpp)
# External sandbox dependency Files
file(GLOB_RECURSE EXT_SANDBOX_SOURCE_FILES
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Sandbox/Test\ Dependencies/*.c
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Sandbox/Test\ Dependencies/*.cpp)
# Add external header files
file(GLOB_RECURSE EXT_HEADER_FILES
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/ext/*.h
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/*.hpp
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/vendor/*.h
${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Fireworks\ Core/vendor/*.hpp)
# Adding Frameworks
find_package(OpenGL REQUIRED)
# Adding custom libraries
find_library(GLEW_LIBRARY
NAMES glew libglew glew32s
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/GLEW/lib"
)
find_library(GLFW_LIBRARY
NAMES glfw3 libglfw3
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/GLFW/lib"
)
find_library(FreeType_LIBRARY
NAMES freetype libfreetype
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/FreeType/lib"
)
find_library(PNG_LIBRARY
NAMES png libpng
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/PNG/lib"
)
find_library(BZIP2_LIBRARY
NAMES bzip2 libbz2 bz2
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/BZIP2/lib"
)
find_library(FIREWORKS_LIBRARY
NAMES fireworks
HINTS "${CMAKE_SOURCE_DIR}/build"
)
find_library(BOX2D_LIBRARY
NAMES box2d
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/Box2D/lib"
)
find_library(ASSIMP_LIBRARY
NAMES assimp
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/Assimp/lib"
)
find_library(ZLIB_LIBRARY
NAMES zlib libz z
HINTS "${CMAKE_SOURCE_DIR}/Dependencies/Zlib/lib"
)
# Adding library include paths
include_directories(
"${CMAKE_SOURCE_DIR}/Dependencies/SOIL/include"
"${CMAKE_SOURCE_DIR}/Dependencies/GLEW/include"
"${CMAKE_SOURCE_DIR}/Dependencies/GLFW/include"
"${CMAKE_SOURCE_DIR}/Dependencies/FreeType/include"
"${CMAKE_SOURCE_DIR}/Dependencies/PNG/include"
"${CMAKE_SOURCE_DIR}/Dependencies/BZIP2"
"${CMAKE_SOURCE_DIR}/Dependencies/Zlib/include"
"${CMAKE_SOURCE_DIR}/Dependencies/Box2D/include"
"${CMAKE_SOURCE_DIR}/Dependencies/Assimp/include"
"${CMAKE_SOURCE_DIR}/Dependencies/OpenAL/include"
"${CMAKE_SOURCE_DIR}/Fireworks Engine/Sandbox/Test Dependencies"
"${CMAKE_SOURCE_DIR}/Fireworks Engine/Fireworks Core/"
)
if (APPLE)
# use this for building sandbox
if(BUILD_SANDBOX_EXEC)
set(LIBS ${FIREWORKS_LIBRARY} ${GLEW_LIBRARY} ${GLFW_LIBRARY} ${FreeType_LIBRARY} ${BOX2D_LIBRARY} ${ASSIMP_LIBRARY} ${PNG_LIBRARY} ${BZIP2_LIBRARY} ${ZLIB_LIBRARY})
endif()
set(FRAMEWORKS ${OPENGL_LIBRARIES})
#use this to build the library
if(BUILD_STATIC_LIBRARY)
add_library(fireworks STATIC ${HEADER_FILES} ${SOURCE_FILES} ${EXT_SOURCE_FILES} ${EXT_HEADER_FILES})
endif()
# use hese last 2 commands to run the sandbox
if(BUILD_SANDBOX_EXEC)
add_executable(SandBox ${CMAKE_SOURCE_DIR}/Fireworks\ Engine/Sandbox/Sandbox.cpp ${EXT_SANDBOX_SOURCE_FILES})
target_link_libraries(SandBox ${FRAMEWORKS} ${LIBS} "-framework CoreFoundation -framework CoreAudio -framework OpenAL -framework Cocoa -framework IOKit -framework CoreGraphics")
endif()
endif (APPLE)