source: calamares/trunk/fuentes/src/libcalamares/CMakeLists.txt @ 7538

Last change on this file since 7538 was 7538, checked in by kbut, 13 months ago

sync with github

File size: 3.6 KB
Line 
1project( libcalamares CXX )
2
3add_definitions(
4    ${QT_DEFINITIONS}
5    -DQT_SHARED
6    -DQT_SHAREDPOINTER_TRACK_POINTERS
7    -DDLLEXPORT_PRO
8)
9
10configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/CalamaresConfig.h.in
11                ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h )
12configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/../calamares/CalamaresVersion.h.in
13                ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h )
14
15set( libSources
16    CppJob.cpp
17    GlobalStorage.cpp
18    Job.cpp
19    JobQueue.cpp
20    ProcessJob.cpp
21    Settings.cpp
22)
23set( utilsSources
24    utils/CalamaresUtils.cpp
25    utils/CalamaresUtilsSystem.cpp
26    utils/CommandList.cpp
27    utils/Logger.cpp
28    utils/PluginFactory.cpp
29    utils/Retranslator.cpp
30    utils/YamlUtils.cpp
31)
32set( kdsagSources
33    kdsingleapplicationguard/kdsingleapplicationguard.cpp
34    kdsingleapplicationguard/kdsharedmemorylocker.cpp
35    kdsingleapplicationguard/kdtoolsglobal.cpp
36    kdsingleapplicationguard/kdlockedsharedmemorypointer.cpp
37)
38mark_thirdparty_code( ${kdsagSources} )
39
40include_directories(
41    ${CMAKE_CURRENT_BINARY_DIR}
42    ${CMAKE_CURRENT_SOURCE_DIR}
43    ${YAMLCPP_INCLUDE_DIR}
44)
45
46if( WITH_PYTHON )
47    set( libSources
48        ${libSources}
49        PythonHelper.cpp
50        PythonJob.cpp
51        PythonJobApi.cpp
52    )
53    set_source_files_properties( PythonJob.cpp
54        PROPERTIES COMPILE_FLAGS "${SUPPRESS_BOOST_WARNINGS}"
55    )
56
57    include_directories(${PYTHON_INCLUDE_DIRS})
58    link_directories(${PYTHON_LIBRARIES})
59
60    include_directories(${Boost_INCLUDE_DIRS})
61    link_directories(${Boost_LIBRARY_DIRS})
62
63    set( OPTIONAL_PRIVATE_LIBRARIES
64        ${OPTIONAL_PRIVATE_LIBRARIES}
65        ${PYTHON_LIBRARIES}
66        ${Boost_LIBRARIES}
67    )
68endif()
69
70if( WITH_PYTHONQT )
71    include_directories(${PYTHON_INCLUDE_DIRS})
72    link_directories(${PYTHON_LIBRARIES})
73
74    include_directories(${PYTHONQT_INCLUDE_DIR})
75    link_directories(${PYTHONQT_LIBRARY})
76
77    set( OPTIONAL_PRIVATE_LIBRARIES
78        ${OPTIONAL_PRIVATE_LIBRARIES}
79        ${PYTHON_LIBRARIES}
80        ${PYTHONQT_LIBRARY}
81    )
82endif()
83
84
85add_library( calamares SHARED ${libSources} ${kdsagSources} ${utilsSources} )
86set_target_properties( calamares
87    PROPERTIES
88        AUTOMOC TRUE
89        VERSION ${CALAMARES_VERSION_SHORT}
90        SOVERSION ${CALAMARES_VERSION_SHORT}
91)
92
93target_link_libraries( calamares
94    LINK_PRIVATE
95        ${OPTIONAL_PRIVATE_LIBRARIES}
96    LINK_PUBLIC
97        ${YAMLCPP_LIBRARY}
98        Qt5::Core
99)
100
101install( TARGETS calamares
102    EXPORT CalamaresLibraryDepends
103    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
104    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
105    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
106)
107
108# Make symlink lib/calamares/libcalamares.so to lib/libcalamares.so.VERSION so
109# lib/calamares can be used as module path for the Python interpreter.
110install( CODE "
111    file( MAKE_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
112    execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink ../libcalamares.so.${CALAMARES_VERSION_SHORT} libcalamares.so WORKING_DIRECTORY \"\$ENV{DESTDIR}/${CMAKE_INSTALL_FULL_LIBDIR}/calamares\" )
113")
114
115# Install header files
116file( GLOB rootHeaders "*.h" )
117file( GLOB kdsingleapplicationguardHeaders "kdsingleapplicationguard/*.h" )
118file( GLOB utilsHeaders "utils/*.h" )
119
120install( FILES ${CMAKE_CURRENT_BINARY_DIR}/CalamaresConfig.h DESTINATION include/libcalamares )
121install( FILES ${rootHeaders}                       DESTINATION include/libcalamares )
122install( FILES ${kdsingleapplicationguardHeaders}   DESTINATION include/libcalamares/kdsingleapplicationguard )
123install( FILES ${utilsHeaders}                      DESTINATION include/libcalamares/utils )
Note: See TracBrowser for help on using the repository browser.