mirror of
https://github.com/lubosz/overte.git
synced 2025-04-12 09:42:28 +02:00
cmake styling cleanup and glew module fixes
This commit is contained in:
parent
dceddc8ac4
commit
40bd46c782
6 changed files with 85 additions and 69 deletions
|
@ -1,14 +1,13 @@
|
|||
macro(AUTO_MTC TARGET ROOT_DIR)
|
||||
if (NOT TARGET mtc)
|
||||
add_subdirectory("${ROOT_DIR}/tools/mtc" "${ROOT_DIR}/tools/mtc")
|
||||
endif (NOT TARGET mtc)
|
||||
|
||||
set(AUTOMTC_SRC ${TARGET}_automtc.cpp)
|
||||
|
||||
file(GLOB INCLUDE_FILES src/*.h)
|
||||
|
||||
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND mtc -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS mtc ${INCLUDE_FILES})
|
||||
|
||||
if (NOT TARGET mtc)
|
||||
add_subdirectory("${ROOT_DIR}/tools/mtc" "${ROOT_DIR}/tools/mtc")
|
||||
endif ()
|
||||
|
||||
set(AUTOMTC_SRC ${TARGET}_automtc.cpp)
|
||||
|
||||
file(GLOB INCLUDE_FILES src/*.h)
|
||||
|
||||
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND mtc -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS mtc ${INCLUDE_FILES})
|
||||
endmacro()
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
MACRO(INCLUDE_GLM TARGET ROOT_DIR)
|
||||
macro(INCLUDE_GLM TARGET ROOT_DIR)
|
||||
|
||||
find_package(GLM REQUIRED)
|
||||
include_directories("${GLM_INCLUDE_DIRS}")
|
||||
IF(APPLE OR UNIX)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${GLM_INCLUDE_DIRS}")
|
||||
ENDIF(APPLE OR UNIX)
|
||||
ENDMACRO(INCLUDE_GLM _target _root_dir)
|
||||
|
||||
if(APPLE OR UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${GLM_INCLUDE_DIRS}")
|
||||
endif(APPLE OR UNIX)
|
||||
|
||||
endmacro(INCLUDE_GLM _target _root_dir)
|
|
@ -1,16 +1,18 @@
|
|||
MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
|
||||
if (NOT TARGET ${LIBRARY})
|
||||
add_subdirectory("${ROOT_DIR}/libraries/${LIBRARY}" "${ROOT_DIR}/libraries/${LIBRARY}")
|
||||
endif (NOT TARGET ${LIBRARY})
|
||||
|
||||
include_directories("${ROOT_DIR}/libraries/${LIBRARY}/src")
|
||||
macro(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
|
||||
|
||||
if (NOT TARGET ${LIBRARY})
|
||||
add_subdirectory("${ROOT_DIR}/libraries/${LIBRARY}" "${ROOT_DIR}/libraries/${LIBRARY}")
|
||||
endif ()
|
||||
|
||||
include_directories("${ROOT_DIR}/libraries/${LIBRARY}/src")
|
||||
|
||||
add_dependencies(${TARGET} ${LIBRARY})
|
||||
target_link_libraries(${TARGET} ${LIBRARY})
|
||||
|
||||
if (APPLE)
|
||||
# currently the "shared" library requires CoreServices
|
||||
# link in required OS X framework
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
|
||||
endif (APPLE)
|
||||
ENDMACRO(LINK_HIFI_LIBRARY _library _target _root_dir)
|
||||
add_dependencies(${TARGET} ${LIBRARY})
|
||||
target_link_libraries(${TARGET} ${LIBRARY})
|
||||
|
||||
if (APPLE)
|
||||
# currently the "shared" library requires CoreServices
|
||||
# link in required OS X framework
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
|
||||
endif ()
|
||||
|
||||
endmacro(LINK_HIFI_LIBRARY _library _target _root_dir)
|
|
@ -1,15 +1,17 @@
|
|||
MACRO(SETUP_HIFI_LIBRARY TARGET)
|
||||
project(${TARGET})
|
||||
macro(SETUP_HIFI_LIBRARY TARGET)
|
||||
|
||||
project(${TARGET})
|
||||
|
||||
# grab the implemenation and header files
|
||||
file(GLOB LIB_SRCS src/*.h src/*.cpp)
|
||||
set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS})
|
||||
# grab the implemenation and header files
|
||||
file(GLOB LIB_SRCS src/*.h src/*.cpp)
|
||||
set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS})
|
||||
|
||||
# create a library and set the property so it can be referenced later
|
||||
add_library(${TARGET} ${LIB_SRCS} ${ARGN})
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
qt5_use_modules(${TARGET} Core)
|
||||
# create a library and set the property so it can be referenced later
|
||||
add_library(${TARGET} ${LIB_SRCS} ${ARGN})
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
qt5_use_modules(${TARGET} Core)
|
||||
|
||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||
ENDMACRO(SETUP_HIFI_LIBRARY _target)
|
||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||
|
||||
endmacro(SETUP_HIFI_LIBRARY _target)
|
|
@ -1,24 +1,25 @@
|
|||
macro(SETUP_HIFI_PROJECT TARGET INCLUDE_QT)
|
||||
project(${TARGET})
|
||||
|
||||
# grab the implemenation and header files
|
||||
file(GLOB TARGET_SRCS src/*)
|
||||
|
||||
file(GLOB SRC_SUBDIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/*)
|
||||
foreach(DIR ${SRC_SUBDIRS})
|
||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}")
|
||||
FILE(GLOB DIR_CONTENTS "src/${DIR}/*")
|
||||
SET(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# add the executable, include additional optional sources
|
||||
add_executable(${TARGET} ${TARGET_SRCS} ${ARGN})
|
||||
|
||||
IF (${INCLUDE_QT})
|
||||
find_package(Qt5Core REQUIRED)
|
||||
qt5_use_modules(${TARGET} Core)
|
||||
ENDIF()
|
||||
project(${TARGET})
|
||||
|
||||
# grab the implemenation and header files
|
||||
file(GLOB TARGET_SRCS src/*)
|
||||
|
||||
file(GLOB SRC_SUBDIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/*)
|
||||
|
||||
foreach(DIR ${SRC_SUBDIRS})
|
||||
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}")
|
||||
file(GLOB DIR_CONTENTS "src/${DIR}/*")
|
||||
set(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# add the executable, include additional optional sources
|
||||
add_executable(${TARGET} ${TARGET_SRCS} ${ARGN})
|
||||
|
||||
if (${INCLUDE_QT})
|
||||
find_package(Qt5Core REQUIRED)
|
||||
qt5_use_modules(${TARGET} Core)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||
endmacro()
|
|
@ -33,10 +33,19 @@ IF (WIN32)
|
|||
DOC "The GLEW library")
|
||||
ENDIF()
|
||||
|
||||
IF (GLEW_INCLUDE_PATH)
|
||||
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
ELSE (GLEW_INCLUDE_PATH)
|
||||
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
||||
ENDIF (GLEW_INCLUDE_PATH)
|
||||
if (GLEW_INCLUDE_DIRS AND GLEW_LIBRARY)
|
||||
set(GLEW_FOUND TRUE)
|
||||
endif ()
|
||||
|
||||
MARK_AS_ADVANCED(GLEW_FOUND)
|
||||
if (GLEW_FOUND)
|
||||
if (NOT GLEW_FIND_QUIETLY)
|
||||
message(STATUS "Found GLEW: ${GLEW_LIBRARY}")
|
||||
endif (NOT GLEW_FIND_QUIETLY)
|
||||
else ()
|
||||
if (GLEW_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find GLEW")
|
||||
endif (GLEW_FIND_REQUIRED)
|
||||
endif ()
|
||||
|
||||
# show the GLEW_INCLUDE_DIRS and GLEW_LIBRARY variables only in the advanced view
|
||||
mark_as_advanced(GLEW_INCLUDE_DIRS GLEW_LIBRARY)
|
Loading…
Reference in a new issue