aboutsummaryrefslogtreecommitdiff
path: root/python/CMakeLists.txt
blob: 084945505e741b3691281c5c54d9344dbab85c74 (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
if(CXX_SUPPORTS_FNO_STRICT_ALIASING)
  add_compile_options(-fno-strict-aliasing)
endif()

if(ENABLE_PYTHON)
  paludis_add_library(libpaludispython
                        "${CMAKE_CURRENT_SOURCE_DIR}/about.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/action.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/choices.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/contents.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/dep_label.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/dep_spec.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/environment.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/exception.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/filter.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/filtered_generator.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/fs_path.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/generator.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/mask.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/match_package.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/metadata_key.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/mutex.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/name.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/log.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/package_id.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/repository.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/selection.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/slot_requirement.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/version_operator.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/version_requirements.cc"
                        "${CMAKE_CURRENT_SOURCE_DIR}/version_spec.cc"
                      NN_SOURCES
                        "${CMAKE_CURRENT_SOURCE_DIR}/nice_names.nn")
  if(CXX_SUPPORTS_G0)
    target_compile_options(libpaludispython
                           PRIVATE
                             -g0)
  endif()
  target_include_directories(libpaludispython
                             PRIVATE
                               ${PYTHON_INCLUDE_DIRS}
                               ${Boost_INCLUDE_DIRS})
  target_link_libraries(libpaludispython
                        PRIVATE
                          libpaludis)

  paludis_add_library(paludis UNVERSIONED SHARED_LIBRARY
                        "${CMAKE_CURRENT_SOURCE_DIR}/paludis_python_so.cc")
  target_include_directories(paludis
                             PRIVATE
                               ${PYTHON_INCLUDE_DIRS}
                               ${Boost_INCLUDE_DIRS})
  target_link_libraries(paludis
                        PRIVATE
                          ${Boost_LIBRARIES}
                          ${PYTHON_LIBRARIES}
                          libpaludispython)
  set_target_properties(paludis PROPERTIES
                        OUTPUT_NAME
                          paludis
                        PREFIX
                          "")

  paludis_add_library(libadditionaltests
                        "${CMAKE_CURRENT_SOURCE_DIR}/additional_tests.cc")
  target_include_directories(libadditionaltests
                             PRIVATE
                               ${PYTHON_INCLUDE_DIRS}
                               ${Boost_INCLUDE_DIRS})
  target_link_libraries(libadditionaltests
                        PRIVATE
                          libpaludispython)

  paludis_add_library(additional_tests UNVERSIONED SHARED_LIBRARY
                        "${CMAKE_CURRENT_SOURCE_DIR}/additional_tests_so.cc")
  target_include_directories(additional_tests
                             PRIVATE
                               ${PYTHON_INCLUDE_DIRS}
                               ${Boost_INCLUDE_DIRS})
  target_link_libraries(additional_tests
                        PRIVATE
                          ${Boost_PYTHON_LIBRARY}
                          libadditionaltests)
  set_target_properties(additional_tests PROPERTIES
                        OUTPUT_NAME
                          additional_tests
                        PREFIX
                          "")

  foreach(test
            action
            contents
            dep_label
            dep_spec
            filter
            filtered_generator
            generator
            log
            name
            selection
            version_operator
            version_requirements
            version_spec)
    paludis_add_test(${test} PYTHON)
  endforeach()

  foreach(test
            choices
            environment
            mask
            metadata_key
            package_id
            repository)
    paludis_add_test(${test} PYTHON)
  endforeach()

  install(TARGETS
            libpaludispython
          DESTINATION
            "${CMAKE_INSTALL_FULL_LIBDIR}")
  install(TARGETS
            paludis
          DESTINATION
            "${PALUDIS_PYTHON_INSTALL_DIR}")
  install(PROGRAMS
            "${CMAKE_CURRENT_SOURCE_DIR}/paludis_output_wrapper.py"
          DESTINATION
            "${PALUDIS_PYTHON_INSTALL_DIR}")
endif()