This repository has been archived by the owner on Jun 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
71 lines (55 loc) · 2.13 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
# Copyright 2019 Christopher Edwards
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/ydbcmake/")
set(M_EMBED_SOURCE TRUE)
set(M_DYNAMIC_LITERALS TRUE)
project(YDBGUI C M)
cmake_minimum_required(VERSION 2.8)
# Find YottaDB
find_package(YOTTADB REQUIRED)
include_directories("${YOTTADB_INCLUDE_DIRS}")
set(ydb_install_dir ${YOTTADB_INCLUDE_DIRS}/plugin)
# Make sure npm & node are installed
find_program(NPM NAMES npm)
find_program(NODE NAMES node)
if(NOT NPM)
message(FATAL_ERROR "Unable to find 'npm'. Please install npm and make sure it is available in your path.")
endif()
if(NOT NODE)
message(FATAL_ERROR "Unable to find 'node'. Please install node.js and make sure it is available in your path.")
endif()
# Make sure the m web server is installed
set(CMAKE_FIND_LIBRARY_PREFIXES "")
find_library(MWEBSERVER NAMES ydbmwebserver HINTS ${ydb_install_dir}/o)
if(NOT MWEBSERVER)
message(FATAL_ERROR "Unable to find 'M-Web-Server'. Please install the M-Web-Server YottaDB plugin.")
endif()
set(source_files
r/GDEWEB.m
r/_weburl.m
)
# Add commands to compile .m files
add_library(ydbgui SHARED ${source_files})
SET_TARGET_PROPERTIES(ydbgui PROPERTIES PREFIX "")
install(FILES ${source_files} DESTINATION ${ydb_install_dir}/r/)
if(M_UTF8_MODE)
install(TARGETS ydbgui DESTINATION ${ydb_install_dir}/o/utf8)
else()
install(TARGETS ydbgui DESTINATION ${ydb_install_dir}/o/)
endif()
# Run the NPM build setps
execute_process(COMMAND npm install)
add_custom_target(npmbuild ALL COMMAND npm run build)
# HTML files
install(DIRECTORY dist/ DESTINATION ${ydb_install_dir}/etc/ydbgui)