-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
40 lines (32 loc) · 1.31 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Modified from https://gitlab.com/Fraser999/Rust-From-CXX/
project(ik_geo)
cmake_minimum_required(VERSION 3.0)
# Enable ExternalProject CMake module
include(ExternalProject)
# # Set default ExternalProject root directory
set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/Rust)
# Add rust_example as a CMake target
ExternalProject_Add(
ik_geo_lib
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND cargo build COMMAND cargo build --release
BINARY_DIR "${CMAKE_CURRENT_LIST_DIR}/rust-wrapper"
INSTALL_COMMAND ""
LOG_BUILD ON)
# Build to the dist folder
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
add_library(ik_geo INTERFACE include/ik_geo.h)
add_dependencies(ik_geo ik_geo_lib)
target_include_directories(ik_geo INTERFACE include)
if (WIN32)
target_link_libraries(ik_geo INTERFACE
debug "${CMAKE_CURRENT_LIST_DIR}/rust-wrapper/target/debug/libik_geo.lib"
optimized "${CMAKE_CURRENT_LIST_DIR}/rust-wrapper/target/release/libik_geo.lib"
ws2_32 userenv advapi32)
else ()
target_link_libraries(ik_geo INTERFACE
debug "${CMAKE_CURRENT_LIST_DIR}/rust-wrapper/target/debug/libik_geo.so"
optimized "${CMAKE_CURRENT_LIST_DIR}/rust-wrapper/target/release/libik_geo.so")
endif()