CMakeLists.txt 2.22 KB
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 2.8)
#Name your project here
project(bimsim)

#set the module directory
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}")
set(CMAKE_AUTOMOC ON)

# As moc files are generated in the binary dir, tell CMake
  # to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)

#find BOOST
set(Boost_USE_STATIC_LIBS        ON)
set(Boost_USE_MULTITHREADED      ON)
set(Boost_USE_STATIC_RUNTIME    OFF)
find_package( Boost 1.46.0 COMPONENTS program_options )

#find the Qt5
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
#find_package(Qt5OpenGL REQUIRED)
include_directories(${QT_INCLUDE_DIRECTORY})

#set up CUDA
find_package(CUDA)

#ask the user for the RTS location
find_package(RTS REQUIRED)

#set the include directories
include_directories(
	${CMAKE_CURRENT_BINARY_DIR}
	${Qt5Widgets_INCLUDE_DIRS}
	${Qt5Core_INCLUDE_DIRS}
	${Qt5Gui_INCLUDE_DIRS}
#	${Qt5OpenGL_INCLUDE_DIRS}
	${RTS_INCLUDE_DIR}
    	${Boost_INCLUDE_DIR}
)

#build position independent code for Qt (-fPIC)
#set(CMAKE_CXX_FLAGS "-fPIC")

#enable warnings (-Wall)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
	add_definitions(-Wall)
endif()

#Assign source files to the appropriate variables
file(GLOB SRC_CPP "*.cpp")
file(GLOB SRC_H "*.h")
file(GLOB SRC_UI "*.ui")
file(GLOB SRC_CU "*.cu")

#determine which source files have to be moc'd
Qt5_wrap_cpp(UI_MOC ${SRC_H})
Qt5_wrap_ui(UI_H ${SRC_UI})
Qt5_add_resources(ALL_RCC ${ALL_QRC})

set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")

#create an executable
cuda_add_executable(bimsim 
                    ${SRC_CPP}
                    ${SRC_H}
		    ${RTS_SOURCE}
		    ${UI_H}
                    ${SRC_UI}
                    ${SRC_CU}
)

#specify which qt5 modules to use
qt5_use_modules(bimsim Core Widgets OpenGL Gui)

#set the link libraries
target_link_libraries(bimsim
					  ${Qt5Widgets_LIBRARIES}
					  ${Qt5Core_LIBRARIES}
					  ${Qt5Gui_LIBRARIES}
#					  ${Qt5OpenGL_LIBRARIES}
					  ${CUDA_cufft_LIBRARY}
					  ${CUDA_cublas_LIBRARY}
					  ${Boost_LIBRARIES}
					  )