TDT4230_final_project/CMakeLists.txt

109 lines
3.1 KiB
CMake
Raw Normal View History

2019-02-04 18:32:08 +01:00
#
# Specify minimum CMake version and project name
#
cmake_minimum_required (VERSION 3.0)
2019-03-18 11:48:11 +01:00
project (plain_of_awesome)
2019-02-04 18:32:08 +01:00
#
# CMake setup
#
set (CMAKE_CXX_STANDARD 17)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set (CMAKE_VERBOSE_MAKEFILE 0) # 1 should be used for debugging
set (CMAKE_SUPPRESS_REGENERATION TRUE) # Suppresses ZERO_CHECK
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
if(NOT WIN32)
set(GLAD_LIBRARIES dl)
endif()
endif()
2019-03-22 00:05:16 +01:00
# rtags setup
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
2019-02-04 18:32:08 +01:00
#
# GLFW options
#
option (GLFW_INSTALL OFF)
option (GLFW_BUILD_DOCS OFF)
option (GLFW_BUILD_EXAMPLES OFF)
option (GLFW_BUILD_TESTS OFF)
add_subdirectory (lib/glfw)
# SFML options
# We only need sound for this project, so everything else can be turned off
option (SFML_BUILD_GRAPHICS OFF)
option (SFML_BUILD_WINDOW OFF)
option (SFML_BUILD_NETWORK OFF)
add_subdirectory(lib/SFML)
2019-03-18 11:48:11 +01:00
# assimp
2019-04-07 00:02:33 +02:00
set(BUILD_ASSIMP_TOOLS OFF)
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
set(ASSIMP_BUILD_SAMPLES OFF)
set(ASSIMP_BUILD_TESTS OFF)
set(ASSIMP_COVERALLS OFF)
set(ASSIMP_NO_EXPORT ON)
2019-03-18 11:48:11 +01:00
set(ASSIMP_BUILD_STATIC_LIB ON)
add_subdirectory(lib/assimp)
link_directories("lib/assimp/build/code")
2019-02-04 18:32:08 +01:00
#
# Set include paths
#
include_directories (src/
lib/glad/include/
lib/glfw/include/
2019-02-18 17:52:50 +01:00
lib/lodepng/
2019-02-04 18:32:08 +01:00
lib/glm/
lib/stb/
lib/arrrgh/
2019-03-18 11:48:11 +01:00
lib/assimp/include/
2019-02-04 18:32:08 +01:00
lib/SFML/include/)
#
# Add files
#
2019-02-18 17:52:50 +01:00
file (GLOB VENDORS_SOURCES lib/glad/src/glad.c
lib/lodepng/lodepng.cpp)
2019-02-04 18:32:08 +01:00
file (GLOB_RECURSE PROJECT_HEADERS src/*.hpp
src/*.h)
file (GLOB_RECURSE PROJECT_SOURCES src/*.cpp
src/*.cxx
src/*.cc
src/*.c)
file (GLOB_RECURSE PROJECT_SHADERS res/shaders/*.comp
res/shaders/*.frag
res/shaders/*.geom
res/shaders/*.vert)
file (GLOB PROJECT_CONFIGS CMakeLists.txt
README.rst
.gitignore
.gitmodules)
#
# Organizing files
#
source_group ("headers" FILES ${PROJECT_HEADERS})
source_group ("shaders" FILES ${PROJECT_SHADERS})
source_group ("sources" FILES ${PROJECT_SOURCES})
source_group ("libraries" FILES ${VENDORS_SOURCES})
#
# Set executable and target link libraries
#
add_definitions (-DGLFW_INCLUDE_NONE
-DPROJECT_SOURCE_DIR=\"${PROJECT_SOURCE_DIR}\")
add_executable (${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS}
${PROJECT_SHADERS} ${PROJECT_CONFIGS}
${VENDORS_SOURCES})
target_link_libraries (${PROJECT_NAME}
glfw
sfml-audio
2019-03-18 11:48:11 +01:00
assimp
2019-02-04 18:32:08 +01:00
${GLFW_LIBRARIES}
${GLAD_LIBRARIES})