diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 555db2d..31ec988 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,11 +4,11 @@ jobs: build: runs-on: ubuntu-20.04 steps: - - name: Install Qt 💻 - run: sudo apt install qt5-default + - name: Install build dependencies 💻 + run: sudo apt install qt5-default cmake - name: Checkout repository 📩 uses: actions/checkout@v2 - name: Generate Makefile ⚙️ - run: qmake gba-tileeditor-client/gba-tileeditor-client.pro + run: cmake -S . -B build - name: Build gba-tileeditor 🛠️ - run: make -j$(nproc) \ No newline at end of file + run: cmake --build build -j$(nproc) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 682890c..b1abbe0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,13 +12,13 @@ jobs: - name: Checkout repository 📩 uses: actions/checkout@v2 - name: Generate Makefile ⚙️ - run: qmake gba-tileeditor-client/gba-tileeditor-client.pro + run: cmake -S . -B build - name: Build gba-tileeditor 🛠️ - run: make -j$(nproc) + run: cmake --build build -j$(nproc) - name: Get version number #️⃣ run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF#refs/*/} - name: Compress executable 🗜️ - run: zip release.zip gba-tileeditor + run: zip release.zip build/gba-tileeditor-client/gba-tileeditor - name: Create GBA Tile Editor Release 🏷️ id: create_release uses: actions/create-release@v1 diff --git a/.gitignore b/.gitignore index 4701e0f..8583e40 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,10 @@ gba-tileeditor moc_predefs.h *.pro.user .gdb_history +*.txt.user + +# Ignore build dir +**/build/ # VS Code files -.vscode/ \ No newline at end of file +.vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6ed4528 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.14) + +project(gba-tileeditor + LANGUAGES CXX + DESCRIPTION "A Gameboy Advance tile editor" +) + +set(CMAKE_CXX_STANDARD 17) + +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pedantic -O3") +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pedantic -g3 -O0") + +if (CMAKE_BUILD_TYPE) + message(STATUS "Build type set to " ${CMAKE_BUILD_TYPE}) +endif() + +if (NOT CMAKE_BUILD_TYPE) + message(STATUS "No build type selected, default to Release") + set(CMAKE_BUILD_TYPE "Release") +endif() + +# Otherwise headers are not processed by AUTOMOC +cmake_policy(SET CMP0100 NEW) + +add_subdirectory(gba-tileeditor-client) diff --git a/gba-tileeditor-client/CMakeLists.txt b/gba-tileeditor-client/CMakeLists.txt new file mode 100644 index 0000000..893ef03 --- /dev/null +++ b/gba-tileeditor-client/CMakeLists.txt @@ -0,0 +1,64 @@ +# cmake_minimum_required(VERSION 3.14) + +# project(gba-tileeditor) + +# set(CMAKE_CXX_STANDARD 17) + +# Otherwise headers are not processed by AUTOMOC +# cmake_policy(SET CMP0100 NEW) + + +set(CMAKE_AUTOMOC ON) + +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +set(CMAKE_AUTOUIC_SEARCH_PATHS "forms") +# set(CMAKE_INCLUDE_CURRENT_DIR ON) + +find_package(Qt5 COMPONENTS Widgets PrintSupport REQUIRED) + +set(TARGET ${CMAKE_PROJECT_NAME}) + +set(SOURCES + "src/editorwindow.cc" + "src/map.cc" + "src/mapview.cc" + "src/newdialog.cc" + "src/paletteview.cc" +) + +set(FORMS + "forms/mainwindow.ui" + "forms/newmap.ui" +) + +set(RESOURCE + "icons.qrc" +) + +set(HEADERS + "src/command.hh" + "src/editorwindow.hh" + "json.hpp" + "map.hh" + "mapview.hh" + "newdialog.hh" + "paletteview.hh" + "saveheadercommand.hh" + "savejsoncommand.hh" + "savesourcescommand.hh" +) + +set(INCLUDES + "src" +) + +# qt5_wrap_ui(UI_HEADERS ${FORMS}) + +add_executable(${TARGET} "src/main.cc") +target_sources(${TARGET} PRIVATE ${SOURCES} ${RESOURCE}) +target_compile_options(${TARGET} PRIVATE -Wall -Wextra) +target_include_directories(${TARGET} PRIVATE ${INCLUDES}) + +target_link_libraries(${TARGET} Qt5::Widgets Qt5::PrintSupport) diff --git a/gba-tileeditor-client/gba-tileeditor-client.pro b/gba-tileeditor-client/gba-tileeditor-client.pro deleted file mode 100644 index 5331d69..0000000 --- a/gba-tileeditor-client/gba-tileeditor-client.pro +++ /dev/null @@ -1,38 +0,0 @@ -# set options -CONFIG += qt debug c++17 - -# set the QT modules we need -QT += core gui -greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport - -# build an application -TARGET = gba-tileeditor -TEMPLATE = app - -# specify all the files we need -SOURCES += \ - src/editorwindow.cc \ - src/main.cc \ - src/map.cc \ - src/mapview.cc \ - src/newdialog.cc \ - src/paletteview.cc - -HEADERS += \ - src/command.hh \ - src/editorwindow.hh \ - src/map.hh \ - src/mapview.hh \ - src/newdialog.hh \ - src/paletteview.hh \ - src/saveheadercommand.hh \ - src/savejsoncommand.hh \ - src/json.hpp \ - src/savesourcescommand.hh - -INCLUDEPATH += src - -FORMS += forms/mainwindow.ui \ - forms/newmap.ui -RESOURCES = icons.qrc - diff --git a/gba-tileeditor.pro b/gba-tileeditor.pro deleted file mode 100644 index 44bc2d5..0000000 --- a/gba-tileeditor.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += gba-tileeditor-client