├── cmake ├── README.md ├── ComponentInstall.cmake ├── RuntimeDependencies.cmake ├── Findclang_tidy.cmake ├── FindGTK4.cmake ├── Findgcov.cmake ├── Findcppcheck.cmake ├── FindGTK3.cmake ├── FindHIDAPI.cmake ├── FindSDL2.cmake ├── GenerateTemplateExportHeader.cmake ├── ClangTidy.cmake ├── Cppcheck.cmake ├── Findlcov.cmake ├── FindEGL.cmake ├── FindGLESv2.cmake ├── Coverage.cmake ├── Findgoogletest.cmake ├── FindGLEW.cmake ├── Custom.cmake ├── GetGitRevisionDescription.cmake.in ├── CheckTemplate.cmake ├── Findnodejs.cmake ├── FindASSIMP.cmake ├── FindFFMPEG.cmake ├── HealthCheck.cmake ├── Gcov.cmake ├── GetGitRevisionDescription.cmake └── CompileOptions.cmake ├── docs ├── README.md ├── CMakeLists.txt ├── manual │ ├── cmake-init.tex │ └── CMakeLists.txt └── api-docs │ └── CMakeLists.txt ├── .ignore ├── deploy ├── ubuntu-ppa │ ├── debian │ │ ├── compat │ │ ├── source │ │ │ └── format │ │ ├── changelog │ │ ├── copyright │ │ ├── control │ │ └── rules │ └── recipe.txt ├── README.md ├── CMakeLists.txt └── packages │ └── pack-template.cmake ├── cmake-init-logo.png ├── source ├── tests │ ├── fiblib-test │ │ ├── main.cpp │ │ ├── fibonacci_test.cpp │ │ └── CMakeLists.txt │ ├── README.md │ └── CMakeLists.txt ├── examples │ ├── CMakeLists.txt │ ├── fibgui │ │ ├── main.cpp │ │ ├── MainWindow.h │ │ ├── MainWindow.cpp │ │ ├── CMakeLists.txt │ │ └── MainWindow.ui │ └── fibcmd │ │ ├── main.cpp │ │ └── CMakeLists.txt ├── baselib │ ├── include │ │ └── baselib │ │ │ └── baselib.h │ ├── source │ │ └── baselib.cpp │ └── CMakeLists.txt ├── fiblib │ ├── source │ │ └── Fibonacci.cpp │ ├── include │ │ └── fiblib │ │ │ ├── CTFibonacci.inl │ │ │ ├── CTFibonacci.h │ │ │ └── Fibonacci.h │ └── CMakeLists.txt ├── README.md ├── codegeneration │ ├── template_msvc_api.h.in │ └── template_api.h.in ├── CMakeLists.txt └── version.h.in ├── AUTHORS ├── data └── README.md ├── .gitignore ├── LICENSE ├── .github └── workflows │ └── ci.yml ├── appveyor.yml ├── template-config.cmake ├── Dockerfile ├── .travis.yml ├── cmake-init-logo.svg ├── ADAPT.md ├── configure ├── CMakeLists.txt └── README.md /cmake/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | source/tests/googletest/* 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /cmake-init-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cginternals/cmake-init/HEAD/cmake-init-logo.png -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/recipe.txt: -------------------------------------------------------------------------------- 1 | # git-build-recipe format 0.4 deb-version {debupstream}+{revno} 2 | lp:cmake-init 3 | nest-part packaging lp:cmake-init deploy/ubuntu-ppa/debian debian master 4 | -------------------------------------------------------------------------------- /source/tests/fiblib-test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main(int argc, char* argv[]) 5 | { 6 | ::testing::InitGoogleMock(&argc, argv); 7 | return RUN_ALL_TESTS(); 8 | } 9 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/changelog: -------------------------------------------------------------------------------- 1 | 2 | cmake-init (2.0.0-0) UNRELEASED; urgency=low 3 | 4 | * Initial release. 5 | 6 | -- Willy Scheibel Tue, 31 Jan 2017 13:30:00 +0100 7 | -------------------------------------------------------------------------------- /source/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Check if examples are enabled 3 | if(NOT OPTION_BUILD_EXAMPLES) 4 | return() 5 | endif() 6 | 7 | # Example applications 8 | add_subdirectory(fibcmd) 9 | add_subdirectory(fibgui) 10 | -------------------------------------------------------------------------------- /deploy/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Deployment Types 3 | 4 | ## System Install 5 | 6 | ## Global Install 7 | 8 | ## Source Build 9 | 10 | ## Relocatable 11 | 12 | # Packages and Installer 13 | 14 | ## Package Manager 15 | 16 | # Components 17 | -------------------------------------------------------------------------------- /cmake/ComponentInstall.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and COMPONENT environment variable 3 | 4 | execute_process( 5 | COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake 6 | ) 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | Stefan Buschmann 3 | Daniel Limberger 4 | Willy Scheibel 5 | 6 | Thanks to all Contributors 7 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'docs' 4 | # 5 | 6 | if(NOT OPTION_BUILD_DOCS) 7 | return() 8 | endif() 9 | 10 | add_custom_target(docs) 11 | 12 | 13 | # 14 | # Documentation 15 | # 16 | 17 | add_subdirectory(api-docs) 18 | add_subdirectory(manual) 19 | -------------------------------------------------------------------------------- /source/examples/fibgui/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "MainWindow.h" 3 | 4 | #include 5 | 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | QApplication application(argc, argv); 10 | 11 | MainWindow mainWindow; 12 | mainWindow.show(); 13 | 14 | return application.exec(); 15 | } 16 | -------------------------------------------------------------------------------- /source/baselib/include/baselib/baselib.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace baselib 11 | { 12 | 13 | 14 | /** 15 | * @brief 16 | * Print information about the library to the console 17 | */ 18 | BASELIB_API void printInfo(); 19 | 20 | 21 | } // namespace baselib 22 | -------------------------------------------------------------------------------- /source/tests/README.md: -------------------------------------------------------------------------------- 1 | ## Enabling Tests based on googletest 2 | 3 | cmake-init will not ship with the sources required to build the tests. 4 | Instead, any developer is asked to install a source release of googletest on their machine. 5 | 6 | ### Official Sources 7 | 8 | ### Ubuntu Package 9 | 10 | On ubuntu, a compatible release of googletest can be installed using the package `libgmock-dev`: 11 | 12 | ```bash 13 | > sudo apt install libgmock-dev 14 | ``` -------------------------------------------------------------------------------- /source/fiblib/source/Fibonacci.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | namespace fiblib 6 | { 7 | 8 | 9 | Fibonacci::Fibonacci() 10 | { 11 | } 12 | 13 | Fibonacci::~Fibonacci() 14 | { 15 | } 16 | 17 | unsigned int Fibonacci::operator()(unsigned int i) 18 | { 19 | if (i < 2) { 20 | return i; 21 | } else { 22 | return this->operator()(i - 1) + this->operator()(i - 2); 23 | } 24 | } 25 | 26 | 27 | } // namespace fiblib 28 | -------------------------------------------------------------------------------- /cmake/RuntimeDependencies.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Default dependencies for the runtime-package 4 | # 5 | 6 | # Install 3rd-party runtime dependencies into runtime-component 7 | # install(FILES ... COMPONENT runtime) 8 | 9 | 10 | # 11 | # Full dependencies for self-contained packages 12 | # 13 | 14 | if(OPTION_SELF_CONTAINED) 15 | 16 | # Install 3rd-party runtime dependencies into runtime-component 17 | # install(FILES ... COMPONENT runtime) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /source/fiblib/include/fiblib/CTFibonacci.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | 7 | namespace fiblib 8 | { 9 | 10 | 11 | template <> 12 | class FIBLIB_TEMPLATE_API CTFibonacci<0> 13 | { 14 | public: 15 | enum { 16 | value = 0 17 | }; 18 | }; 19 | 20 | template <> 21 | class FIBLIB_TEMPLATE_API CTFibonacci<1> 22 | { 23 | public: 24 | enum { 25 | value = 1 26 | }; 27 | }; 28 | 29 | 30 | } // namespace fiblib 31 | -------------------------------------------------------------------------------- /data/README.md: -------------------------------------------------------------------------------- 1 | This is the runtime data folder for your project. 2 | 3 | Use it only for data that is needed and loaded at runtime by your application. 4 | It is installed and shipped during packaging of your application. 5 | 6 | Other data files such as desktop icons, init scripts, or files needed for packaging, 7 | belong into the deploy directory. 8 | 9 | Have a look at the cmake-init documentation to learn how your application is able 10 | to locate its data folder at runtime. 11 | -------------------------------------------------------------------------------- /source/tests/fiblib-test/fibonacci_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | #include 6 | 7 | class fibonacci_test: public testing::Test 8 | { 9 | public: 10 | }; 11 | 12 | TEST_F(fibonacci_test, CheckSomeResults) 13 | { 14 | fiblib::Fibonacci fib; 15 | 16 | EXPECT_EQ((unsigned int) 0, fib(0)); 17 | EXPECT_EQ((unsigned int) 1, fib(1)); 18 | EXPECT_EQ((unsigned int) 1, fib(2)); 19 | EXPECT_EQ((unsigned int)21, fib(8)); 20 | // ... 21 | } 22 | -------------------------------------------------------------------------------- /source/fiblib/include/fiblib/CTFibonacci.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace fiblib 9 | { 10 | 11 | 12 | /** 13 | * @brief 14 | * Compile-time computation of fibonacci numbers 15 | */ 16 | template 17 | class FIBLIB_TEMPLATE_API CTFibonacci 18 | { 19 | public: 20 | enum { 21 | value = CTFibonacci::value + CTFibonacci::value 22 | }; 23 | }; 24 | 25 | 26 | } // namespace fiblib 27 | 28 | 29 | #include 30 | -------------------------------------------------------------------------------- /source/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Target Types 3 | 4 | ## Command-line Executable 5 | 6 | ## GUI Executable 7 | 8 | ## Flexible Library 9 | 10 | ## Shared Library 11 | 12 | ## Static Library 13 | 14 | ## Plugin 15 | 16 | ## Header-only Library 17 | 18 | ## Virtual Library 19 | 20 | ## CMake-only Library 21 | 22 | # Dependencies 23 | 24 | # Build Options 25 | 26 | # Compiler Features 27 | 28 | # Source Code 29 | 30 | # Tests 31 | 32 | ## Testing Systems 33 | 34 | ## External Testing 35 | 36 | # Continuous Integration 37 | 38 | # Linter 39 | -------------------------------------------------------------------------------- /source/codegeneration/template_msvc_api.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef @target_id@_TEMPLATE_API_H 3 | #define @target_id@_TEMPLATE_API_H 4 | 5 | #include <@target@/@target@_export.h> 6 | 7 | #ifdef @target_id@_STATIC_DEFINE 8 | # define @target_id@_TEMPLATE_API 9 | #else 10 | # ifndef @target_id@_TEMPLATE_API 11 | # ifdef @target_id@_EXPORTS 12 | /* We are building this library */ 13 | # define @target_id@_TEMPLATE_API 14 | # else 15 | /* We are using this library */ 16 | # define @target_id@_TEMPLATE_API 17 | # endif 18 | # endif 19 | 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianised by Willy Scheibel on 2 | Tue, 31 Jan 2017 13:30:00 +0100 3 | 4 | It was downloaded from: 5 | 6 | https://github.com/cginternals/cmake-init 7 | 8 | Upstream Author: 9 | 10 | CG Internals 11 | 12 | Copyright: 13 | 14 | Copyright (c) 2015-2025 CG Internals GmbH and Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany. 15 | 16 | License: 17 | 18 | This software is available to you under the terms of the MIT license, see "https://github.com/cginternals/cmake-init/blob/master/LICENSE". 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Build dir 16 | *-build* 17 | build* 18 | debug_build 19 | release_build 20 | /bin 21 | /lib 22 | /install 23 | 24 | # Qt cache 25 | CMakeLists.txt.user 26 | CMakeLists.txt.user.* 27 | 28 | # IDE project files 29 | *.sublime-project 30 | *.sublime-workspace 31 | 32 | # Local config windows 33 | _configure.bat 34 | _open-project.bat 35 | _start-cmake-gui.bat 36 | _start-cmd.bat 37 | 38 | # Local config unix 39 | .localconfig 40 | 41 | # Wiki 42 | wiki 43 | -------------------------------------------------------------------------------- /source/codegeneration/template_api.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef @target_id@_TEMPLATE_API_H 3 | #define @target_id@_TEMPLATE_API_H 4 | 5 | #include <@target@/@target@_export.h> 6 | 7 | #ifdef @target_id@_STATIC_DEFINE 8 | # define @target_id@_TEMPLATE_API 9 | #else 10 | # ifndef @target_id@_TEMPLATE_API 11 | # ifdef @target_id@_EXPORTS 12 | /* We are building this library */ 13 | # define @target_id@_TEMPLATE_API __attribute__((visibility("default"))) 14 | # else 15 | /* We are using this library */ 16 | # define @target_id@_TEMPLATE_API __attribute__((visibility("default"))) 17 | # endif 18 | # endif 19 | 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /cmake/Findclang_tidy.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findclang_tidy results: 3 | # clang_tidy_FOUND 4 | # clang_tidy_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | find_program(clang_tidy_EXECUTABLE 9 | NAMES 10 | clang-tidy-3.5 11 | clang-tidy-3.6 12 | clang-tidy-3.7 13 | clang-tidy-3.8 14 | clang-tidy-3.9 15 | clang-tidy-4.0 16 | clang-tidy 17 | PATHS 18 | "${CLANG_TIDY_DIR}" 19 | ) 20 | 21 | find_package_handle_standard_args(clang_tidy 22 | FOUND_VAR 23 | clang_tidy_FOUND 24 | REQUIRED_VARS 25 | clang_tidy_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(clang_tidy_EXECUTABLE) -------------------------------------------------------------------------------- /cmake/FindGTK4.cmake: -------------------------------------------------------------------------------- 1 | 2 | # GTK4::GTK4 3 | # GTK4_FOUND 4 | # GTK4_INCLUDE_DIRS 5 | # GTK4_LIBRARIES 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_package(PkgConfig QUIET) 10 | pkg_check_modules(GTK4 QUIET IMPORTED_TARGET gtk4) 11 | 12 | set(GTK4_FOUND OFF) 13 | 14 | if(TARGET PkgConfig::GTK4) 15 | set(GTK4_FOUND ON) 16 | 17 | add_library(GTK4::GTK4 INTERFACE IMPORTED) 18 | 19 | set_target_properties(GTK4::GTK4 PROPERTIES 20 | INTERFACE_LINK_LIBRARIES PkgConfig::GTK4 21 | ) 22 | 23 | endif() 24 | 25 | find_package_handle_standard_args(GTK4 26 | DEFAULT_MSG 27 | REQUIRED_VARS 28 | GTK4_FOUND 29 | ) 30 | mark_as_advanced(GTK4_FOUND) 31 | -------------------------------------------------------------------------------- /deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'pack' 4 | # 5 | 6 | add_custom_target(pack) 7 | set_target_properties(pack PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1) 8 | 9 | 10 | # Install additional runtime dependencies 11 | include(${PROJECT_SOURCE_DIR}/cmake/RuntimeDependencies.cmake) 12 | 13 | 14 | # 15 | # Packages 16 | # 17 | 18 | include(packages/pack-${META_PROJECT_NAME}.cmake) 19 | 20 | 21 | # 22 | # Target 'component_install' 23 | # 24 | 25 | add_custom_target( 26 | component_install 27 | COMMAND make preinstall 28 | COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/ComponentInstall.cmake 29 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} 30 | ) 31 | -------------------------------------------------------------------------------- /cmake/Findgcov.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findgcov results: 3 | # gcov_FOUND 4 | # gcov_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(gcov_EXECUTABLE 12 | NAMES 13 | gcov 14 | PATHS 15 | "${GCOV_DIR}" 16 | "$ENV{GCOV_DIR}" 17 | "$ENV{PROGRAMFILES}/gcov" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/gcov" 19 | ) 20 | 21 | find_package_handle_standard_args(gcov 22 | FOUND_VAR 23 | gcov_FOUND 24 | REQUIRED_VARS 25 | gcov_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(gcov_EXECUTABLE) 29 | -------------------------------------------------------------------------------- /source/examples/fibcmd/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | 10 | int main(int /*argc*/, char* /*argv*/[]) 11 | { 12 | // Print library info 13 | baselib::printInfo(); 14 | std::cout << std::endl; 15 | 16 | // Calculate and print fibonacci number 17 | std::cout << "Fibonacci library" << std::endl; 18 | std::cout << "========================================" << std::endl; 19 | std::cout << "CTFibonacci(6) = " << fiblib::CTFibonacci<6>::value << std::endl; 20 | std::cout << "Fibonacci(8) = " << fiblib::Fibonacci()(8) << std::endl; 21 | std::cout << std::endl; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /source/examples/fibgui/MainWindow.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | 9 | namespace Ui { 10 | class MainWindow; 11 | } 12 | 13 | 14 | /** 15 | * @brief 16 | * Main window of the fibgui example 17 | */ 18 | class MainWindow : public QMainWindow 19 | { 20 | Q_OBJECT 21 | 22 | 23 | public: 24 | /** 25 | * @brief 26 | * Constructor 27 | */ 28 | MainWindow(); 29 | 30 | /** 31 | * @brief 32 | * Destructor 33 | */ 34 | virtual ~MainWindow(); 35 | 36 | 37 | protected slots: 38 | void on_editNumber_valueChanged(int value); 39 | void on_about(); 40 | 41 | 42 | protected: 43 | const QScopedPointer m_ui; 44 | }; 45 | -------------------------------------------------------------------------------- /cmake/Findcppcheck.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findcppcheck results: 3 | # cppcheck_FOUND 4 | # cppcheck_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(cppcheck_EXECUTABLE 12 | NAMES 13 | cppcheck 14 | PATHS 15 | "${CPPCHECK_DIR}" 16 | "$ENV{CPPCHECK_DIR}" 17 | "$ENV{PROGRAMFILES}/Cppcheck" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/Cppcheck" 19 | ) 20 | 21 | find_package_handle_standard_args(cppcheck 22 | FOUND_VAR 23 | cppcheck_FOUND 24 | REQUIRED_VARS 25 | cppcheck_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(cppcheck_EXECUTABLE) 29 | -------------------------------------------------------------------------------- /cmake/FindGTK3.cmake: -------------------------------------------------------------------------------- 1 | 2 | # GTK3::GTK3 3 | # GTK3_FOUND 4 | # GTK3_INCLUDE_DIRS 5 | # GTK3_LIBRARIES 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_package(PkgConfig QUIET) 10 | pkg_check_modules(GTK3 QUIET gtk+-3.0) 11 | 12 | if(GTK3_FOUND) 13 | 14 | add_library(GTK3::GTK3 INTERFACE IMPORTED) 15 | 16 | set_target_properties(GTK3::GTK3 PROPERTIES 17 | INTERFACE_INCLUDE_DIRECTORIES "${GTK3_INCLUDE_DIRS}" 18 | ) 19 | 20 | set_target_properties(GTK3::GTK3 PROPERTIES 21 | INTERFACE_LINK_LIBRARIES "${GTK3_LIBRARIES}" 22 | ) 23 | 24 | endif() 25 | 26 | find_package_handle_standard_args(GTK3 27 | DEFAULT_MSG 28 | REQUIRED_VARS 29 | GTK3_FOUND 30 | ) 31 | 32 | mark_as_advanced(GTK3_FOUND GTK3_INCLUDE_DIRS GTK3_LIBRARIES) 33 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Configuration for all sub-projects 4 | # 5 | 6 | # Generate version-header 7 | configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME}/${META_PROJECT_NAME}-version.h) 8 | 9 | 10 | # 11 | # Sub-projects 12 | # 13 | 14 | # Libraries 15 | set(IDE_FOLDER "") 16 | add_subdirectory(baselib) 17 | add_subdirectory(fiblib) 18 | 19 | # Examples 20 | set(IDE_FOLDER "Examples") 21 | add_subdirectory(examples) 22 | 23 | # Tests 24 | if(OPTION_BUILD_TESTS) 25 | set(IDE_FOLDER "Tests") 26 | add_subdirectory(tests) 27 | endif() 28 | 29 | 30 | # 31 | # Deployment 32 | # 33 | 34 | # Deploy generated headers 35 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME} DESTINATION include COMPONENT dev) 36 | -------------------------------------------------------------------------------- /cmake/FindHIDAPI.cmake: -------------------------------------------------------------------------------- 1 | 2 | # HIDAPI_FOUND 3 | # HIDAPI_INCLUDE_DIRS 4 | # HIDAPI_LIBRARIES 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | find_path(HIDAPI_INCLUDE_DIRS 9 | NAMES hidapi/hidapi.h 10 | /usr/include 11 | /usr/local/include 12 | /sw/include 13 | /opt/local/include 14 | DOC "The directory where hidapi/hidapi.h resides") 15 | 16 | find_library(HIDAPI_LIBRARIES 17 | NAMES hidapi-hidraw hidapi-libusb 18 | PATHS 19 | /usr/lib64 20 | /usr/local/lib64 21 | /sw/lib64 22 | /opt/loca/lib64 23 | /usr/lib 24 | /usr/local/lib 25 | /sw/lib 26 | /opt/local/lib 27 | DOC "The hidapi library") 28 | 29 | 30 | find_package_handle_standard_args(HIDAPI REQUIRED_VARS HIDAPI_LIBRARIES HIDAPI_INCLUDE_DIRS) 31 | 32 | mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY) 33 | 34 | -------------------------------------------------------------------------------- /source/fiblib/include/fiblib/Fibonacci.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace fiblib 9 | { 10 | 11 | 12 | /** 13 | * @brief 14 | * Calculator of fibonacci numbers 15 | */ 16 | class FIBLIB_API Fibonacci 17 | { 18 | public: 19 | /** 20 | * @brief 21 | * Constructor 22 | */ 23 | Fibonacci(); 24 | 25 | /** 26 | * @brief 27 | * Destructor 28 | */ 29 | virtual ~Fibonacci(); 30 | 31 | /** 32 | * @brief 33 | * Calculate fibonacci number 34 | * 35 | * @param[in] i 36 | * Index 37 | * 38 | * @return 39 | * Value of the i'th fibonacci number 40 | */ 41 | unsigned int operator()(unsigned int i); 42 | }; 43 | 44 | 45 | } // namespace fiblib 46 | -------------------------------------------------------------------------------- /cmake/FindSDL2.cmake: -------------------------------------------------------------------------------- 1 | 2 | # SDL2::SDL2 3 | # SDL2_FOUND 4 | # SDL2_INCLUDE_DIRS 5 | # SDL2_LIBRARIES 6 | 7 | include(FindPackageHandleStandardArgs) 8 | 9 | find_package(PkgConfig QUIET) 10 | pkg_check_modules(SDL2 QUIET sdl2) 11 | 12 | if(SDL2_FOUND) 13 | 14 | add_library(SDL2::SDL2 INTERFACE IMPORTED) 15 | 16 | set_target_properties(SDL2::SDL2 PROPERTIES 17 | INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}" 18 | ) 19 | 20 | set_target_properties(SDL2::SDL2 PROPERTIES 21 | INTERFACE_LINK_LIBRARIES "${SDL2_LIBRARIES}" 22 | ) 23 | 24 | endif() 25 | 26 | find_package_handle_standard_args(SDL2 27 | DEFAULT_MSG 28 | REQUIRED_VARS 29 | SDL2_INCLUDE_DIRS 30 | SDL2_LIBRARIES 31 | ) 32 | 33 | mark_as_advanced(SDL2_FOUND SDL2_INCLUDE_DIRS SDL2_LIBRARIES) 34 | -------------------------------------------------------------------------------- /cmake/GenerateTemplateExportHeader.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Creates an export header similar to generate_export_header, but for templates. 3 | # The main difference is that for MSVC, templates must not get exported. 4 | # When the file ${export_file} is included in source code, the macro ${target_id}_TEMPLATE_API 5 | # may get used to define public visibility for templates on GCC and Clang platforms. 6 | function(generate_template_export_header target target_id export_file) 7 | if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") 8 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_msvc_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file}) 9 | else() 10 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file}) 11 | endif() 12 | endfunction() 13 | -------------------------------------------------------------------------------- /docs/manual/cmake-init.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | 4 | \usepackage[pdfborder={0 0 0}]{hyperref} 5 | 6 | \begin{document} 7 | 8 | \title{cmake-init: C++ CMake Project Template} 9 | 10 | \maketitle 11 | 12 | \begin{abstract} 13 | \noindent 14 | cmake-init is a copy and paste template, that provides the following features: 15 | 16 | \begin{itemize} 17 | \item Cross Platform 18 | \begin{itemize} 19 | \item Windows 20 | \item Linux 21 | \item Mac 22 | \end{itemize} 23 | \item Libraries, Applications, Testing template 24 | \item Documentation template 25 | \item Installation, Packaging template 26 | \item CMake find script template for defined libraries 27 | \end{itemize} 28 | 29 | \end{abstract} 30 | 31 | \setcounter{tocdepth}{2} 32 | \tableofcontents 33 | 34 | \newpage 35 | 36 | \end{document} 37 | -------------------------------------------------------------------------------- /source/examples/fibgui/MainWindow.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "MainWindow.h" 3 | 4 | #include 5 | 6 | #include