|
|
@ -1,54 +1,31 @@ |
|
|
|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) |
|
|
|
project(openglapp VERSION 0.1.0) |
|
|
|
|
|
|
|
include(CTest) |
|
|
|
enable_testing() |
|
|
|
|
|
|
|
# Variables |
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8) |
|
|
|
set(PLATFORM_ARCH "64") |
|
|
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) |
|
|
|
set(PLATFORM_ARCH "32") |
|
|
|
endif() |
|
|
|
|
|
|
|
# Global |
|
|
|
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") |
|
|
|
set(INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
|
|
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib") |
|
|
|
|
|
|
|
# Includes |
|
|
|
include_directories(${INCLUDE_DIR}) |
|
|
|
|
|
|
|
# Source |
|
|
|
file(GLOB SOURCES "${SRC_DIR}/*.cpp") |
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME} ${SOURCES}) |
|
|
|
|
|
|
|
# GLAD |
|
|
|
set(GLAD_DIR "${LIB_DIR}/glad") |
|
|
|
add_library("glad" "${GLAD_DIR}/src/glad.c") |
|
|
|
target_include_directories("glad" PRIVATE "${GLAD_DIR}/include") |
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${GLAD_DIR}/include") |
|
|
|
target_link_libraries(${PROJECT_NAME} "glad" "${CMAKE_DL_LIBS}") |
|
|
|
|
|
|
|
# GLFW |
|
|
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) |
|
|
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) |
|
|
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) |
|
|
|
set(GLFW_DIR "${LIB_DIR}/glfw-3.2.1") |
|
|
|
add_subdirectory("${GLFW_DIR}") |
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${GLFW_DIR}/include") |
|
|
|
|
|
|
|
# GLM |
|
|
|
set(GLM_TEST_ENABLE OFF CACHE BOOL "" FORCE) |
|
|
|
set(GLM_DIR "${LIB_DIR}/glm") |
|
|
|
add_subdirectory("${GLM_DIR}") |
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE "${GLM_DIR}/glm") |
|
|
|
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) |
|
|
|
target_link_libraries(${PROJECT_NAME} glfw) |
|
|
|
target_link_libraries(${PROJECT_NAME} glm) |
|
|
|
|
|
|
|
set(CPACK_PROJECT_NAME ${PROJECT_NAME}) |
|
|
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) |
|
|
|
include(CPack) |
|
|
|
# Projects Settings |
|
|
|
cmake_minimum_required (VERSION 3.1) |
|
|
|
project (opengl-skeleton) |
|
|
|
|
|
|
|
# The main executable |
|
|
|
add_executable(main |
|
|
|
src/Application.cpp |
|
|
|
src/Application.cpp |
|
|
|
src/MyApplication.cpp |
|
|
|
src/MyApplication.cpp |
|
|
|
src/glError.hpp |
|
|
|
src/glError.cpp |
|
|
|
src/main.cpp |
|
|
|
src/Shader.hpp |
|
|
|
src/Shader.cpp |
|
|
|
) |
|
|
|
set_property(TARGET main PROPERTY CXX_STANDARD 11) |
|
|
|
target_compile_options(main PRIVATE -Wall) |
|
|
|
|
|
|
|
# glfw |
|
|
|
add_subdirectory(lib/glfw EXCLUDE_FROM_ALL) |
|
|
|
target_link_libraries(main PRIVATE glfw) |
|
|
|
|
|
|
|
# glew |
|
|
|
add_definitions(-DGLEW_STATIC) |
|
|
|
add_subdirectory(lib/glew EXCLUDE_FROM_ALL) |
|
|
|
target_link_libraries(main PRIVATE libglew_static) |
|
|
|
|
|
|
|
# glm |
|
|
|
add_subdirectory(lib/glm EXCLUDE_FROM_ALL) |
|
|
|
target_link_libraries(main PRIVATE glm) |