File: CMakeLists.j2

package info (click to toggle)
python-opencascade-pywrap 0.0~git20250714210719.b608b60-3
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 12,992 kB
  • sloc: python: 1,622; pascal: 32; makefile: 13; sh: 1
file content (62 lines) | stat: -rwxr-xr-x 2,021 bytes parent folder | download | duplicates (2)
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
57
58
59
60
61
62
cmake_minimum_required( VERSION 3.16 )
project( {{ name }}
         LANGUAGES CXX )


find_package( Python REQUIRED COMPONENTS Development Interpreter)
find_package( VTK REQUIRED
  COMPONENTS
    WrappingPythonCore
    RenderingCore
    RenderingOpenGL2
    CommonDataModel
    CommonExecutionModel
    freetype
)
find_package( pybind11 REQUIRED )
find_package( OpenCASCADE REQUIRED )

include_directories( ${PROJECT_SOURCE_DIR} )
file( GLOB CPP_FILES ${PROJECT_SOURCE_DIR}/*.cpp )

add_library( {{ name }} MODULE ${CPP_FILES} )
target_link_libraries( {{ name }} PRIVATE 
  ${OpenCASCADE_LIBRARIES}
  Python::Module
  pybind11::pybind11 
  VTK::WrappingPythonCore
  VTK::RenderingCore
  VTK::CommonDataModel
  VTK::CommonExecutionModel
  )
set_target_properties( {{ name }}
                       PROPERTIES
                       CXX_STANDARD 17
                       INTERPROCEDURAL_OPTIMIZATION FALSE
                       PREFIX "${PYTHON_MODULE_PREFIX}"
                       SUFFIX "${PYTHON_MODULE_EXTENSION}" )

if(WIN32)
  target_compile_options( {{ name }} PRIVATE /bigobj )
  target_compile_definitions( {{ name }} PRIVATE 
                              "Standard_EXPORT="
                              "Standard_EXPORTEXTERN="
                              "Standard_EXPORTEXTERNC=extern \"C\""
                              "Standard_IMPORT=extern"
                              "Standard_IMPORTC=extern \"C\""
                              "_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING")
  target_link_libraries( {{ name }} PRIVATE opengl32 )
else()
  set_target_properties( {{ name }}
                         PROPERTIES
                         CMAKE_CXX_FLAGS_RELEASE "-O3 "
                         COMPILE_FLAGS "-fpermissive -fvisibility=hidden -fvisibility-inlines-hidden" )
endif()

if(UNIX AND NOT APPLE)
  target_link_options( {{ name }} PRIVATE "LINKER:--allow-multiple-definition")
endif()

if(APPLE)
  target_link_libraries( {{ name }} PRIVATE "-undefined dynamic_lookup")
endif()