| 1 |
# This file is made by Mojca and Hans and is subjected to changes |
| 2 |
# as we proceed with luametatex and the contextgarden compile farm. |
| 3 |
|
| 4 |
cmake_minimum_required(VERSION 3.7) |
| 5 |
|
| 6 |
# Lucky us: only normal C is used: |
| 7 |
|
| 8 |
project (mujs |
| 9 |
VERSION 1.0.6 |
| 10 |
DESCRIPTION "MuJS embeddable Javascript interpreter" |
| 11 |
LANGUAGES C) |
| 12 |
|
| 13 |
# The jsrepr.c is not needed and depends on utf.c as well has some function |
| 14 |
# pointer cast issue (accessing unknown name field). |
| 15 |
|
| 16 |
set (mujs_sources |
| 17 |
jsarray.c |
| 18 |
jsboolean.c |
| 19 |
jsbuiltin.c |
| 20 |
jscompile.c |
| 21 |
jsdate.c |
| 22 |
jsdtoa.c |
| 23 |
jsdump.c |
| 24 |
jserror.c |
| 25 |
jsfunction.c |
| 26 |
jsgc.c |
| 27 |
jsintern.c |
| 28 |
jslex.c |
| 29 |
jsmath.c |
| 30 |
jsnumber.c |
| 31 |
jsobject.c |
| 32 |
json.c |
| 33 |
jsparse.c |
| 34 |
jsproperty.c |
| 35 |
jsregexp.c |
| 36 |
# jsrepr.c |
| 37 |
jsrun.c |
| 38 |
jsstate.c |
| 39 |
jsstring.c |
| 40 |
jsvalue.c |
| 41 |
regexp.c |
| 42 |
utf.c |
| 43 |
utftype.c |
| 44 |
) |
| 45 |
|
| 46 |
set (mujs_headers |
| 47 |
jsbuiltin.h |
| 48 |
jscompile.h |
| 49 |
jsi.h |
| 50 |
jslex.h |
| 51 |
jsparse.h |
| 52 |
jsrun.h |
| 53 |
jsvalue.h |
| 54 |
mujs.h |
| 55 |
regexp.h |
| 56 |
utf.h |
| 57 |
) |
| 58 |
|
| 59 |
# We need this in order for msvc to export the symbols (which is default on |
| 60 |
# gcc). Otherwise we need this dllexport stuff. |
| 61 |
|
| 62 |
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) |
| 63 |
|
| 64 |
# The previous one has to come before the next one! |
| 65 |
|
| 66 |
if (MSVC) |
| 67 |
|
| 68 |
add_library(mujs SHARED ${mujs_headers} ${mujs_sources} ) |
| 69 |
|
| 70 |
else() |
| 71 |
|
| 72 |
# Is this hack still needed or does the above work ok.? |
| 73 |
|
| 74 |
add_library(mujs SHARED ${mujs_headers} one.c) |
| 75 |
|
| 76 |
endif() |
| 77 |
|
| 78 |
# As per make file. |
| 79 |
|
| 80 |
set_property(TARGET mujs PROPERTY C_STANDARD 99) |
| 81 |
|
| 82 |
# We want consistent and predictable names: |
| 83 |
|
| 84 |
set_target_properties(mujs PROPERTIES OUTPUT_NAME "libmujs") |
| 85 |
|
| 86 |
# Some options based on what's in upstream's make file. |
| 87 |
|
| 88 |
if (NOT MSVC) |
| 89 |
|
| 90 |
target_compile_options(mujs |
| 91 |
PRIVATE |
| 92 |
-pedantic |
| 93 |
-Wall |
| 94 |
-Wextra |
| 95 |
-Wno-unused-parameter |
| 96 |
) |
| 97 |
|
| 98 |
if (CMAKE_C_COMPILER_ID STREQUAL "Clang") |
| 99 |
|
| 100 |
target_compile_options(mujs |
| 101 |
PRIVATE |
| 102 |
-Wunreachable-code |
| 103 |
) |
| 104 |
|
| 105 |
endif() |
| 106 |
|
| 107 |
endif() |