protot/CMakeLists.txt

139 lines
3.2 KiB
CMake
Raw Normal View History

2018-02-12 21:35:44 +01:00
PROJECT ( Protot )
2016-08-29 22:31:11 +02:00
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
# Needed for UnitTest++
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake )
# Perform the proper linking
SET (CMAKE_SKIP_BUILD_RPATH FALSE)
SET (CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# For YouCompleteMe
SET (CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Enable CCache
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)
2016-08-29 22:31:11 +02:00
# Enable proper C++11 flags
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
2016-08-29 22:31:11 +02:00
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
2016-08-29 22:31:11 +02:00
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
# enable strings in GDB
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG")
2018-12-15 14:14:22 +01:00
message(STATUS "Using compiler flags ${CMAKE_CXX_FLAGS}")
add_definitions("-DIMGUI_IMPL_OPENGL_LOADER_GLAD")
2018-12-15 14:14:22 +01:00
2018-12-23 11:20:54 +01:00
# setup of libccd variables so that FCL can find it
SET (CCD_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/libccd/src)
SET (CCD_LIBRARY ccd)
SET (BUILD_SHARED_LIBS TRUE)
SET (FCL_BUILD_TESTS FALSE)
SET (BUILD_TESTING OFF)
SET (GLFW_BUILD_DOCS OFF)
SET (GLFW_BUILD_EXAMPLES OFF)
2018-12-23 11:20:54 +01:00
2016-08-29 22:31:11 +02:00
INCLUDE_DIRECTORIES (
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/3rdparty
2016-08-29 22:31:11 +02:00
)
FIND_PACKAGE (X11 REQUIRED)
FIND_PACKAGE (OpenGL REQUIRED)
FIND_PACKAGE (Threads REQUIRED)
INCLUDE_DIRECTORIES (
3rdparty/glfw/deps
2016-10-21 22:22:19 +02:00
3rdparty/glfw/include
2016-08-29 22:31:11 +02:00
3rdparty/tinyobjloader
3rdparty/imgui_dock_lumix
2016-08-29 22:31:11 +02:00
${CMAKE_CURRENT_BINARY_DIR}/src
2018-02-12 21:35:44 +01:00
3rdparty/imgui
2018-12-15 14:14:22 +01:00
3rdparty/imgui/examples/
2016-08-29 22:31:11 +02:00
)
SUBDIRS (
src/modules
tests/
2016-08-29 22:31:11 +02:00
3rdparty/glfw
3rdparty/googletest
2018-12-23 11:20:54 +01:00
3rdparty/fcl
3rdparty/libccd
2018-12-26 23:40:59 +01:00
3rdparty/physfs
2016-08-29 22:31:11 +02:00
)
2018-02-13 12:05:07 +01:00
SET (GLFW_BUILD_DOCS OFF)
SET (GLFW_BUILD_EXAMPLES OFF)
SET (GLFW_BUILD_TESTS OFF)
2016-08-29 22:31:11 +02:00
SET ( protot_SRCS
src/RuntimeModuleManager.cc
src/Utils.cc
3rdparty/glfw/deps/glad.cc
2018-02-12 21:35:44 +01:00
3rdparty/imgui/imgui.cpp
3rdparty/imgui/imgui_draw.cpp
2018-12-15 14:14:22 +01:00
3rdparty/imgui/imgui_widgets.cpp
2018-02-12 21:35:44 +01:00
3rdparty/imgui/imgui_demo.cpp
2018-12-15 14:14:22 +01:00
3rdparty/imgui/examples/imgui_impl_glfw.cpp
3rdparty/imgui/examples/imgui_impl_opengl3.cpp
2018-02-12 21:35:44 +01:00
# 3rdparty/imgui_dock_lumix/imgui_dock.cpp
2016-08-29 22:31:11 +02:00
)
SET (PROTOT_SOURCE_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
CONFIGURE_FILE (
"${CMAKE_CURRENT_SOURCE_DIR}/src/protot_config.h.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/src/protot_config.h"
)
2016-08-31 19:30:31 +02:00
ADD_EXECUTABLE (protot src/main.cc ${protot_SRCS})
2016-08-29 22:31:11 +02:00
SET_TARGET_PROPERTIES ( ${PROJECT_EXECUTABLES} PROPERTIES
LINKER_LANGUAGE CXX
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib"
)
MESSAGE (STATUS "glfw libraries: ${X11_X11_LIB}")
SET (glfw_dependencies
${X11_X11_LIB}
${X11_Xrandr_LIB}
${X11_Xinerama_LIB}
${X11_Xinput_LIB}
${X11_Xcursor_LIB}
${X11_Xxf86vm_LIB}
${CMAKE_DL_LIBS}
${CMAKE_THREAD_LIBS_INIT}
)
2016-08-31 19:30:31 +02:00
TARGET_LINK_LIBRARIES ( protot
2016-08-29 22:31:11 +02:00
glfw
2018-12-23 11:20:54 +01:00
fcl
2018-12-26 23:40:59 +01:00
physfs
2016-08-29 22:31:11 +02:00
${glfw_dependencies}
${OPENGL_LIBRARIES}
)