Skip to content

Commit

Permalink
Install all headers to same directory
Browse files Browse the repository at this point in the history
  • Loading branch information
CGamesPlay committed Jul 30, 2024
1 parent adcfe72 commit 29eff3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 5 additions & 3 deletions crates/c-api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ target_include_directories(wasmtime INTERFACE ${CMAKE_BINARY_DIR}/include)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/wasmtime/conf.h.in
${WASMTIME_GENERATED_CONF_H})
add_custom_target(conf_h
DEPENDS ${WASMTIME_GENERATED_CONF_H})

include(GNUInstallDirs)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT Headers
FILES_MATCHING REGEX "\\.hh?$")
install(FILES ${WASMTIME_GENERATED_CONF_H}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/wasmtime)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/wasmtime
COMPONENT Headers)
install(FILES ${WASMTIME_SHARED_FILES} ${WASMTIME_STATIC_FILES}
DESTINATION ${CMAKE_INSTALL_LIBDIR})

Expand All @@ -172,3 +172,5 @@ add_custom_target(doc
COMMAND doxygen ${DOXYGEN_CONF_OUT}
DEPENDS ${WASMTIME_GENERATED_CONF_H} ${DOXYGEN_CONF_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(headers
COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --component Headers)
1 change: 0 additions & 1 deletion crates/c-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ fn main() {
// Wasm C API headers.
cfg
.include(std::env::var("DEP_WASMTIME_C_API_INCLUDE").unwrap());
.include(std::env::var("DEP_WASMTIME_C_API_CONF_INCLUDE").unwrap());

// Compile your C code.
cfg
Expand Down
6 changes: 3 additions & 3 deletions crates/c-api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ fn main() {
let mut config = cmake::Config::new(&dir);
config
.define("WASMTIME_DISABLE_ALL_FEATURES", "ON")
.build_target("conf_h");
.always_configure(true)
.build_target("headers");
for f in FEATURES {
if env::var_os(format!("CARGO_FEATURE_{}", f)).is_some() {
config.define(format!("WASMTIME_FEATURE_{}", f), "ON");
}
}
let dst = config.build();

println!("cargo:conf-include={}/build/include", dst.display());
println!("cargo:include={}/include", dir.display());
println!("cargo:include={}/include", dst.display());
}

0 comments on commit 29eff3d

Please sign in to comment.