0030429: Samples - add simple glfw 3D Viewer sample
[occt.git] / samples / glfw / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.2)
2
3 project(glfw-occt-demo)
4
5 set(CMAKE_CXX_STANDARD 11)
6 set(APP_VERSION_MAJOR 1)
7 set(APP_VERSION_MINOR 0)
8 set(APP_TARGET glfwocct)
9
10 INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
11 file(GLOB SOURCES
12   *.h
13   *.cpp
14 )
15 source_group ("Headers" FILES
16   GlfwOcctView.h
17   GlfwOcctWindow.h)
18 source_group ("Sources" FILES
19   GlfwOcctView.cpp
20   GlfwOcctWindow.cpp
21   main.cpp)
22
23 # OpenGL
24 find_package(OpenGL REQUIRED)
25
26 # Open CASCADE Technology
27 find_package(OpenCASCADE REQUIRED NO_DEFAULT_PATH)
28 if (OpenCASCADE_FOUND)
29   message (STATUS "Using OpenCASCADE from \"${OpenCASCADE_DIR}\"" )
30   INCLUDE_DIRECTORIES(${OpenCASCADE_INCLUDE_DIR})
31   LINK_DIRECTORIES(${OpenCASCADE_LIBRARY_DIR})
32 else()
33   message (WARNING "Could not find OpenCASCADE, please set OpenCASCADE_DIR variable." )
34   set (OCCT_LIBRARY_DIR)
35   set (OCCT_BIN_DIR)
36 endif()
37
38 SET(OpenCASCADE_LIBS 
39   TKernel
40   TKService
41   TKV3d
42   TKOpenGl
43   TKBRep
44   TKGeomBase
45   TKGeomAlgo
46   TKG3d
47   TKG2d
48   TKTopAlgo
49   TKPrim
50 )
51
52 # glfw
53 find_package(glfw3 REQUIRED)
54 if (glfw3_FOUND)
55   message (STATUS "Using glfw3 ${glfw3_VERSION}" )
56   INCLUDE_DIRECTORIES(${GLFW_INCLUDE_DIRS})
57   LINK_DIRECTORIES(${GLFW_LIBRARY_DIRS})
58 else()
59   message (STATUS "glfw3 is not found." )
60 endif()
61
62 add_executable(${APP_TARGET} ${SOURCES})
63 target_link_libraries(
64   ${APP_TARGET}
65   ${OpenCASCADE_LIBS}
66   glfw
67   ${OPENGL_LIBRARIES}
68 )