From 8c8309c1f4df17c52a110936439b353bd821e3fd Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Mon, 18 Feb 2013 11:08:12 -0800 Subject: [PATCH] add some comments to the CMakeLists files --- domain/CMakeLists.txt | 3 +++ interface/CMakeLists.txt | 26 +++++++++++++++++++++----- mixer/CMakeLists.txt | 9 +++++---- shared/CMakeLists.txt | 2 ++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/domain/CMakeLists.txt b/domain/CMakeLists.txt index 59cfa685e3..4a7f77910f 100644 --- a/domain/CMakeLists.txt +++ b/domain/CMakeLists.txt @@ -2,9 +2,12 @@ cmake_minimum_required(VERSION 2.8) project(domain) +# grab the implementation / header files file(GLOB DOMAIN_SRCS src/*.cpp src/*.h) +# add an executable with the source files add_executable(domain ${DOMAIN_SRCS}) +# link the shared hifi library include(../LinkHifiShared.cmake) link_hifi_shared_library(domain) \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 4476555028..c75f77cbec 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 2.8) +# setup for find modules set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") set(GLM_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external) set(LODEPNG_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/LodePNG) @@ -8,19 +9,22 @@ set(PORTAUDIO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/portaudio) project(interface) if (APPLE) + # link in required OS X frameworks and include the right GL headers set(CMAKE_EXE_LINKER_FLAGS "-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework CoreServices -framework Carbon") set(GL_HEADERS "#include \n#include ") else (APPLE) + # include the right GL headers for UNIX set(GL_HEADERS "#include \n#include \n#include ") endif (APPLE) +# create the InterfaceConfig.h file based on GL_HEADERS above configure_file(InterfaceConfig.h.in ${PROJECT_BINARY_DIR}/includes/InterfaceConfig.h) +# grab the implementation and header files from src dir file(GLOB INTERFACE_SRCS src/*.cpp src/*.h) -# For Apple set the icns file containing icons IF(APPLE) - # set how it shows up in the Info.plist file + # set how the icon shows up in the Info.plist file SET(MACOSX_BUNDLE_ICON_FILE interface.icns) # set where in the bundle to put the icns file SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/interface.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources) @@ -28,16 +32,20 @@ IF(APPLE) SET(INTERFACE_SRCS ${INTERFACE_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/interface.icns) ENDIF(APPLE) +# create the executable, make it a bundle on OS X add_executable(interface MACOSX_BUNDLE ${INTERFACE_SRCS}) +# link in the hifi shared library include(../LinkHifiShared.cmake) link_hifi_shared_library(interface) +# find required libraries find_package(OpenGL REQUIRED) find_package(GLUT REQUIRED) find_package(GLM REQUIRED) find_package(LodePNG REQUIRED) +# include headers for external libraries and InterfaceConfig. include_directories( ${PROJECT_BINARY_DIR}/includes ${OPENGL_INCLUDE_DIRS} @@ -46,12 +54,14 @@ include_directories( ${LODEPNG_INCLUDE_DIRS} ) +# link target to external libraries target_link_libraries(interface ${OPENGL_LIBRARY} ${GLUT_LIBRARY} ${LODEPNG_LIBRARY} ) +# include PortAudio as external project include(ExternalProject) set(PORTAUDIO_PROJ_DIR external/portaudio) ExternalProject_Add( @@ -63,13 +73,18 @@ ExternalProject_Add( BUILD_COMMAND make ) -ExternalProject_Get_Property(portaudio binary_dir) -ExternalProject_Get_Property(portaudio source_dir) -include_directories(${source_dir}/include) +# make PortAudio a dependency of the interface executable add_dependencies(interface portaudio) +# include the PortAudio headers +ExternalProject_Get_Property(portaudio source_dir) +include_directories(${source_dir}/include) + +# link the PortAudio library +ExternalProject_Get_Property(portaudio binary_dir) target_link_libraries(interface ${binary_dir}/lib/.libs/libportaudio.a) +# link required libraries on UNIX if (UNIX AND NOT APPLE) find_package(Threads REQUIRED) find_package(Librt REQUIRED) @@ -84,6 +99,7 @@ if (UNIX AND NOT APPLE) ) endif (UNIX AND NOT APPLE) +# install command for OS X bundle INSTALL(TARGETS interface BUNDLE DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/install COMPONENT Runtime RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/install COMPONENT Runtime diff --git a/mixer/CMakeLists.txt b/mixer/CMakeLists.txt index 00b2032aba..8c429b35e5 100644 --- a/mixer/CMakeLists.txt +++ b/mixer/CMakeLists.txt @@ -2,15 +2,16 @@ cmake_minimum_required(VERSION 2.8) project(mixer) +# grab the implemenation and header files file(GLOB MIXER_SRCS src/*.cpp src/*.h) +# add the mixer executable add_executable(mixer ${MIXER_SRCS}) +# link the shared hifi library include(../LinkHifiShared.cmake) link_hifi_shared_library(mixer) +# link the threads library find_package(Threads REQUIRED) -target_link_libraries(mixer - ${CMAKE_THREAD_LIBS_INIT} - ${HIFI_SHARED_LIBRARY} -) \ No newline at end of file +target_link_libraries(mixer ${CMAKE_THREAD_LIBS_INIT}) \ No newline at end of file diff --git a/shared/CMakeLists.txt b/shared/CMakeLists.txt index 3fb85b8495..afe855d47e 100644 --- a/shared/CMakeLists.txt +++ b/shared/CMakeLists.txt @@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 2.8) project(shared) +# grab the implemenation and header files file(GLOB HIFI_SHARED_SRCS src/*.h src/*.cpp) +# create a library and set the property so it can be referenced later add_library(HifiShared ${HIFI_SHARED_SRCS}) set(HIFI_SHARED_LIBRARY HifiShared) \ No newline at end of file