diff options
Diffstat (limited to 'source/luametatex/source/luaoptional/cmake/mujs')
-rw-r--r-- | source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt | 107 | ||||
-rw-r--r-- | source/luametatex/source/luaoptional/cmake/mujs/CMakeSettings.json | 28 |
2 files changed, 135 insertions, 0 deletions
diff --git a/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt b/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt new file mode 100644 index 000000000..cfe2ee2bf --- /dev/null +++ b/source/luametatex/source/luaoptional/cmake/mujs/CMakeLists.txt @@ -0,0 +1,107 @@ +# This file is made by Mojca and Hans and is subjected to changes +# as we proceed with luametatex and the contextgarden compile farm. + +cmake_minimum_required(VERSION 3.7) + +# Lucky us: only normal C is used: + +project (mujs + VERSION 1.0.6 + DESCRIPTION "MuJS embeddable Javascript interpreter" + LANGUAGES C) + +# The jsrepr.c is not needed and depends on utf.c as well has some function +# pointer cast issue (accessing unknown name field). + +set (mujs_sources + jsarray.c + jsboolean.c + jsbuiltin.c + jscompile.c + jsdate.c + jsdtoa.c + jsdump.c + jserror.c + jsfunction.c + jsgc.c + jsintern.c + jslex.c + jsmath.c + jsnumber.c + jsobject.c + json.c + jsparse.c + jsproperty.c + jsregexp.c +# jsrepr.c + jsrun.c + jsstate.c + jsstring.c + jsvalue.c + regexp.c + utf.c + utftype.c +) + +set (mujs_headers + jsbuiltin.h + jscompile.h + jsi.h + jslex.h + jsparse.h + jsrun.h + jsvalue.h + mujs.h + regexp.h + utf.h +) + +# We need this in order for msvc to export the symbols (which is default on +# gcc). Otherwise we need this dllexport stuff. + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +# The previous one has to come before the next one! + +if (MSVC) + + add_library(mujs SHARED ${mujs_headers} ${mujs_sources} ) + +else() + + # Is this hack still needed or does the above work ok.? + + add_library(mujs SHARED ${mujs_headers} one.c) + +endif() + +# As per make file. + +set_property(TARGET mujs PROPERTY C_STANDARD 99) + +# We want consistent and predictable names: + +set_target_properties(mujs PROPERTIES OUTPUT_NAME "libmujs") + +# Some options based on what's in upstream's make file. + +if (NOT MSVC) + + target_compile_options(mujs + PRIVATE + -pedantic + -Wall + -Wextra + -Wno-unused-parameter + ) + + if (CMAKE_C_COMPILER_ID STREQUAL "Clang") + + target_compile_options(mujs + PRIVATE + -Wunreachable-code + ) + + endif() + +endif() diff --git a/source/luametatex/source/luaoptional/cmake/mujs/CMakeSettings.json b/source/luametatex/source/luaoptional/cmake/mujs/CMakeSettings.json new file mode 100644 index 000000000..fc67a089b --- /dev/null +++ b/source/luametatex/source/luaoptional/cmake/mujs/CMakeSettings.json @@ -0,0 +1,28 @@ +{ + "configurations": [ + { + "name": "msvc-x64-release", + "generator": "Ninja", + "configurationType": "Release", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "variables": [] + }, + { + "name": "msvc-x64-debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\build\\${name}", + "installRoot": "${projectDir}\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "-v", + "ctestCommandArgs": "", + "variables": [] + } + ] +}
\ No newline at end of file |