~aleteoryx/muditaos

muditaos/cmake/modules/AddDatabases.cmake -rw-r--r-- 1.0 KiB
a405cad6Aleteoryx trim readme 6 days ago
                                                                                
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
#[[
Example of use:
add_databases_target(
        TARGET <target_name>
        DB_SET <database set dir>
        SOURCE_DIR <source_dir>
        DEST_DIR <destination_dir>
        DEVEL <true/false>
        DEPENDS <dependencies list>
)
]]
#
function(add_databases_target)
    cmake_parse_arguments(
            _ARG
            ""
            "TARGET;COMMON_DIR;PRODUCT_DIR;DB_SET;DEST_DIR;DEVEL;"
            "DEPENDS"
            ${ARGN}
    )

    if (${_ARG_DEVEL} STREQUAL "ON" OR ${_ARG_DEVEL} EQUAL 1)
        set(DEVEL --devel True)
    endif ()

    add_custom_target(
            ${_ARG_TARGET}
            DEPENDS ${_ARG_DEPENDS}

            COMMAND python3 ${PROJECT_SOURCE_DIR}/tools/db_migration.py init
            --env ${CMAKE_BINARY_DIR}
            --dbset ${_ARG_DB_SET}
            --out ${_ARG_DEST_DIR}
            --dirs ${_ARG_PRODUCT_DIR}
            --dirs ${_ARG_COMMON_DIR}

            COMMAND python3 ${PROJECT_SOURCE_DIR}/tools/db_migration.py install
            --env ${CMAKE_BINARY_DIR} ${DEVEL}
    )
endfunction()