Skip to content

Commit a205195

Browse files
committed
added project structure
1 parent b1f8c2d commit a205195

14 files changed

+218
-23
lines changed

CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.1.3)
2+
project(graphyQmlEngine)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
# Download automatically, you can also just copy the conan.cmake file
7+
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/conan.cmake")
8+
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
9+
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake"
10+
"${CMAKE_CURRENT_BINARY_DIR}/conan.cmake")
11+
endif()
12+
include(${CMAKE_BINARY_DIR}/conan.cmake)
13+
14+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
15+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
16+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
17+
18+
add_subdirectory(lib)
19+
add_subdirectory(app)
20+
add_subdirectory(test)

LICENSE

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2020 CoDe Available
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2020 CoDe Available
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# graphy-qml-engine
2-
QML Engine
1+
# graphyQmlEngine
2+

_clang-format

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
BasedOnStyle: Microsoft
3+
AlignAfterOpenBracket: Align
4+
AlignEscapedNewlines: Left
5+
AlignConsecutiveMacros: 'true'
6+
AlignEscapedNewlines: 'true'
7+
AlignConsecutiveAssignments: 'true'
8+
AlignOperands: 'true'
9+
AlignTrailingComments: 'true'
10+
AllowAllArgumentsOnNextLine: 'false'
11+
AllowAllConstructorInitializersOnNextLine: 'false'
12+
AllowAllParametersOfDeclarationOnNextLine: 'false'
13+
AllowShortCaseLabelsOnASingleLine: 'false'
14+
AllowShortLambdasOnASingleLine: 'false'
15+
AllowShortFunctionsOnASingleLine: 'false'
16+
BreakBeforeBinaryOperators: 'false'
17+
BreakBeforeTernaryOperators: 'true'
18+
IncludeBlocks: Regroup
19+
Language: Cpp
20+
NamespaceIndentation: All
21+
PointerAlignment: Left
22+
SpaceBeforeAssignmentOperators: 'true'
23+
SpaceBeforeCpp11BracedList: 'true'
24+
ColumnLimit: 175
25+
UseTab: ForIndentation
26+
Standard: Auto
27+
BinPackArguments: 'false'
28+
BinPackParameters: 'true'
29+
BraceWrapping:
30+
AfterClass: true
31+
AfterControlStatement: false
32+
AfterEnum: true
33+
AfterFunction: true
34+
AfterNamespace: true
35+
AfterObjCDeclaration: true
36+
AfterStruct: true
37+
AfterUnion: true
38+
BeforeCatch: true
39+
BeforeElse: true
40+
BreakBeforeBraces: Custom
41+
42+
...

_gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.idea
2+
.vs
3+
cmake-build-debug
4+
cmake-build-release
5+
cmake-build-*
6+
build
7+
build-*

app/CMakeLists.txt

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cmake_minimum_required(VERSION 3.1.3)
2+
project(graphyQmlEngineApp CXX)
3+
4+
file(GLOB INC ${PROJECT_SOURCE_DIR}/src/*.h)
5+
file(GLOB SRC ${PROJECT_SOURCE_DIR}/src/*.cpp)
6+
add_executable(${PROJECT_NAME} ${INC} ${SRC})
7+
conan_target_link_libraries(${PROJECT_NAME})
8+
target_link_libraries(${PROJECT_NAME} graphyQmlEngineLib)
9+
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17)

app/src/main.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <iostream>
2+
#include "main.h"
3+
4+
int main()
5+
{
6+
std::cout << "hello world" << " " << example::test() << std::endl;
7+
}

lib/CMakeLists.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
project(graphyQmlEngineLib VERSION 0.0.1)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6+
7+
#conan
8+
if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
9+
message(STATUS "Downloading conan.cmake from https://github.com/memsharded/cmake-conan")
10+
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
11+
endif ()
12+
13+
include(${CMAKE_BINARY_DIR}/conan.cmake)
14+
15+
conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP NO_OUTPUT_DIRS CMAKE_TARGETS BUILD missing)
16+
17+
include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
18+
file(GLOB_RECURSE source src/*)
19+
add_library(${PROJECT_NAME} SHARED ${source})
20+
conan_target_link_libraries(${PROJECT_NAME})
21+
target_include_directories(${PROJECT_NAME} PUBLIC include)

lib/conanfile.py

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from conans import ConanFile, CMake, tools
2+
3+
class graphyQmlEngineConan(ConanFile):
4+
name = 'graphyQmlEngineLib'
5+
version = '0.0.1'
6+
license = 'MIT'
7+
description = 'conan library'
8+
settings = ('os', 'compiler', 'build_type', 'arch')
9+
exports_sources = '*'
10+
generators = 'cmake'
11+
options = {'shared': [True, False]}
12+
default_options = 'shared=False'
13+
requires = ('')
14+
15+
def build(self):
16+
cmake = CMake(self)
17+
cmake.configure()
18+
cmake.build()
19+
20+
def package(self):
21+
self.copy('main.h', dst='include', keep_path=False)
22+
self.copy('*.dll', dst='bin', keep_path=False)
23+
self.copy('*.so', dst='lib', keep_path=False)
24+
self.copy('*.dylib', dst='lib', keep_path=False)
25+
self.copy('*.lib', dst='lib', keep_path=False)
26+
self.copy('*.a', dst='lib', keep_path=False)
27+
28+
def package_info(self):
29+
self.cpp_info.libs = ['graphyQmlEngineLib']

lib/include/main.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#pragma once
2+
3+
#include <vector>
4+
5+
#ifdef _WIN32
6+
#if defined(_MSC_VER) && !defined(mainLib_STATIC)
7+
#ifdef mainLib_EXPORTS
8+
#define MAIN_API __declspec(dllexport)
9+
#else
10+
#define MAIN_API __declspec(dllimport)
11+
#endif
12+
#else
13+
#define MAIN_API
14+
#endif
15+
#endif
16+
17+
namespace example
18+
{
19+
#ifdef _WIN32
20+
MAIN_API long _stdcall test();
21+
#elif linux
22+
long test();
23+
#endif
24+
}

lib/src/main.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include "main.h"
2+
3+
namespace example
4+
{
5+
#ifdef _WIN32
6+
long _stdcall test()
7+
#elif linux
8+
long test()
9+
#endif
10+
{
11+
return 0;
12+
}
13+
}

test/CMakeLists.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
project(graphyQmlEngineTest)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
conan_cmake_run(CONANFILE conanfile.txt BASIC_SETUP NO_OUTPUT_DIRS BUILD missing)
7+
8+
file(GLOB SRC ${PROJECT_SOURCE_DIR}/src/*.cpp)
9+
add_executable(${PROJECT_NAME} ${SRC} ${SRC_test})
10+
conan_target_link_libraries(${PROJECT_NAME})
11+
target_link_libraries(${PROJECT_NAME} graphyQmlEngineLib)

test/conanfile.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[requires]
2+
gtest/1.8.1@bincrafters/stable
3+
4+
[generators]
5+
cmake

test/src/main.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "gmock/gmock.h"
2+
3+
int main(int argc, char** argv)
4+
{
5+
::testing::InitGoogleTest(&argc, argv);
6+
return RUN_ALL_TESTS();
7+
}

0 commit comments

Comments
 (0)