forked from SamuelRhody/m.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
90 lines (70 loc) · 2.21 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
89
cmake_minimum_required(VERSION 2.8)
project(mjs)
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/CMake")
set(CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/CMake
${PROJECT_BINARY_DIR}/CMake
${CMAKE_MODULE_PATH})
#-----------------------------------------------------------------------------
# Version information
include(Version)
# Version string should not include patch level. The major.minor is
# enough to distinguish available features of the toolkit.
set(MJS_VERSION_STRING "${MJS_VERSION_MAJOR}.${MJS_VERSION_MINOR}")
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
if(WRAP_NODEJS)
find_package(NodeJS REQUIRED)
find_package(V8 REQUIRED)
endif( )
find_package(GTM REQUIRED)
include_directories(
${GTM_DIST}
${PROJECT_SOURCE_DIR}/Source
${PROJECT_BINARY_DIR}/Source
)
if(WRAP_NODEJS)
include_directories(
${NODEJS_INCLUDE_DIR}
${V8_LIBRARY}
)
endif( )
link_directories(
${GTM_DIST}
)
configure_file(
${PROJECT_SOURCE_DIR}/Source/mjsConfigure.h.in
${PROJECT_BINARY_DIR}/Source/mjsConfigure.h
)
# The fPIC flags is used to create position independent code.
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag( "-fPIC" CXX_HAS_fPIC )
if( CXX_HAS_fPIC )
if(NOT "${CMAKE_CXX_FLAGS}" MATCHES "-fPIC")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC" )
endif()
endif( )
#
# Set up CPack support
#
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "m.js version ${MJS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VENDOR "ISC")
set(CPACK_PACKAGE_VERSION_MAJOR "${MJS_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${MJS_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${MJS_VERSION_PATCH}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "MJS-${MJS_VERSION_MAJOR}.${MJS_VERSION_MINOR}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
include(CPack)
#
# Set up for Testing
#
include(CTest)
option( WRAP_NODEJS "Wrap for Node.js" ON )
option( WRAP_PYTHON "Wrap for Python" OFF)
option( WRAP_R "Wrap for R" OFF)
option( WRAP_RUBY "Wrap for Ruby" OFF)
add_subdirectory(Source)
add_subdirectory(Testing)
add_subdirectory(Wrapping)