CMakeLists.txt 2.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
# in order to be able to include generated files (ui and moc)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
FIND_PACKAGE(Qt REQUIRED)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

FIND_PACKAGE(OpenGL REQUIRED)

set(HEADER_FILES

	qglviewer.h 
	camera.h 
	manipulatedFrame.h 
	manipulatedCameraFrame.h 
	frame.h 
	keyFrameInterpolator.h 
	)
	
set(SOURCE_FILES

	qglviewer.cpp 
	camera.cpp 
	manipulatedFrame.cpp 
	manipulatedCameraFrame.cpp 
	frame.cpp 
	saveSnapshot.cpp 
	constraint.cpp 
	keyFrameInterpolator.cpp 
	mouseGrabber.cpp 
	quaternion.cpp 
	vec.cpp
	
	VRender/BackFaceCullingOptimizer.cpp
	VRender/EPSExporter.cpp
	VRender/FIGExporter.cpp
	VRender/NVector3.cpp
	VRender/Primitive.cpp
	VRender/TopologicalSortMethod.cpp
	VRender/Vector3.cpp
	VRender/VRender.cpp
	VRender/BSPSortMethod.cpp
	VRender/Exporter.cpp
	VRender/gpc.cpp
	VRender/ParserGL.cpp
	VRender/PrimitivePositioning.cpp
	VRender/Vector2.cpp
	VRender/VisibilityOptimizer.cpp
	)

set(UI_FILES
	ImageInterface.ui
	VRenderInterface.ui
	)	
	
QT4_WRAP_CPP(MOC_FILES ${HEADER_FILES})
QT4_WRAP_UI(FORM_FILES ${UI_FILES})


# make mocced header / form files path from absolute to relative
ToRelativePath(MOC_FILES "${CMAKE_CURRENT_SOURCE_DIR}" "${MOC_FILES}")
ToRelativePath(MOC_UI_FILES "${CMAKE_CURRENT_SOURCE_DIR}" "${MOC_UI_FILES}")
ToRelativePath(FORM_FILES "${CMAKE_CURRENT_SOURCE_DIR}" "${FORM_FILES}")

# these header files do not need MOCcing
list(APPEND HEADER_FILES
	config.h
	constraint.h 
	domUtils.h 
	mouseGrabber.h 
	quaternion.h 
	vec.h 
	VRender/AxisAlignedBox.h
	VRender/Exporter.h
	VRender/gpc.h
	VRender/NVector3.h
	VRender/Optimizer.h
	VRender/ParserGL.h
	VRender/Primitive.h
	VRender/PrimitivePositioning.h
	VRender/SortMethod.h
	VRender/Types.h
	VRender/Vector2.h
	VRender/Vector3.h
	VRender/VRender.h
	)

set(MOC_FILES_GROUP "Generated")
set(MOC_UI_FILES_GROUP "Generated")
set(FORM_FILES_GROUP "Generated")

include_directories("..")

93 94 95 96 97 98 99 100 101 102 103
# The code must be relocatable if we want to link a shared library against it
#if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
#    add_definitions("-fPIC")
#endif()

if(WIN32)
    ADD_DEFINITIONS(-DCREATE_QGLVIEWER_DLL -DNOMINMAX)
else()
	ADD_DEFINITIONS("-fPIC")
endif() 

104 105 106
add_library(QGLViewer SHARED ${HEADER_FILES} ${MOC_FILES} ${MOC_UI_FILES} ${FORM_FILES} ${SOURCE_FILES})
target_link_libraries(QGLViewer ${QT_LIBRARIES} ${OPENGL_LIBRARY})

107

108 109