Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
196 additions
and
1,611 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,11 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# custom build | ||
build/ | ||
|
||
# idea | ||
.idea/ | ||
cmake-build-debug/ | ||
*/cmake-build-debug/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
set(project_name my-project) ## rename your project here | ||
|
||
project(${project_name}-loader) | ||
|
||
include(ExternalProject) | ||
|
||
############################################################################# | ||
## load all dependencies | ||
|
||
ExternalProject_Add(oatpp | ||
GIT_REPOSITORY "https://github.com/oatpp/oatpp.git" | ||
GIT_TAG origin/master | ||
CMAKE_ARGS -DOATPP_BUILD_TESTS=OFF | ||
) | ||
|
||
ExternalProject_Add(main | ||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/main | ||
INSTALL_COMMAND cmake -E echo "SKIP INSTALL" | ||
DEPENDS oatpp | ||
) | ||
|
||
############################################################################# | ||
## make run command | ||
|
||
ExternalProject_Get_Property(main BINARY_DIR) | ||
|
||
add_custom_target(run | ||
COMMAND ${BINARY_DIR}/${project_name}-exe | ||
DEPENDS main | ||
WORKING_DIRECTORY ${BINARY_DIR} | ||
) | ||
|
||
############################################################################# | ||
## make test command | ||
|
||
enable_testing() | ||
add_test(all-tests ${BINARY_DIR}/${project_name}-test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM lganzzzo/alpine-cmake:latest | ||
|
||
ADD . /service | ||
|
||
WORKDIR /service/build | ||
|
||
RUN cmake .. | ||
RUN make | ||
|
||
EXPOSE 8000 8000 | ||
|
||
ENTRYPOINT ["make", "run"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Starter pipeline | ||
# Start with a minimal pipeline that you can customize to build and deploy your code. | ||
# Add steps that build, run tests, deploy, and more: | ||
# https://aka.ms/yaml | ||
|
||
jobs: | ||
- job: ubuntu_16_04 | ||
displayName: 'Build - Ubuntu 16.04' | ||
continueOnError: false | ||
pool: | ||
vmImage: 'Ubuntu 16.04' | ||
container: | ||
image: lganzzzo/ubuntu-cmake:latest | ||
workspace: | ||
clean: all | ||
steps: | ||
- script: | | ||
mkdir build | ||
- script: | | ||
cmake .. | ||
sudo make | ||
displayName: 'CMake' | ||
workingDirectory: build | ||
- script: | | ||
make test ARGS="-V" | ||
displayName: 'Test' | ||
workingDirectory: build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
set(project_name my-project) ## rename your project here | ||
|
||
project(${project_name}) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
include_directories(src) | ||
|
||
add_library(${project_name}-lib | ||
src/AppComponent.hpp | ||
src/Logger.hpp | ||
src/Logger.cpp | ||
src/controller/MyController.hpp | ||
src/dto/MyDto.hpp | ||
) | ||
|
||
## link libs | ||
|
||
find_package(oatpp 0.19.1 REQUIRED) | ||
|
||
target_link_libraries(${project_name}-lib | ||
PUBLIC oatpp::oatpp | ||
PUBLIC oatpp::oatpp-test | ||
) | ||
|
||
## add executables | ||
|
||
add_executable(${project_name}-exe | ||
src/App.cpp | ||
) | ||
target_link_libraries(${project_name}-exe ${project_name}-lib) | ||
add_dependencies(${project_name}-exe ${project_name}-lib) | ||
|
||
add_executable(${project_name}-test | ||
test/tests.cpp | ||
) | ||
target_link_libraries(${project_name}-test ${project_name}-lib) | ||
add_dependencies(${project_name}-test ${project_name}-lib) | ||
|
||
set_target_properties(${project_name}-lib ${project_name}-exe ${project_name}-test PROPERTIES | ||
CXX_STANDARD 11 | ||
CXX_EXTENSIONS OFF | ||
CXX_STANDARD_REQUIRED ON | ||
LINKER_LANGUAGE CXX | ||
) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Logger.hpp | ||
// oatpp-web-starter | ||
// | ||
// Created by Leonid on 3/2/18. | ||
// Copyright © 2018 lganzzzo. All rights reserved. | ||
// | ||
|
||
#include "Logger.hpp" | ||
|
||
#include <iostream> | ||
|
||
void Logger::log(v_int32 priority, const std::string& tag, const std::string& message) { | ||
oatpp::concurrency::SpinLock lock(m_atom); | ||
std::cout << tag << ":" << message << "\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
#include "Logger.hpp" | ||
|
||
#include "oatpp-test/UnitTest.hpp" | ||
#include <iostream> | ||
|
||
namespace { | ||
|
||
class Test : public oatpp::test::UnitTest { | ||
public: | ||
Test() : oatpp::test::UnitTest("[MyTest]") | ||
{} | ||
|
||
bool onRun() override { | ||
OATPP_LOGD(TAG, "Hello Test"); | ||
return true; | ||
} | ||
}; | ||
|
||
void runTests() { | ||
OATPP_RUN_TEST(Test); | ||
} | ||
|
||
} | ||
|
||
int main() { | ||
|
||
oatpp::base::Environment::init(); | ||
oatpp::base::Environment::setLogger(new Logger()); | ||
|
||
runTests(); | ||
|
||
oatpp::base::Environment::setLogger(nullptr); | ||
oatpp::base::Environment::destroy(); | ||
|
||
/* Print how much objects were created during app running, and what have left-probably leaked */ | ||
/* Disable object counting for release builds using '-D OATPP_DISABLE_ENV_OBJECT_COUNTERS' flag for better performance */ | ||
std::cout << "\nEnvironment:\n"; | ||
std::cout << "objectsCount = " << oatpp::base::Environment::getObjectsCount() << "\n"; | ||
std::cout << "objectsCreated = " << oatpp::base::Environment::getObjectsCreated() << "\n\n"; | ||
|
||
OATPP_ASSERT(oatpp::base::Environment::getObjectsCount() == 0); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.