-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (56 loc) · 1.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
# Set minimum required CMake version and project information
cmake_minimum_required(VERSION 3.0.0)
project(BobEngine
VERSION 0.0.1
DESCRIPTION "Game Engine"
HOMEPAGE_URL "https://github.com/MrCatNerd/BobEngine"
LANGUAGES CXX
)
# Binary output dir
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIG>/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIG>/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/$<CONFIG>/lib")
# Set C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set the build type
#set(CMAKE_BUILD_TYPE Release)
add_compile_options(-g)
add_compile_options(-Wall)
# OS specific stuff
if(WIN32) # Windows
elseif(APPLE) # Apple
add_compile_definitions(_MACOS)
else() # Linux
endif()
# Define source files
file(GLOB_RECURSE _SOURCE_FILES CONFIGURE_DEPENDS
GLOB SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp"
GLOB HEADERS "${PROJECT_SOURCE_DIR}/src/*.hpp"
)
# Exclude files starting with underscore '_<file>'
list(FILTER _SOURCE_FILES EXCLUDE REGEX ".*\\/_.*\\..*")
# Create executable target
add_executable(${PROJECT_NAME} ${_SOURCE_FILES})
# Add packages
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(glfw3 CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(assimp CONFIG REQUIRED)
target_include_directories(${PROJECT_NAME} PRIVATE
"${PROJECT_SOURCE_DIR}/src"
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_SOURCE_DIR}/deps"
"${CMAKE_CURRENT_BINARY_DIR}"
"${OPENGL_INCLUDE_DIR}"
)
target_link_libraries(
${PROJECT_NAME} PRIVATE
${OPENGL_LIBRARIES}
GLEW::GLEW
assimp::assimp
glfw
glm::glm
)
# set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # compile_commands.json (you don't need this i got a thingy in the Makefile that does the same thing)