-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b7da09
commit c67ecb6
Showing
3 changed files
with
108 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,129 @@ | ||
# | ||
# Project Properties | ||
# | ||
CMAKE_MINIMUM_REQUIRED (VERSION 2.8) | ||
PROJECT (glfw-skeleton) | ||
SET (APPLICATION_NAME "GLFW Skeleton") | ||
SET (APPLICATION_CODENAME "${PROJECT_NAME}") | ||
SET (APPLICATION_COPYRIGHT_YEARS "2014") | ||
SET (APPLICATION_VERSION_MAJOR 2) | ||
SET (APPLICATION_VERSION_MINOR 0) | ||
SET (APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}") | ||
SET (APPLICATION_ID "${APPLICATION_VENDOR_ID}.${PROJECT_NAME}") | ||
|
||
|
||
# Copy directory only | ||
|
||
macro(copy_files srcDir destDir) | ||
message(STATUS "Copying directory ${destDir}") | ||
make_directory(${destDir}) | ||
|
||
file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*) | ||
foreach(templateFile ${templateFiles}) | ||
set(srcTemplatePath ${srcDir}/${templateFile}) | ||
if(NOT IS_DIRECTORY ${srcTemplatePath}) | ||
message(STATUS "Copying file ${templateFile}") | ||
file(COPY ${srcTemplatePath} DESTINATION ${destDir}) | ||
endif(NOT IS_DIRECTORY ${srcTemplatePath}) | ||
endforeach(templateFile) | ||
endmacro(copy_files) | ||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12) | ||
PROJECT(glfw-skeleton) | ||
SET(APPLICATION_NAME "GLFW Skeleton") | ||
SET(APPLICATION_CODENAME "${PROJECT_NAME}") | ||
SET(APPLICATION_COPYRIGHT_YEARS "2014") | ||
SET(APPLICATION_VERSION_MAJOR 2) | ||
SET(APPLICATION_VERSION_MINOR 0) | ||
SET(APPLICATION_VERSION_STRING "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}-${APPLICATION_VERSION_TYPE}") | ||
SET(APPLICATION_ID "${APPLICATION_VENDOR_ID}.${PROJECT_NAME}") | ||
|
||
# | ||
# Copy directory contents | ||
# | ||
MACRO(COPY_FILES srcDir destDir) | ||
MESSAGE(STATUS "Copying contents of directory ${srcDir} to ${destDir}") | ||
MAKE_DIRECTORY(${destDir}) | ||
|
||
FILE(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*) | ||
FOREACH(templateFile ${templateFiles}) | ||
SET(srcTemplatePath ${srcDir}/${templateFile}) | ||
IF(NOT IS_DIRECTORY ${srcTemplatePath}) | ||
MESSAGE(STATUS "Copying file ${templateFile}") | ||
FILE(COPY ${srcTemplatePath} DESTINATION ${destDir}) | ||
ENDIF(NOT IS_DIRECTORY ${srcTemplatePath}) | ||
ENDFOREACH(templateFile) | ||
ENDMACRO() | ||
|
||
# | ||
# Debugging Options | ||
# | ||
SET (CMAKE_VERBOSE_MAKEFILE 0) # Use 1 for debugging, 0 for release | ||
SET(CMAKE_VERBOSE_MAKEFILE 0) # Use 1 for debugging, 0 for release | ||
|
||
# | ||
# Project Output Paths | ||
# | ||
SET (MAINFOLDER ${PROJECT_SOURCE_DIR}) | ||
SET (EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin") | ||
SET (LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib") | ||
SET(MAINFOLDER ${PROJECT_SOURCE_DIR}) | ||
SET(EXECUTABLE_OUTPUT_PATH "${MAINFOLDER}/bin") | ||
SET(LIBRARY_OUTPUT_PATH "${MAINFOLDER}/lib") | ||
|
||
# | ||
# Project Search Paths | ||
# | ||
LIST (APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}") | ||
LIST(APPEND CMAKE_PREFIX_PATH "${MAINFOLDER}") | ||
INCLUDE_DIRECTORIES("${MAINFOLDER}/include") | ||
|
||
# set compiler warnings | ||
|
||
set(CMAKE_CXX_FLAGS "-g -O0 -Wall -Wextra -Werror -Wfloat-equal -Wno-unused-parameter -Wno-unknown-pragmas") | ||
|
||
# set c++ 11 | ||
# | ||
# Set compiler warnings | ||
# | ||
SET(CMAKE_CXX_FLAGS "-g -O0 -Wall -Wextra -Werror -Wfloat-equal -Wno-unused-parameter -Wno-unknown-pragmas") | ||
|
||
if (CMAKE_COMPILER_IS_GNUCXX) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") | ||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") | ||
endif () | ||
elseif (MSVC) | ||
# | ||
# Enable C++11 | ||
# | ||
IF(CMAKE_COMPILER_IS_GNUCXX) | ||
IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.7") | ||
MESSAGE(FATAL_ERROR "Compiler does not support C++11") | ||
ELSE() | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") | ||
ENDIF() | ||
ELSEIF(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++") | ||
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") | ||
SET(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") | ||
ENDIF() | ||
ELSEIF(MSVC) | ||
# On by default | ||
endif () | ||
|
||
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++") | ||
ELSE() | ||
MESSAGE(FATAL_ERROR "Compiler not supported") | ||
ENDIF() | ||
|
||
# | ||
# Locate Project Prerequisites | ||
# glfw | ||
# | ||
OPTION(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) | ||
OPTION(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) | ||
OPTION(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) | ||
OPTION(GLFW_INSTALL "Generate installation target" OFF) | ||
|
||
# GLFW | ||
|
||
# disable unnecessary glfw targets | ||
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) | ||
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) | ||
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) | ||
option(GLFW_INSTALL "Generate installation target" OFF) | ||
|
||
# GLEW | ||
ADD_SUBDIRECTORY(lib/glfw) | ||
|
||
OPTION( glew-cmake_BUILD_SHARED "Build the shared glew library" OFF) | ||
add_subdirectory(lib/glew) | ||
set(GLEW_INCLUDE_PATH "${MAINFOLDER}/lib/glew/include") | ||
SET(GLFW_INCLUDE_PATH "${MAINFOLDER}/lib/glfw/include") | ||
|
||
# add subdirectory | ||
add_subdirectory(lib/glfw) | ||
set(GLFW_INCLUDE_PATH "${MAINFOLDER}/lib/glfw/include") | ||
# | ||
# glew | ||
# | ||
OPTION(glew-cmake_BUILD_SHARED "Build the shared glew library" OFF) | ||
ADD_SUBDIRECTORY(lib/glew) | ||
|
||
# GLM | ||
SET(GLEW_INCLUDE_PATH "${MAINFOLDER}/lib/glew/include") | ||
|
||
set(GLM_INCLUDE_PATH "${MAINFOLDER}/lib/glm") | ||
# | ||
# glm | ||
# | ||
SET(GLM_INCLUDE_PATH "${MAINFOLDER}/lib/glm") | ||
|
||
# | ||
# gmock | ||
# | ||
ADD_SUBDIRECTORY(lib/gmock) | ||
|
||
# GMOCK | ||
SET(GTEST_INCLUDE_PATH "${gtest_SOURCE_DIR}/include") | ||
SET(GMOCK_INCLUDE_PATH "${gmock_SOURCE_DIR}/include") | ||
|
||
add_subdirectory(lib/gmock) | ||
set_property(TARGET gmock APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
set_property(TARGET gmock_main APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
set_property(TARGET gtest APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
set_property(TARGET gtest_main APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
set(GTEST_INCLUDE_PATH "${gtest_SOURCE_DIR}/include") | ||
set(GMOCK_INCLUDE_PATH "${gmock_SOURCE_DIR}/include") | ||
SET_PROPERTY(TARGET gmock APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
SET_PROPERTY(TARGET gmock_main APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
SET_PROPERTY(TARGET gtest APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
SET_PROPERTY(TARGET gtest_main APPEND_STRING PROPERTY COMPILE_FLAGS " -w") | ||
|
||
# BANDIT | ||
# | ||
# Bandit | ||
# | ||
ADD_SUBDIRECTORY(lib/bandit) | ||
|
||
add_subdirectory(lib/bandit) | ||
set(BANDIT_INCLUDE_PATH "${MAINFOLDER}/lib/bandit") | ||
SET(BANDIT_INCLUDE_PATH "${MAINFOLDER}/lib/bandit") | ||
|
||
# | ||
# Add Build Targets | ||
# Add project sources | ||
# | ||
ADD_SUBDIRECTORY(src) | ||
|
||
enable_testing() | ||
ADD_SUBDIRECTORY(test) | ||
|
||
# | ||
# Add Install Targets | ||
# Add test sources and enable testing | ||
# | ||
IF (EXISTS "${MAINFOLDER}/include/${PROJECT_NAME}" AND IS_DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}") | ||
INSTALL(DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}" DESTINATION "include") | ||
ENDIF (EXISTS "${MAINFOLDER}/include/${PROJECT_NAME}" AND IS_DIRECTORY "${MAINFOLDER}/include/${PROJECT_NAME}") | ||
ENABLE_TESTING() | ||
|
||
ADD_SUBDIRECTORY(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
FILE (GLOB_RECURSE test_SRCS *.cpp *.cxx *.cc *.C *.c *.h *.hpp) | ||
SET (test_LIBS gtest gtest_main gmock gmock_main libglew_static glfw ${GLFW_LIBRARIES}) | ||
SET (test_BIN ${PROJECT_NAME}-unittests) | ||
FILE(GLOB_RECURSE test_SRCS *.cpp *.cxx *.cc *.C *.c *.h *.hpp) | ||
|
||
include_directories(${GMOCK_INCLUDE_PATH} | ||
SET(test_LIBS gtest gtest_main gmock gmock_main libglew_static glfw ${GLFW_LIBRARIES}) | ||
|
||
SET(test_BIN ${PROJECT_NAME}-unittests) | ||
|
||
INCLUDE_DIRECTORIES(${GMOCK_INCLUDE_PATH} | ||
${GTEST_INCLUDE_PATH} | ||
${BANDIT_INCLUDE_PATH} | ||
${GLFW_INCLUDE_PATH} | ||
${GLEW_INCLUDE_PATH}) | ||
|
||
# message("Output sources") | ||
# foreach(source ${ALL_SRCS}) | ||
# message(${source}) | ||
# endforeach() | ||
|
||
ADD_EXECUTABLE(${test_BIN} ${test_SRCS} ${ALL_SRCS}) | ||
TARGET_LINK_LIBRARIES(${test_BIN} ${test_LIBS}) | ||
|
||
|
||
TARGET_LINK_LIBRARIES(${test_BIN} ${test_LIBS}) | ||
|
||
ADD_TEST(${test_BIN} ${EXECUTABLE_OUTPUT_PATH}/${test_BIN} --reporter=spec) |