forked from CadQuery/OCP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (44 loc) · 1.58 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required( VERSION 3.17 )
project( OCP )
set( N_PROC 16 CACHE STRING "Number of processes used for generating code")
find_package(LLVM REQUIRED )
find_package(VTK REQUIRED )
find_package(RapidJSON REQUIRED )
find_package( Clang REQUIRED )
set( Python_FIND_VIRTUALENV FIRST )
find_package( Python COMPONENTS Interpreter REQUIRED )
get_target_property( LIBCLANG_PATH libclang IMPORTED_LOCATION_RELEASE )
get_target_property( VTK_INCLUDE_DIR VTK::CommonCore INTERFACE_INCLUDE_DIRECTORIES )
message( STATUS "${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLATFORM Windows)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CXX_INCLUDES -i ${CLANG_INCLUDE_DIRS}/c++/v1/ )
set(PLATFORM OSX)
else()
set(PLATFORM Linux)
endif()
set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap )
include_directories(${CMAKE_SOURCE_DIR}/opencascade/)
if( NOT EXISTS ${CMAKE_SOURCE_DIR}/OCP )
message( STATUS "Running pywrap")
execute_process(
COMMAND
${Python_EXECUTABLE}
-m bindgen
-n ${N_PROC}
-l ${LIBCLANG_PATH}
-i ${CLANG_INCLUDE_DIRS}/
-i ${VTK_INCLUDE_DIR}/
-i ${CLANG_INSTALL_PREFIX}/lib/clang/${LLVM_VERSION}/include/
${CXX_INCLUDES}
all ocp.toml ${PLATFORM}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND_ECHO STDOUT
RESULT_VARIABLE PYWRAP_RESULT
)
if( ${PYWRAP_RESULT} GREATER 0)
message(FATAL_ERROR "Pywrap call failed")
endif()
endif()
add_subdirectory( ${CMAKE_SOURCE_DIR}/OCP )