한국어
Qt
 

Qbs프로젝트파일에서 가장먼저 해줘야 할일은 다음과 같이 qbs를 포함해줘야한다.

import qbs

 

Product

Product는 프로젝트에서 가장 기본이되는 요소이다. 왜냐하면 Product은 일반적으로 빌드 프로세스의 결과물을 나타내기 때문이다. 일반적인 응용프로그램을 개발한다고 가정했을 때 우리는 Application이라는 Product의 일종을 사용하게 될것이다. 

 

product.png

▲Product 의 관계도

 

Application

응용프로그램 형태의 Product이다. 

 

CppApplication

일반적인 C/C++응용프로그램을 나타낸다.

CppApplication은 cpp 모듈에 종속 된 Product이다. 즉, 다음은 CppApplication과 완전히 같다.

Application {
    Depends { name: "cpp" }

    files: "main.cpp"
}

또는 다음과 같다.

Product {
    type: "application"
    Depends { name: "cpp" }
    files: "main.cpp"
}

간편하게 다음과 같이 사용할 수 있다.

CppApplication {
    files: "main.cpp"
}

 

QtApplication

QtApplication은 Qt.core 모듈에 종속 된 C++ 애플리케이션이다. 즉, CppApplication의 일종이다. 그러므로 다음과 완전히 같다.

CppApplication {
    Depends { name: "Qt.core" }
}

간편하게 다음과 같이 사용할 수 있다.

QtApplication {

}

 

Project

하나의 프로젝트파일(*.qbs)에는 하나의 Project 만 사용할 수 있으며 Project 는 여러 Product 를 포함할 수 있다. 만약 하나의 Product 로만 구성된 경우라면 Project 는 생략가능하다.

Project 는 Product 의 아이템이 될 수 없다는 점에 주의해야한다. 다음과 같이 사용할 수 있다.

Project{
    Application {
        Depends { name: "cpp" }
        files: [
            "main.cpp",
        ]
    }

    Product{
        name: "mylib"
        type: "staticlibrary"
        Depends { name: "cpp"; }
    }
}

또는 다음과 같이 다른 *qbs를 포함할 수 도 있다.

Project {
    references: [
        "product1/product1.qbs",
        "product2/product2.qbs"
    ]
}

 

Depends

Product 와 Module 간의 종속성을 나타낸다. 예를 들어 다음 제품은 cpp 모듈을로드한다.

Depends { name: "cpp" }

 

Module

Module 은 Product 빌드에 기여하기위한 아이템들 정의할 수 있다. Product 는 로드 된 모듈에서 속성을 읽고 쓸 수 있다. 모듈에는 다음 아이템들을 사용할 수 있다.

Depends
FileTagger
Group
JobLimit
Parameter
Probe
PropertyOptions
Rule
Scanner

Product 가 Module 에 대한 종속성을(Depends) 표현하면 Qbs는 Product 범위에서 Module 의 인스턴스를 만든다.

Product 는 다른 Product 의 속성에 엑세스 할 수 없지만 Export 을 사용하여 모듈의 종속성 및 속성을 다른 Product에 전달할 수 있다.

 

Group

파일을 그룹화하는 데 사용한다. Product 에 첨부되어있으며 아래 예제와 같이 여러 Group을 추가할 수 도 있다.

Application {
    Group {
        name: "common files"
        files: ["myclass.h", "myclass_common_impl.cpp"]
    }
    Group {
        name: "Windows files"
        condition: qbs.targetOS.contains("windows")
        files: "myclass_win_impl.cpp"
    }
    Group {
        name: "Unix files"
        condition: qbs.targetOS.contains("unix")
        files: "unixhelper.cpp"
        Group {
            name: "Linux files"
            condition: qbs.targetOS.contains("linux")
            files: "myclass_linux_impl.cpp"
        }
        Group {
            name: "FreeBSD files"
            condition: qbs.targetOS.contains("freebsd")
            files: "myclass_freebsd_impl.cpp"
        }
    }
    Group {
        name: "Files to install"
        qbs.install: true
        qbs.installDir: "share"
        files: "runtime_resource.txt"
    }
}

 

DynamicLibrary

동적 라이브러리를 만든다. 프로젝트에 응용프로그램과 동적라이브러리를 함께 빌드하려는 경우 다음과 같이 사용할 수 있다.

Project {
    CppApplication {
        name : "the-app"
        files : [ "main.cpp" ]
        Depends { name: "the-lib" }
    }
    DynamicLibrary {
        name: "the-lib"
        Depends { name: "cpp" }
        files: [
            "lib.cpp",
            "lib.h",
        ]
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: [product.sourceDirectory]
       }
    }
}

 

StaticLibrary

정적 라이브러리를 만든다.

 

 

Qbs 모든 아이템들 : https://doc-snapshots.qt.io/qbs-1.14/list-of-items.html

번호 제목 글쓴이 날짜 조회 수
공지 Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 운영자 2019.01.05 85859
179 Qt 응용프로그램에 Web 구성 요소를 표시 with Servo file makersweb 2024.04.27 9
178 Qt Creator 에서 GitHub Copilot 사용하기 file makersweb 2024.04.13 147
» Qbs 프로젝트를 정의하기 위해 사용되는 몇가지 중요한 아이템들 file makersweb 2019.10.13 296
176 QtQuick 애플리케이션에 Rive 애니메이션 통합 makersweb 2024.03.31 298
175 Qt 6.4에 추가될 Qt Quick 3D Physics file makersweb 2022.08.07 343
174 HTTPS URL을 연결할 때 SslHandshakeFailedError 오류 makersweb 2022.07.31 355
173 Qt Android 앱에 AdMob 배너달기 file makersweb 2021.12.04 392
172 그래픽 소프트웨어에서 디자인 내보내기 (Exporting Designs from Graphics Software) j2doll 2020.12.25 413
171 Binding 타입으로 객체 속성 간 묶기 makersweb 2022.03.04 420
170 Base64로 인코딩된 파일을 복원 makersweb 2023.08.06 429
169 VirtualKeyboard 스타일 커스터 마이징 makersweb 2022.03.13 462
168 Android 애플리케이션 서명 구성 file makersweb 2023.12.17 477
167 Qt Quick Controls 2에 네이티브 데스크탑 스타일 추가 file makersweb 2020.11.23 486
166 하드디스크 드라이브 여유 공간 계산 file makersweb 2023.01.15 493
165 앱을 종료할 때 QML 바인딩 오류를 피하는 방법 makersweb 2021.08.08 498
164 안드로이드용 Qt 6.2 makersweb 2021.10.02 504
163 성능 고려 및 제안 사항 makersweb 2022.03.07 505
162 QRhi 에 대해서 file makersweb 2023.12.29 510
161 QML의 사용자 정의 Image makersweb 2023.09.17 537
160 Qt Safe Renderer 개요 file makersweb 2022.09.08 543