Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace PRO project with CMake #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ install:
before_build:
# Prepare the out-of-source build directory
- mkdir %APPVEYOR_BUILD_FOLDER%-build
- qmake -o %APPVEYOR_BUILD_FOLDER%-build -r -Wall -Wlogic -Wparser CONFIG+=%CONFIGURATION% %APPVEYOR_BUILD_FOLDER%/emulator
- cd %APPVEYOR_BUILD_FOLDER%-build
- if %QTDIR:msvc=%==%QTDIR% cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc -DCMAKE_MAKE_PROGRAM=mingw32-make -G "MinGW Makefiles" ..\ukncbtl-qt\emulator
- if not %QTDIR:msvc=%==%QTDIR% cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=%configuration% ..\ukncbtl-qt\emulator

build_script:
- cd %APPVEYOR_BUILD_FOLDER%-build
- '%make%'
- cmake --build .
2 changes: 1 addition & 1 deletion .github/workflows/linux-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Build
run: |
cd emulator
qmake "CONFIG+=release" -r GST_VERSION=1.0 QtUkncBtl.pro
cmake -G "Unix Makefiles" .
make

- name: Packaging
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v3

- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: '${{ env.QT_VERSION }}'
target: 'desktop'
Expand All @@ -27,8 +27,8 @@ jobs:
- name: Build
run: |
cd emulator
qmake "CONFIG+=release" -r GST_VERSION=1.0 QtUkncBtl.pro
make
cmake -G "Unix Makefiles" .
cmake --build .

- name: Packaging
working-directory: ${{ env.SOURCE_DIR }}/emulator
Expand All @@ -39,7 +39,7 @@ jobs:
mv QtUkncBtl.dmg QtUkncBtl-macOS-${{ github.run_id }}.dmg
ls -l *.dmg

- name: Linux artefact
- name: macOS artefact
uses: actions/upload-artifact@v3
with:
name: DMG
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ The UKNCBTL project consists of:
### Собрать из исходников

1. Установить пакеты: Qt 5 + QtScript<br>
`sudo apt install qtbase5-dev qt5-qmake qtscript5-dev`
`sudo apt install cmake qtbase5-dev qt5-qmake qtscript5-dev`
2. Скачать исходники: либо через<br>
`git clone https://github.com/nzeemin/ukncbtl-qt.git`<br>
либо скачать как .zip и распаковать
3. Выполнить команды:<br>
`cd emulator`<br>
`qmake "CONFIG+=release" QtUkncBtl.pro`<br>
`cmake -G "Unix Makefiles" .`<br>
`make`<br>
4. Дать права на выполнение: `chmod +x QtUkncBtl`
5. Запустить `QtUkncBtl`
Expand Down
85 changes: 85 additions & 0 deletions emulator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
cmake_minimum_required(VERSION 3.16)

project(QtUkncBtl VERSION 0.1 LANGUAGES CXX)

SET(CMAKE_OSX_ARCHITECTURES "x86_64")

add_subdirectory(emubase)
add_subdirectory(util)

find_package(Qt5 REQUIRED COMPONENTS Widgets LinguistTools Script Multimedia Test)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
Common.cpp
Emulator.cpp
qscreen.cpp
qkeyboardview.cpp
Settings.cpp
qdebugview.cpp
qdisasmview.cpp
qconsoleview.cpp
qmemoryview.cpp
qsoundout.cpp
qscripting.cpp
qdialogs.cpp
UnitTests.cpp
)
set(PROJECT_HEADERS
mainwindow.h
stdafx.h
Common.h
Emulator.h
qscreen.h
qkeyboardview.h
main.h
qdebugview.h
qdisasmview.h
qconsoleview.h
qmemoryview.h
qsoundout.h
qscripting.h
qdialogs.h
UnitTests.h
)

set ( PROJECT_UIS mainwindow.ui )
set ( PROJECT_RESOURCES QtUkncBtl.qrc )

qt5_create_translation(QM_FILES ${PROJECT_SOURCES} lang/ukncbtl_en.ts lang/ukncbtl_ru.ts)
configure_file(translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

add_executable(QtUkncBtl
${PROJECT_SOURCES}
${PROJECT_HEADERS}
${PROJECT_UIS}
${PROJECT_RESOURCES}
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
)

target_include_directories(QtUkncBtl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(QtUkncBtl PRIVATE emubase util Qt5::Widgets Qt5::Script Qt5::Multimedia Qt5::Test)

set_target_properties(QtUkncBtl PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)

include(GNUInstallDirs)
install(TARGETS QtUkncBtl
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
69 changes: 0 additions & 69 deletions emulator/QtUkncBtl.pro

This file was deleted.

4 changes: 0 additions & 4 deletions emulator/QtUkncBtl.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,4 @@
<file>images/ukncbtl.png</file>
<file>uknc_rom.bin</file>
</qresource>
<qresource prefix="/lang">
<file alias="ukncbtl_en.qm">lang/ukncbtl_en.qm</file>
<file alias="ukncbtl_ru.qm">lang/ukncbtl_ru.qm</file>
</qresource>
</RCC>
32 changes: 32 additions & 0 deletions emulator/emubase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.16)

project(emubase LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(EMUBASE_SOURCES
Board.cpp
Disasm.cpp
Floppy.cpp
Hard.cpp
Memory.cpp
Processor.cpp
SoundAY.cpp
)

set(EMUBASE_HEADERS
stdafx.h
Board.h
Defines.h
Emubase.h
Memory.h
Processor.h
)

add_library(emubase STATIC
${EMUBASE_SOURCES}
${EMUBASE_HEADERS}
)

target_compile_definitions(emubase PRIVATE EMUBASE_LIBRARY)
2 changes: 2 additions & 0 deletions emulator/emubase/Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ UKNCBTL. If not, see <http://www.gnu.org/licenses/>. */
#include "Processor.h"
#include "Emubase.h"

// Processor register names
const LPCTSTR REGISTER_NAME[] = { "R0", "R1", "R2", "R3", "R4", "R5", "SP", "PC" };

// Timings ///////////////////////////////////////////////////////////

Expand Down
2 changes: 2 additions & 0 deletions emulator/emubase/Processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ UKNCBTL. If not, see <http://www.gnu.org/licenses/>. */
#include "Defines.h"
#include "Memory.h"

// Processor register names
extern const LPCTSTR REGISTER_NAME[];

class CMemoryController;

Expand Down
68 changes: 68 additions & 0 deletions emulator/emubase/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include <cstdint>
#include <cassert>
#include <cstdlib>
#include <cstdio>
#include <cstring>

#ifdef _MSC_VER
#include <windows.h>
#endif

#ifndef CALLBACK
# define CALLBACK
#endif // CALLBACK

#ifndef TCHAR
typedef char TCHAR;
#define _tfopen fopen
#define _tcscpy strcpy
#define _tstat _stat
#define _tcsrchr strrchr
#define _tcsicmp strcasecmp
#define _tcscmp strcmp
#define _tcslen strlen
#define _sntprintf _snprintf
#define _snprintf snprintf
#endif // TCHAR

#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif

#ifndef _T
# define _T(str) (str)
#endif // _T

#ifndef LPTSTR
typedef TCHAR* LPTSTR;
#endif // LCTSTR

#ifndef LPCTSTR
typedef const TCHAR* LPCTSTR;
#endif // LPCTSTR

#ifndef ASSERT
# define ASSERT(expr) assert(expr)
#endif // ASSERT

#ifndef MAKEWORD
#define MAKEWORD(a, b) ((uint16_t)(((uint8_t)(((uint32_t)(a)) & 0xff)) | ((uint16_t)((uint8_t)(((uint32_t)(b)) & 0xff))) << 8))
#endif // MAKEWORD

//////////////////////////////////////////////////////////////////////
// DebugPrint

void DebugPrint(const char* message);
void DebugPrintFormat(const char* pszFormat, ...);
void DebugLog(const char* message);
void DebugLogFormat(const char* pszFormat, ...);

void PrintOctalValue(char* buffer, uint16_t value);
9 changes: 9 additions & 0 deletions emulator/translations.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE RCC>
<RCC version="1.0">
<qresource prefix="/i18n">
<!-- Add the compiled .qm files here -->
<file>ukncbtl_en.qm</file>
<file>ukncbtl_ru.qm</file>
<!-- Add more .qm files if needed -->
</qresource>
</RCC>
22 changes: 22 additions & 0 deletions emulator/util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.16)

project(util LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(UTIL_SOURCES
WavPcmFile.cpp
)

set(UTIL_HEADERS
stdafx.h
WavPcmFile.h
)

add_library(util STATIC
${UTIL_SOURCES}
${UTIL_HEADERS}
)

target_compile_definitions(util PRIVATE EMUBASE_LIBRARY)
Loading