mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 07:58:59 +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)
|
macro(AUTO_MTC TARGET ROOT_DIR)
|
||||||
if (NOT TARGET mtc)
|
if (NOT TARGET mtc)
|
||||||
add_subdirectory("${ROOT_DIR}/tools/mtc" "${ROOT_DIR}/tools/mtc")
|
add_subdirectory("${ROOT_DIR}/tools/mtc" "${ROOT_DIR}/tools/mtc")
|
||||||
endif (NOT TARGET mtc)
|
endif ()
|
||||||
|
|
||||||
set(AUTOMTC_SRC ${TARGET}_automtc.cpp)
|
set(AUTOMTC_SRC ${TARGET}_automtc.cpp)
|
||||||
|
|
||||||
file(GLOB INCLUDE_FILES src/*.h)
|
file(GLOB INCLUDE_FILES src/*.h)
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND mtc -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS mtc ${INCLUDE_FILES})
|
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND mtc -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS mtc ${INCLUDE_FILES})
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
MACRO(INCLUDE_GLM TARGET ROOT_DIR)
|
macro(INCLUDE_GLM TARGET ROOT_DIR)
|
||||||
|
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
include_directories("${GLM_INCLUDE_DIRS}")
|
include_directories("${GLM_INCLUDE_DIRS}")
|
||||||
IF(APPLE OR UNIX)
|
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${GLM_INCLUDE_DIRS}")
|
if(APPLE OR UNIX)
|
||||||
ENDIF(APPLE OR UNIX)
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${GLM_INCLUDE_DIRS}")
|
||||||
ENDMACRO(INCLUDE_GLM _target _root_dir)
|
endif(APPLE OR UNIX)
|
||||||
|
|
||||||
|
endmacro(INCLUDE_GLM _target _root_dir)
|
|
@ -1,16 +1,18 @@
|
||||||
MACRO(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
|
macro(LINK_HIFI_LIBRARY LIBRARY TARGET ROOT_DIR)
|
||||||
if (NOT TARGET ${LIBRARY})
|
|
||||||
add_subdirectory("${ROOT_DIR}/libraries/${LIBRARY}" "${ROOT_DIR}/libraries/${LIBRARY}")
|
if (NOT TARGET ${LIBRARY})
|
||||||
endif (NOT TARGET ${LIBRARY})
|
add_subdirectory("${ROOT_DIR}/libraries/${LIBRARY}" "${ROOT_DIR}/libraries/${LIBRARY}")
|
||||||
|
endif ()
|
||||||
include_directories("${ROOT_DIR}/libraries/${LIBRARY}/src")
|
|
||||||
|
include_directories("${ROOT_DIR}/libraries/${LIBRARY}/src")
|
||||||
|
|
||||||
add_dependencies(${TARGET} ${LIBRARY})
|
add_dependencies(${TARGET} ${LIBRARY})
|
||||||
target_link_libraries(${TARGET} ${LIBRARY})
|
target_link_libraries(${TARGET} ${LIBRARY})
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# currently the "shared" library requires CoreServices
|
# currently the "shared" library requires CoreServices
|
||||||
# link in required OS X framework
|
# link in required OS X framework
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework CoreServices")
|
||||||
endif (APPLE)
|
endif ()
|
||||||
ENDMACRO(LINK_HIFI_LIBRARY _library _target _root_dir)
|
|
||||||
|
endmacro(LINK_HIFI_LIBRARY _library _target _root_dir)
|
|
@ -1,15 +1,17 @@
|
||||||
MACRO(SETUP_HIFI_LIBRARY TARGET)
|
macro(SETUP_HIFI_LIBRARY TARGET)
|
||||||
project(${TARGET})
|
|
||||||
|
project(${TARGET})
|
||||||
|
|
||||||
# grab the implemenation and header files
|
# grab the implemenation and header files
|
||||||
file(GLOB LIB_SRCS src/*.h src/*.cpp)
|
file(GLOB LIB_SRCS src/*.h src/*.cpp)
|
||||||
set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS})
|
set(LIB_SRCS ${LIB_SRCS} ${WRAPPED_SRCS})
|
||||||
|
|
||||||
# create a library and set the property so it can be referenced later
|
# create a library and set the property so it can be referenced later
|
||||||
add_library(${TARGET} ${LIB_SRCS} ${ARGN})
|
add_library(${TARGET} ${LIB_SRCS} ${ARGN})
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
qt5_use_modules(${TARGET} Core)
|
qt5_use_modules(${TARGET} Core)
|
||||||
|
|
||||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||||
ENDMACRO(SETUP_HIFI_LIBRARY _target)
|
|
||||||
|
endmacro(SETUP_HIFI_LIBRARY _target)
|
|
@ -1,24 +1,25 @@
|
||||||
macro(SETUP_HIFI_PROJECT TARGET INCLUDE_QT)
|
macro(SETUP_HIFI_PROJECT TARGET INCLUDE_QT)
|
||||||
project(${TARGET})
|
project(${TARGET})
|
||||||
|
|
||||||
# grab the implemenation and header files
|
# grab the implemenation and header files
|
||||||
file(GLOB TARGET_SRCS src/*)
|
file(GLOB TARGET_SRCS src/*)
|
||||||
|
|
||||||
file(GLOB SRC_SUBDIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/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}")
|
foreach(DIR ${SRC_SUBDIRS})
|
||||||
FILE(GLOB DIR_CONTENTS "src/${DIR}/*")
|
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/${DIR}")
|
||||||
SET(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}")
|
file(GLOB DIR_CONTENTS "src/${DIR}/*")
|
||||||
endif()
|
set(TARGET_SRCS ${TARGET_SRCS} "${DIR_CONTENTS}")
|
||||||
endforeach()
|
endif()
|
||||||
|
endforeach()
|
||||||
# add the executable, include additional optional sources
|
|
||||||
add_executable(${TARGET} ${TARGET_SRCS} ${ARGN})
|
# add the executable, include additional optional sources
|
||||||
|
add_executable(${TARGET} ${TARGET_SRCS} ${ARGN})
|
||||||
IF (${INCLUDE_QT})
|
|
||||||
find_package(Qt5Core REQUIRED)
|
if (${INCLUDE_QT})
|
||||||
qt5_use_modules(${TARGET} Core)
|
find_package(Qt5Core REQUIRED)
|
||||||
ENDIF()
|
qt5_use_modules(${TARGET} Core)
|
||||||
|
endif ()
|
||||||
|
|
||||||
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
target_link_libraries(${TARGET} ${QT_LIBRARIES})
|
||||||
endmacro()
|
endmacro()
|
|
@ -33,10 +33,19 @@ IF (WIN32)
|
||||||
DOC "The GLEW library")
|
DOC "The GLEW library")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF (GLEW_INCLUDE_PATH)
|
if (GLEW_INCLUDE_DIRS AND GLEW_LIBRARY)
|
||||||
SET( GLEW_FOUND 1 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
set(GLEW_FOUND TRUE)
|
||||||
ELSE (GLEW_INCLUDE_PATH)
|
endif ()
|
||||||
SET( GLEW_FOUND 0 CACHE STRING "Set to 1 if GLEW is found, 0 otherwise")
|
|
||||||
ENDIF (GLEW_INCLUDE_PATH)
|
|
||||||
|
|
||||||
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