Last active
April 14, 2023 10:09
-
-
Save jrialland/0584ae31ce75f170c84daae6930988a1 to your computer and use it in GitHub Desktop.
Cmake snippet that compiles quickjs as static library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
## compile quickjs as a static library | |
set(QUICKJS_GIT_TAG master) | |
include(FetchContent) | |
FetchContent_Declare( | |
quickjs | |
GIT_REPOSITORY https://github.com/bellard/quickjs.git | |
GIT_TAG ${QUICKJS_GIT_TAG} | |
) | |
FetchContent_MakeAvailable( | |
quickjs | |
) | |
set(QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/qjs.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/quickjs.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/libregexp.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/qjsc.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/cutils.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/unicode_gen.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/libunicode.c") | |
list(APPEND QUICKJS_SOURCES "${quickjs_SOURCE_DIR}/libbf.c") | |
add_library(quickjs STATIC ${QUICKJS_SOURCES}) | |
set_property(TARGET quickjs PROPERTY POSITION_INDEPENDENT_CODE ON) | |
target_include_directories(quickjs PRIVATE ${quickjs_SOURCE_DIR}) | |
target_compile_definitions(quickjs | |
PRIVATE | |
CONFIG_VERSION="${QUICKJS_GIT_TAG}" | |
CONFIG_BIGNUM=0 | |
) | |
set(quickjs_INCLUDE_DIRS ${quickjs_SOURCE_DIR}) | |
set(quickjs_LIBRARIES quickjs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment