Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tidying include structure #15

Merged
merged 1 commit into from
May 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
inst/lib
inst/VERSION
inst/include/**.h
inst/include/quickjs
*.o
*.so
*.a
Expand Down
1 change: 1 addition & 0 deletions R/flags.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cxxflags <- function(to_console = FALSE) {
incdir <- system.file("include", package = "QuickJSR", mustWork = TRUE)
pkg_cxxflags <- paste(
paste0("-I", shQuote(incdir)),
paste0("-I", shQuote(file.path(incdir, "quickjs"))),
"-D_GNU_SOURCE",
paste0("-DCONFIG_VERSION=\"", quickjs_version(), "\""),
"-DSTRICT_R_HEADERS",
Expand Down
10 changes: 6 additions & 4 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
PKG_CPPFLAGS = -I"../inst/include/" -D_GNU_SOURCE -DCONFIG_BIGNUM
PKG_CPPFLAGS = -I"../inst/include/" -I"../inst/include/quickjs"
PKG_CPPFLAGS += -D_GNU_SOURCE -DCONFIG_BIGNUM
PKG_CPPFLAGS += -DCONFIG_VERSION=\"$(shell cat quickjs/VERSION)\"
PKG_LIBS = ../inst/lib/$(R_ARCH)/libquickjs.a

Expand Down Expand Up @@ -41,8 +42,8 @@ all: package-quickjs $(SHLIB)
$(SHLIB): build-static

package-quickjs:
@mkdir -p ../inst/include
@cp $(QUICKJS_C_HEADERS:%=quickjs/%) ../inst/include
@mkdir -p ../inst/include/quickjs
@cp $(QUICKJS_C_HEADERS:%=quickjs/%) ../inst/include/quickjs
@cp quickjs/VERSION ../inst/

build-static: $(QUICKJS_OBJECTS)
Expand All @@ -53,4 +54,5 @@ $(QUICKJS_OBJECTS): quickjs/%.o : quickjs/%.c
$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -DSTRICT_R_HEADERS -funsigned-char -fwrapv -std=c11 -c $< -o $@

clean:
$(RM) $(QUICKJS_OBJECTS) ../inst/lib/$(R_ARCH)/libquickjs.a
$(RM) $(QUICKJS_OBJECTS) $(OBJECTS) ../inst/VERSION
$(RM) -r ../inst/lib ../inst/include/quickjs
2 changes: 1 addition & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "cpp11.hpp"
#include <cpp11.hpp>
#include <R_ext/Visibility.h>

#ifdef __cplusplus
Expand Down
2 changes: 0 additions & 2 deletions src/quickjsr.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include <cpp11.hpp>
#include <cpp11/declarations.hpp>
#include <fstream>
#include <sstream>
#include <quickjs-libc.h>

// Register the cpp11 external pointer types with the correct cleanup/finaliser functions
Expand Down
Loading