-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathCMakeLists.txt
executable file
·88 lines (68 loc) · 2.79 KB
/
CMakeLists.txt
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
# CMakeList.txt for debugging/testing only.
#
# To install from sources, use setup.py to build it
# To build wheels, use build_maylinux_wheels.sh
cmake_minimum_required(VERSION 3.6)
cmake_policy(SET CMP0072 NEW)
project(bimpy)
option (GLFW_BUILD_EXAMPLES OFF)
option (GLFW_BUILD_TESTS OFF)
option (GLFW_INSTALL OFF)
option (USE_MSVC_RUNTIME_LIBRARY_DLL OFF)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
set(CMAKE_CXX_STANDARD 14)
if(NOT MSVC)
set (CMAKE_C_FLAGS "-fPIC -g ${CMAKE_C_FLAGS}")
set (CMAKE_CXX_FLAGS "-fPIC -g ${CMAKE_CXX_FLAGS}")
endif()
find_package(OpenGL)
if (OPENGL_FOUND)
message("OpenGL Correctly Found")
include_directories(${OPENGL_INCLUDE_DIR})
else (OPENGL_FOUND)
message("OpenGL environment missing")
endif (OPENGL_FOUND)
find_package (Python COMPONENTS Interpreter Development REQUIRED)
##############################################################
# Generating OpenGL profile
##############################################################
message("Executing gl3w_gen.py")
execute_process(COMMAND python gl3w_gen.py --root ${PROJECT_BINARY_DIR}/libs/gl3w WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libs/gl3w)
##############################################################
# Externals
##############################################################
add_subdirectory (libs/glfw)
add_subdirectory (libs/gl3w)
#####################################################################
# imgui
#####################################################################
set(IMGUI_DIR libs/imgui)
file(GLOB IMGUI_SOURCES ${IMGUI_DIR}/*.cpp ${IMGUI_DIR}/*.h config/bimpy_imgui_config.h)
add_library(imgui ${IMGUI_SOURCES})
target_compile_definitions(imgui PUBLIC IMGUI_USER_CONFIG="bimpy_imgui_config.h")
target_include_directories(imgui PUBLIC sources/config)
##############################################################
# Includes
##############################################################
include_directories(libs/glfw/include)
include_directories(libs/pybind11/include)
include_directories(libs/imgui)
include_directories(libs/backward-cpp)
include_directories(sources)
include_directories(${Python_INCLUDE_DIRS})
if (OPENGL_FOUND)
message("OpenGL Correctly Found")
include_directories(${OPENGL_INCLUDE_DIR})
else (OPENGL_FOUND)
message("OpenGL environment missing")
endif (OPENGL_FOUND)
##############################################################
# Targets
##############################################################
file(GLOB SOURCES sources/*.cpp sources/*.h )
add_library(bimpy SHARED ${SOURCES})
##############################################################
# Linkage
##############################################################
target_link_libraries(bimpy glfw gl3w imgui ${OPENGL_LIBRARIES} ${Python_LIBRARIES})
SET_TARGET_PROPERTIES(bimpy PROPERTIES PREFIX "_")