summaryrefslogblamecommitdiffstats
path: root/CMakeLists.txt
blob: 0f26a295419c8c096042c2891f986e78382566a1 (plain) (tree)
1
2
3
4
5
6
7
8





                                   
                                                         
                                                                      








                                                
                                              
 

                                                
 

     


                                









                                      






















                                                                                                    

                                                              
                                                            
 


                                                                               







                          
                  



                               






                                                                             
cmake_minimum_required(VERSION 2.6)

# project name
project(vmchooser)

set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -Wextra -Werror")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -Wall -Wextra -Werror")

set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(OPENSLX_ROOT "../../../..")
#set(OPENSLX_ROOT "~/hiwi/openslx")

file(GLOB_RECURSE VMCHOOSER_SOURCES src/*.cpp)
file(GLOB_RECURSE VMCHOOSER_MOC_HEADERS src/*.h)
file(GLOB_RECURSE VMCHOOSER_UIS src/ui/*.ui)
file(GLOB_RECURSE VMCHOOSER_RESOURCES src/*.qrc)
file(GLOB_RECURSE VMCHOOSER_TSS src/i18n/*.ts)

include_directories(${CMAKE_CURRENT_BINARY_DIR})

#
# Qt4
#
find_package(Qt4 4.5.0 REQUIRED)
if(QT4_FOUND)
  message(STATUS "Qt4 found")
else(QT4_FOUND)
  message(FATAL_ERROR "Qt4 not found")
endif(QT4_FOUND)

set(QT_USE_QTDBUS TRUE)
set(QT_USE_QTXML TRUE)
set(QT_USE_QTSVG TRUE)

include(${QT_USE_FILE})

option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)")
if(VMCHOOSER_TSS)
  if (UPDATE_TRANSLATIONS)
    set (FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${VMCHOOSER_SOURCES} ${VMCHOOSER_UIS})
    QT4_CREATE_TRANSLATION(VMCHOOSER_QMS ${FILES_TO_TRANSLATE} ${VMCHOOSER_TSS} OPTIONS -noobsolete)
    message(STATUS ".tr files have been updated")
  else (UPDATE_TRANSLATIONS)
    QT4_ADD_TRANSLATION(VMCHOOSER_QMS ${VMCHOOSER_TSS})
  endif (UPDATE_TRANSLATIONS)

  # write a resource file for qm files
  set(resource_file_content "<RCC>\n    <qresource prefix=\"/\">\n")
  foreach(file ${VMCHOOSER_QMS})
    get_filename_component(filename ${file} NAME)
    set(resource_file_content "${resource_file_content}        <file>${filename}</file>\n")
  endforeach(file)
  set(resource_file_content "${resource_file_content}    </qresource>\n</RCC>\n")
  file(WRITE "${CMAKE_BINARY_DIR}/translation.qrc" "${resource_file_content}")
  set(VMCHOOSER_RESOURCES ${VMCHOOSER_RESOURCES} "${CMAKE_BINARY_DIR}/translation.qrc")

  #add_custom_target(translations_target DEPENDS ${VMCHOOSER_QMS})
endif(VMCHOOSER_TSS)

QT4_ADD_RESOURCES(VMCHOOSER_RC_SOURCES ${VMCHOOSER_RESOURCES})
QT4_WRAP_UI(VMCHOOSER_UI_HEADERS ${VMCHOOSER_UIS})
QT4_WRAP_CPP(VMCHOOSER_MOC_SOURCES ${VMCHOOSER_MOC_HEADERS})

# run qdbusxml2cpp on org.openslx.pvs.xml (taken from pvs build)
QT4_ADD_DBUS_INTERFACE(VMCHOOSER_SOURCES src/org.openslx.pvs.xml pvsinterface )

#
# build vmchooser
#
add_executable(vmchooser
  ${VMCHOOSER_SOURCES}
  ${VMCHOOSER_MOC_SOURCES}
  ${VMCHOOSER_UI_HEADERS}
  ${VMCHOOSER_RC_SOURCES}
  ${VMCHOOSER_QMS}
)

target_link_libraries(vmchooser
  ${QT_LIBRARIES}
)

#install(TARGETS vmchooser RUNTIME DESTINATION 
#	"${OPENSLX_ROOT}/openslx/trunk/os-plugins/plugins/vmchooser/files/") 

install(TARGETS vmchooser RUNTIME DESTINATION 
	"${CMAKE_BINARY_DIR}")