Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from AntelopeIO/initial_dev
Browse files Browse the repository at this point in the history
Initial dev
  • Loading branch information
Bucky Kittinger authored Mar 14, 2023
2 parents 2abb2df + 86ad4fd commit e6d1830
Show file tree
Hide file tree
Showing 64 changed files with 14,610 additions and 237 deletions.
24 changes: 24 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
BasedOnStyle: LLVM
BraceWrapping:
SplitEmptyFunction: false
SplitEmptyRecord: false
IndentWidth: 3
ColumnLimit: 0
PointerAlignment: Left
AccessModifierOffset: -3
AlwaysBreakTemplateDeclarations: true
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveDeclarations: Consecutive
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Inline
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
ConstructorInitializerIndentWidth: 3
ContinuationIndentWidth: 3
MaxEmptyLinesToKeep: 3
SortIncludes: Never
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[Bb]uild*/*
CMakeLists.txt.user
CMakeLists.txt.user
*.md.backup
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "external/rapidyaml"]
path = external/rapidyaml
url = https://github.com/biojppm/rapidyaml
[submodule "external/magic_enum"]
path = external/magic_enum
url = https://github.com/Neargye/magic_enum
[submodule "external/Catch2"]
path = external/Catch2
url = https://github.com/catchorg/Catch2
[submodule "external/nlohmann"]
path = external/nlohmann
url = https://github.com/nlohmann/json
33 changes: 33 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# @copyright See `LICENSE` in the root directory of this project.

cmake_minimum_required(VERSION 3.11) # If ryml >= 0.5.0 is included via FetchContent or submodule, this minimum is 3.12.

project("ANTLER Project Tools " VERSION 1.0.0)

include( ./common.cmake REQUIRED )

add_subdirectory( external )
add_subdirectory( include )
add_subdirectory( src )
add_subdirectory( tools )


option(PEDANTIC_BUILD "Pedantic builds" On)
option(BUILD_TESTS "Build and run the tests." On)

if(BUILD_TESTS)
enable_testing()
add_subdirectory( tests )
endif()


# Copy licenses to BUILD dir
#
# NOTE: This is used due to legacy requirements instead of:
# `install(FILE <license files> COMPONENT Documentation DESTINATION share/aproj/licenses)`
configure_file(LICENSE ${CMAKE_BINARY_DIR}/licenses/LICENSE COPYONLY)
file(GLOB license_files licenses/*)
foreach(full_path IN ITEMS ${license_files})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" file_name ${full_path})
configure_file("${file_name}" "${CMAKE_BINARY_DIR}/${file_name}" COPYONLY)
endforeach()
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2022-current EOS Network Foundation (ENF) and its contributors.
All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
82 changes: 80 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,85 @@
# ANTLER Project Tools

# Antelope Project Management System
ANTLER Project Tools (aproj) is a set of tools to help in the
generation of smart contracts intended for deployment to an
[Antelope](https://github.com/AntelopeIO/) blockchain.

This set of tools will help the developer create, maintain, build, and
test smart contracts.

## See

## Usage

For now, please see the [Intial Design Document](./docs/project_manager.md) for usage.

## Runtime Dependencies

The following tools are required for aproj to work at runtime:
- CMake v3.11


## Build Dependencies

Building aproj requires the following dependencies:
- C++20 compiler (common minimums: gcc-10 or clang-11).
- [CMake](https://cmake.org/overview/) version 3.11 or greater (note the requirement [here](./CMakeLists.txt#L1)).

Additionally we recomend using [ninja build](https://ninja-build.org/) for fast builds.

## Submodules

Make sure your submodules are initialized and updated recursively using the command:
`git submodule update --init --recursive`

## Building

Assuming you have the other dependencies installed, from the project root, the following will build the project:
```bash
mkdir -p Build \
&& cd Build \
&& cmake .. -DCMAKE_BUILD_TYPE=Release \
&& cmake --build .
```

## Test

Currently, the following will run some automated tests:
```bash
ninja && ninja test
```

## Maintaining

Directories in the project root:
- aproj: This contains the various CLI tools, all of which depend on the project library.
- project: This is standalone library that contains the majority of implementation that creates and maintains the `project.yaml` file as well as initialize and populate the project's directory tree, among other things.
- test: This direcory contains a number of unit tests. In future, it's likely to contain system level tests as well.


## License

This project is licensed using the MIT License as found
[here](./LICENSE).

Additionally, apack includes and depends on these libraries:
- [Rapid YAML](https://github.com/biojppm/rapidyaml) - `MIT`.
- [CLI11](https://github.com/CLIUtils/CLI11) - `BSD-3-Clause`.
- [MagicEnum](https://github.com/Neargye/magic_enum) - `MIT`.


## Miscellaneous

### What does `aproj` stand for?

It's a shortening of `antler-proj`.

### Is ANTLER an acronym?

Yes, it is. Or maybe it's a
[backronym](https://en.wikipedia.org/wiki/Backronym)?

Regardless, it's ANother TransLator Environment and Runtime.

### Initial Issue

https://github.com/AntelopeIO/cdt/issues/62
71 changes: 71 additions & 0 deletions common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# common.cmake
#
# @copyright See `LICENSE` in the root directory of this project.
#
# This file sets the following values:
#
#
# CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}
# CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CMAKE_BUILD_TYPE}
#
# CMAKE_DEBUG_POSTFIX
#
# CMAKE_C_FLAGS
# CMAKE_CXX_FLAGS
#

# Basic sanity check:
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Avoid building inside the source tree. Create a `build` directory?")
endif()

set(CMAKE_DEBUG_POSTFIX d) # appends d to libraries.


if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# go ahead and search for 64 bit libs
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
endif()

if(PEDANTIC)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wfloat-equal")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")

if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-return-type-c-linkage")
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Colorize output
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=always" )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wctor-dtor-privacy -Wnon-virtual-dtor" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wredundant-decls")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wold-style-cast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wduplicated-branches" )
endif()
endif()

SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> )
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:Release>:NDEBUG> )
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:RelWithDebInfo>:NDEBUG> )
SET_PROPERTY(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:MinSizeRel>:NDEBUG> )

if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(-D_DEBUG)
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
add_definitions(-DNDEBUG)
elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
add_definitions(-DNDEBUG)
elseif(CMAKE_BUILD_TYPE STREQUAL MinSizeRel)
#
else()
# Seems the build type isn't set. Tell the users.
message(FATAL_ERROR "\nSet CMAKE_BUILD_TYPE to one of: Release, Debug, RelWithDebInfo, or MinSizeRel\n e.g. `cmake .. -DCMAKE_BUILD_TYPE=Debug`\n" )
endif()
Loading

0 comments on commit e6d1830

Please sign in to comment.