-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (52 loc) · 1.67 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
cmake_minimum_required(VERSION 2.8)
SET( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
# Get the Module Name from the file path
get_filename_component(list_file_path ${CMAKE_CURRENT_LIST_FILE} PATH)
string(REGEX MATCH "[a-z.-]*$" module_id ${list_file_path})
message("Configuring vsxu module " ${module_id})
project (${module_id})
# Find the needed package first
# TODO: Make the GL Dependency optional by adding VSX_NO_GL definition if OpenGL is not found
find_package(VSXu REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
include_directories(
${VSXU_INCLUDE_DIRS}
v8/include
)
link_directories(
${VSXu_LIBRARY_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/v8/out/native/obj.target/tools/gyp/
)
set(SOURCES main.cpp)
add_library(${module_id} MODULE ${SOURCES})
target_link_libraries(
${module_id}
libv8_base.x64.a
libv8_snapshot.a
${VSXU_LIBRARIES}
${GLEW_LIBRARY}
${OPENGL_LIBRARIES}
)
add_definitions(-fPIC)
#Now Install the magic files
if(WIN32)
target_link_libraries(${module_id} gdi32 ${VSXU_LIBRARIES})
install(TARGETS ${module_id} DESTINATION ${VSXU_LIBRARY_DIRS}/plugins COMPONENT engine)
endif(WIN32)
if (UNIX)
install(TARGETS ${module_id} DESTINATION ${VSXU_LIBRARY_DIRS}/vsxu/plugins)
endif(UNIX)
# Clean up the lib prefix from the module that would be installed
set_target_properties(
${module_id}
PROPERTIES
PREFIX ""
)
#Adding a nice shiny uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)