Add a bare bones Qt project
This commit is contained in:
parent
f1fe569fbb
commit
7b933e4cf1
13 changed files with 94 additions and 7 deletions
|
@ -13,4 +13,7 @@ endif ()
|
||||||
include(${CMAKE_BINARY_DIR}/conan.cmake)
|
include(${CMAKE_BINARY_DIR}/conan.cmake)
|
||||||
conan_add_remote(NAME bincrafters INDEX 1 URL https://api.bintray.com/conan/bincrafters/public-conan)
|
conan_add_remote(NAME bincrafters INDEX 1 URL https://api.bintray.com/conan/bincrafters/public-conan)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/pacman/;${CMAKE_BINARY_DIR}/pomodoro/)
|
||||||
|
|
||||||
add_subdirectory(pacman)
|
add_subdirectory(pacman)
|
||||||
|
add_subdirectory(pomodoro)
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing)
|
conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/pacman/)
|
|
||||||
|
|
||||||
find_package(sdl2 REQUIRED)
|
find_package(sdl2 REQUIRED)
|
||||||
find_package(sdl2_image REQUIRED)
|
find_package(sdl2_image REQUIRED)
|
||||||
include_directories(${sdl2_INCLUDE_DIRS} ${sdl2_image_INCLUDE_DIRS})
|
include_directories(${sdl2_INCLUDE_DIRS} ${sdl2_image_INCLUDE_DIRS})
|
||||||
|
|
|
@ -3,8 +3,8 @@ find_package(GTest REQUIRED)
|
||||||
|
|
||||||
include(GoogleTest)
|
include(GoogleTest)
|
||||||
|
|
||||||
add_executable(tests tests.cpp)
|
add_executable(pacman_tests tests.cpp)
|
||||||
target_link_libraries(tests GTest::GTest libpacman)
|
target_link_libraries(pacman_tests GTest::GTest libpacman)
|
||||||
|
|
||||||
gtest_discover_tests(tests TEST_PREFIX pacman:)
|
gtest_discover_tests(pacman_tests TEST_PREFIX pacman:)
|
||||||
add_test(NAME monolithic COMMAND tests)
|
add_test(NAME monolithic COMMAND pacman_tests)
|
11
pomodoro/CMakeLists.txt
Normal file
11
pomodoro/CMakeLists.txt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing)
|
||||||
|
|
||||||
|
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
|
add_subdirectory(lib)
|
||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(test)
|
2
pomodoro/README.md
Normal file
2
pomodoro/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[< Back](../README.md)
|
||||||
|
# Mod(C++) - Pomodoro Exercise
|
23
pomodoro/conanfile.py
Normal file
23
pomodoro/conanfile.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
from conans import ConanFile, CMake
|
||||||
|
|
||||||
|
class ConanDependencies(ConanFile):
|
||||||
|
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
generators = "cmake", "qt", "virtualrunenv"
|
||||||
|
|
||||||
|
default_options = {}
|
||||||
|
|
||||||
|
def requirements(self):
|
||||||
|
# self.requires("gtest/1.10.0")
|
||||||
|
self.requires("qt/5.15.2@bincrafters/stable")
|
||||||
|
|
||||||
|
def imports(self):
|
||||||
|
self.copy("*.dll", dst="bin", src="bin")
|
||||||
|
self.copy("*.dylib*", dst="bin", src="lib")
|
||||||
|
self.copy('*.so*', dst='lib', src='lib')
|
||||||
|
self.copy('*', dst='libexec', src='libexec')
|
||||||
|
self.copy('*', dst='plugins', src='plugins')
|
||||||
|
self.copy('*', dst='qml', src='qml')
|
||||||
|
self.copy('*', dst='translations', src='translations')
|
||||||
|
self.copy('*', dst='resources', src='resources')
|
||||||
|
self.copy("license*", dst="licenses", folder=True, ignore_case=True)
|
3
pomodoro/lib/CMakeLists.txt
Normal file
3
pomodoro/lib/CMakeLists.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
|
||||||
|
add_library(libpomodoro ${sources})
|
||||||
|
target_link_libraries(libpomodoro Qt5::Core Qt5::Gui Qt5::Widgets)
|
5
pomodoro/lib/Pomodoro.cpp
Normal file
5
pomodoro/lib/Pomodoro.cpp
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
//
|
||||||
|
// Created by patricia on 11/28/2020.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "Pomodoro.hpp"
|
8
pomodoro/lib/Pomodoro.hpp
Normal file
8
pomodoro/lib/Pomodoro.hpp
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef POMODORO_POMODORO_HPP
|
||||||
|
#define POMODORO_POMODORO_HPP
|
||||||
|
|
||||||
|
class Pomodoro {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //POMODORO_POMODORO_HPP
|
4
pomodoro/src/CMakeLists.txt
Normal file
4
pomodoro/src/CMakeLists.txt
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp")
|
||||||
|
add_executable(pomodoro ${sources})
|
||||||
|
target_link_libraries(pomodoro libpomodoro Qt5::Core Qt5::Gui Qt5::Widgets)
|
||||||
|
|
11
pomodoro/src/main.cpp
Normal file
11
pomodoro/src/main.cpp
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include "../lib/Pomodoro.hpp"
|
||||||
|
|
||||||
|
int main(int argc, char * argv[]) {
|
||||||
|
QApplication app (argc, argv);
|
||||||
|
QPushButton button ("Hello world !");
|
||||||
|
Pomodoro pomodoro;
|
||||||
|
button.show();
|
||||||
|
return app.exec();
|
||||||
|
}
|
10
pomodoro/test/CMakeLists.txt
Normal file
10
pomodoro/test/CMakeLists.txt
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
enable_testing()
|
||||||
|
find_package(GTest REQUIRED)
|
||||||
|
|
||||||
|
include(GoogleTest)
|
||||||
|
|
||||||
|
add_executable(pomodoro_tests tests.cpp)
|
||||||
|
target_link_libraries(pomodoro_tests GTest::GTest libpomodoro)
|
||||||
|
|
||||||
|
gtest_discover_tests(pomodoro_tests TEST_PREFIX pomodoro:)
|
||||||
|
add_test(NAME monolithic COMMAND pomodoro_tests)
|
10
pomodoro/test/tests.cpp
Normal file
10
pomodoro/test/tests.cpp
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
TEST(PomodoroTest, Init) {
|
||||||
|
EXPECT_EQ(1, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
return RUN_ALL_TESTS();
|
||||||
|
}
|
Loading…
Reference in a new issue