Skip to content

Commit

Permalink
remove generated config.hpp from the source tree
Browse files Browse the repository at this point in the history
since it's been generated from v8pp/config.hpp.in by CMake.
Fix default value for `V8PP_PLUGIN_SUFFIX` option.
Fix v8pp install step in the CMake files.

See #138
  • Loading branch information
pmed committed Oct 3, 2021
1 parent e054ad1 commit d69048d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ option(BUILD_DOCUMENTATION "Build documentation" OFF)
set(V8PP_HEADER_ONLY 0 CACHE BOOL "Header-only library")
set(V8PP_ISOLATE_DATA_SLOT 0 CACHE STRING "v8::Isolate data slot number, used in v8pp for shared data")
set(V8PP_PLUGIN_INIT_PROC_NAME "v8pp_module_init" CACHE STRING "v8pp plugin initialization procedure name")
set(V8PP_PLUGIN_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "v8pp plugin filename suffix")
set(V8PP_PLUGIN_SUFFIX ${CMAKE_SHARED_MODULE_SUFFIX} CACHE STRING "v8pp plugin filename suffix")
set(V8PP_USE_STD_STRING_VIEW 0 CACHE BOOL "Use std::string_view")
set(V8_COMPRESS_POINTERS 1 CACHE BOOL "Use new V8 ABI with V8_COMPRESS_POINTERS and V8_31BIT_SMIS_ON_64BIT_ARCH")

Expand Down
16 changes: 10 additions & 6 deletions v8pp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
find_package(V8 REQUIRED)

configure_file(config.hpp.in ${CMAKE_CURRENT_SOURCE_DIR}/config.hpp)
configure_file(config.hpp.in ${CMAKE_CURRENT_BINARY_DIR}/config.hpp)

if(V8_COMPRESS_POINTERS)
set(V8PP_DEFINES V8_COMPRESS_POINTERS V8_31BIT_SMIS_ON_64BIT_ARCH)
endif()

set(V8PP_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/config.hpp
${CMAKE_CURRENT_BINARY_DIR}/config.hpp
call_from_v8.hpp
call_v8.hpp
class.hpp
Expand Down Expand Up @@ -64,6 +64,7 @@ if(V8PP_HEADER_ONLY)
target_compile_options(v8pp INTERFACE ${V8PP_COMPILE_OPTIONS})
target_include_directories(v8pp INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(v8pp INTERFACE V8::v8 V8::libplatform)
else()
Expand All @@ -72,27 +73,30 @@ else()
target_compile_options(v8pp PRIVATE ${V8PP_COMPILE_OPTIONS})
target_include_directories(v8pp PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(v8pp PUBLIC V8::v8 V8::libplatform)
if(BUILD_SHARED_LIBS)
target_link_libraries(v8pp PUBLIC ${CMAKE_DL_LIBS})
endif()
endif()

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${V8PP_HEADERS} ${V8PP_SOURCES})
#source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${V8PP_HEADERS} ${V8PP_SOURCES})

# Install
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

set(targets_export_name v8pp_Targets)

write_basic_package_version_file("${PROJECT_BINARY_DIR}/ConfigVersion.cmake" COMPATIBILITY SameMajorVersion)
configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in" "${PROJECT_BINARY_DIR}/Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/v8pp/cmake)

install(TARGETS v8pp EXPORT v8pp_Targets)
install(EXPORT v8pp_Targets
install(TARGETS v8pp EXPORT ${targets_export_name})
install(EXPORT ${targets_export_name}
NAMESPACE v8pp::
FILE v8ppTargets.cmake
FILE ${targets_export_name}.cmake
DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/v8pp")

install(FILES "${PROJECT_BINARY_DIR}/ConfigVersion.cmake" "${PROJECT_BINARY_DIR}/Config.cmake"
Expand Down
65 changes: 0 additions & 65 deletions v8pp/config.hpp

This file was deleted.

0 comments on commit d69048d

Please sign in to comment.