@@ -2,8 +2,9 @@ cmake_minimum_required(VERSION 3.20)
2
2
3
3
project (accesskit_c )
4
4
5
+ SET (ACCESSKIT_INCLUDE_DIR ${CMAKE_SOURCE_DIR} /include )
5
6
SET (ACCESSKIT_IN_REPO ON )
6
- if (NOT EXISTS (${CMAKE_SOURCE_DIR} /lib ))
7
+ if (EXISTS (${CMAKE_SOURCE_DIR} /lib ))
7
8
SET (ACCESSKIT_IN_REPO OFF )
8
9
if (WIN32 )
9
10
if (MINGW )
@@ -20,19 +21,19 @@ if (NOT EXISTS(${CMAKE_SOURCE_DIR}/lib))
20
21
endif ()
21
22
endif ()
22
23
endif ()
23
- endif ()
24
- SET (ACCESSKIT_INCLUDE_DIR ${CMAKE_SOURCE_DIR} /include )
25
-
26
- if (${ACCESSKIT_IN_REPO} )
27
- include (ExternalProject )
24
+ else ()
28
25
add_subdirectory (corrosion )
29
26
corrosion_import_crate (MANIFEST_PATH Cargo.toml )
30
27
28
+ find_program (RUSTUP rustup )
29
+ find_program (CBINDGEN cbindgen )
30
+ find_program (CLANG_FORMAT clang-format )
31
+
31
32
add_custom_target (headers
32
- COMMAND rustup run nightly cbindgen --crate accesskit_c --output "${ACCESSKIT_INCLUDE_DIR} /accesskit.hpp" "${CMAKE_SOURCE_DIR} "
33
- COMMAND clang-format -i "${ACCESSKIT_INCLUDE_DIR} /accesskit.hpp"
33
+ COMMAND ${RUSTUP} run nightly ${CBINDGEN} --crate accesskit_c --output "${ACCESSKIT_INCLUDE_DIR} /accesskit.hpp" "${CMAKE_SOURCE_DIR} "
34
+ COMMAND ${CLANG_FORMAT} -i "${ACCESSKIT_INCLUDE_DIR} /accesskit.hpp"
34
35
COMMAND ${CMAKE_COMMAND} -E rename "${ACCESSKIT_INCLUDE_DIR} /accesskit.hpp" "${ACCESSKIT_INCLUDE_DIR} /accesskit.h"
35
- DEPENDS "${ACCESSKIT_INCLUDE_DIR} /accesskit.h"
36
+ BYPRODUCTS "${ACCESSKIT_INCLUDE_DIR} /accesskit.h"
36
37
)
37
38
38
39
add_dependencies (cargo-prebuild_accesskit headers )
0 commit comments