Skip to content

Commit

Permalink
Merge pull request #49 from brenocq/dev
Browse files Browse the repository at this point in the history
v0.3.0.0
  • Loading branch information
brenocq authored Jan 29, 2023
2 parents 4c2b752 + dc59e85 commit 3e6f32a
Show file tree
Hide file tree
Showing 157 changed files with 5,250 additions and 2,124 deletions.
40 changes: 18 additions & 22 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,28 @@ jobs:
matrix:
config:
- {
name: "Ubuntu Latest",
name: "Ubuntu g++",
os: ubuntu-latest,
build_type: "Release"
compiler: "g++"
}
- {
name: "Ubuntu clang++",
os: ubuntu-latest,
compiler: "clang++"
}

steps:
- name: Checkout atta
uses: actions/checkout@v2

- name: Install dependencies on ubuntu
if: startsWith(matrix.config.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install cmake xorg-dev curl
cmake --version
gcc --version
- name: Checkout atta
uses: actions/checkout@v2

- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install cmake xorg-dev curl
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
- name: Build
run: ./build.sh --jobs 2 --compiler ${{ matrix.config.compiler }}

- name: Test
run: ctest
working-directory: build
- name: Test
run: ctest
working-directory: build/release
34 changes: 17 additions & 17 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ jobs:
}

steps:
- name: Checkout atta
uses: actions/checkout@v2
- name: Checkout atta
uses: actions/checkout@v2

- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install cmake
cmake --version
- name: Install dependencies on macos
if: startsWith(matrix.config.os, 'macos')
run: |
brew install cmake
cmake --version
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}

- name: Test
run: ctest
working-directory: build
- name: Test
run: ctest
working-directory: build
33 changes: 16 additions & 17 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,23 @@ jobs:
}

steps:
- name: Checkout atta
uses: actions/checkout@v2
- name: Checkout atta
uses: actions/checkout@v2

- name: Install dependencies on windows
if: startsWith(matrix.config.os, 'windows')
run: |
choco install cmake
cmake --version
- name: Install dependencies
run: |
choco install cmake
cmake --version
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Configure
run: |
mkdir build
cd build
cmake ..
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
- name: Build
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}

- name: Test
run: ctest
working-directory: build
- name: Test
run: ctest
working-directory: build
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
/.vs
/CMakeSettings.json

# Vim
tags

# Local config
/src/atta/cmakeConfig.h

Expand Down
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14)

project(atta VERSION 0.2.0.0 LANGUAGES CXX C)
project(atta VERSION 0.3.0.0 LANGUAGES CXX C)

OPTION(ATTA_BUILD_TESTS
"Set to ON to build also the test executables"
Expand All @@ -14,6 +14,9 @@ OPTION(ATTA_BUILD_DOCS
option(ATTA_STATIC_PROJECT_FILE
"Project to be linked statically to atta"
"")
option(ATTA_PROFILE
"Set to ON to enable code profiling"
ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -22,8 +25,8 @@ set(ATTA_VERSION_SAFE atta-${CMAKE_PROJECT_VERSION})

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/atta/cmakeConfig.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/atta/cmakeConfig.h)

# Set flags necessary for the script system to work correctly
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# Set flags necessary for the script system to work correctly
set(CMAKE_CXX_FLAGS "-Wl,--export-dynamic")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--export-dynamic")
endif()
Expand All @@ -49,6 +52,10 @@ else()
set(ATTA_STATIC_PROJECT FALSE)
endif()

if(ATTA_PROFILE)
list(APPEND ATTA_DEFINITIONS "ATTA_PROFILE")
endif()

########## OS Specific ##########
atta_log(Info "Main" "cmake system name: ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL Windows)#----- Windows build
Expand Down Expand Up @@ -153,7 +160,6 @@ set(ATTA_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" FORCE)
########## Precompiled Headers ##########
list(APPEND ATTA_PCH "${CMAKE_CURRENT_SOURCE_DIR}/src/atta/pch.h")


########## Atta/Extern directories ##########
include(FetchContent)
list(APPEND ATTA_INCLUDE_DIRS ${ATTA_PATH}/src)
Expand Down Expand Up @@ -253,6 +259,8 @@ if(NOT (ATTA_SYSTEM_NAME MATCHES "Web") AND NOT ATTA_STATIC_PROJECT_FILE)
FILES_MATCHING REGEX ".*\.(h|inl)$")
install(DIRECTORY ${CMAKE_BINARY_DIR}/_deps/implot-src/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/implot
FILES_MATCHING REGEX ".*\.(h|cpp)$")
install(DIRECTORY ${CMAKE_BINARY_DIR}/_deps/bullet3-src/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/bullet3
FILES_MATCHING REGEX ".*\.(h|cpp)$")
install(DIRECTORY src/extern/glad/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/glad
FILES_MATCHING REGEX ".*\.(h|inl)$")
install(DIRECTORY src/extern/stb_image/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/stb_image
Expand All @@ -262,6 +270,7 @@ if(NOT (ATTA_SYSTEM_NAME MATCHES "Web") AND NOT ATTA_STATIC_PROJECT_FILE)
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE})
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/imgui)
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/implot)
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/bullet3/src)
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/glad/include)
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/stb_image)
set(ATTA_INSTALL_PCH ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/atta/pch.h)
Expand Down
80 changes: 55 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,70 @@ Arrows show dependencies between modules. Green boxes show which features are im
This project aims to simulate complex systems like this, mainly composed of robots.

## Build & test
#### Dependencies
To build atta properly, you need to have cmake installed.
Dependencies for some operating systems:

**Windows:**
```bash
choco install cmake
```

**MacOS:**
```bash
brew install cmake
```

**Linux:**
```bash
sudo apt-get install cmake xorg-dev curl
```

#### Clone
Atta should build without errors when the **compiller supports C++17** (g++ >= 9.0).
<!------------ Windows ------------>
<details><summary> Windows </summary>
<h4>Dependencies</h4>
To build atta properly, you need to have cmake installed.
<pre><code>choco install cmake</code></pre>
Also, be sure that your <strong>compiller supports C++17</strong> (g++ >= 9.0).

If you found any errors, please do not hesitate to [create an issue](https://github.com/brenocq/atta/issues/new?assignees=brenocq&labels=fix&template=bug_report.md&title=) :wink:.
<h4>Run</h4>
<pre><code>git clone [email protected]:brenocq/atta.git
cd atta
mkdir build
cd build
cmake ..
</code></pre>

You can now use Visual Studio to open the <code>atta.sln</code> file.
</details>
<!------------ MacOS ------------>
<details><summary> MacOS </summary>
<h4>Dependencies</h4>
To build atta properly, you need to have cmake installed.
<pre><code>brew install cmake</code></pre>
Also, be sure that your <strong>compiller supports C++17</strong> (g++ >= 9.0).

```bash
git clone [email protected]:brenocq/atta.git
<h4>Run</h4>
<pre><code>git clone [email protected]:brenocq/atta.git
cd atta
./scripts/build.sh --help
./scripts/build.sh
./build/release/bin/atta_test
./build/release/bin/atta
```
</code></pre>
</details>
<!------------ Linux ------------>
<details><summary> Linux </summary>
<h3>Dependencies</h3>
To build atta, you need:
<ul>
<li>g++ >= 9.0</li>
<li>cmake >= 3.14</li>
</ul>

<strong>Ubuntu:</strong>
<pre><code>sudo apt-get install g++ cmake git xorg-dev curl</code></pre>
<i>Note: If your ubuntu is old, you may need to install the latest cmake/g++ manually.</i>

<strong>Fedora:</strong>
<pre><code>sudo yum install g++ cmake git glfw-devel curl</code></pre>

<strong>Arch:</strong>
<pre><code>sudo pacman -Sy g++ cmake git glfw-x11 curl</code></pre>

<h3>Run</h3>
<pre><code>git clone [email protected]:brenocq/atta.git
cd atta
./build.sh --help
./build.sh
./build/release/bin/atta_test
./build/release/bin/atta
</code></pre>
</details>

_Obs: The build script should help the user with dependencies. If you found ploblems please let me know_
If you found any errors, please do not hesitate to [create an issue](https://github.com/brenocq/atta/issues/new?assignees=brenocq&labels=fix&template=bug_report.md&title=) :wink:.

## Discussions
If you want to contribute, have ideas, or have questions about atta, feel free to [start a discussion](https://github.com/brenocq/atta/discussions).
Expand Down
21 changes: 15 additions & 6 deletions scripts/build.sh → build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
SOURCE_PATH="$SCRIPT_PATH/.."
SOURCE_PATH="$SCRIPT_PATH"
BUILD_PATH="$SOURCE_PATH/build"
CMAKE_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
CMAKE_COMPILER=""
Expand All @@ -14,14 +14,15 @@ BUILD_TYPE="default"
RUN_AFTER="false"
PROJECT_TO_RUN=""
INSTALL_AFTER="false"
NUM_JOBS=""

printHelp()
{
echo "Atta build script"
echo
echo "Usage: ./build.sh [args ...]"
echo "Usage: ./build.sh [option(s)]"
echo
echo "options:"
echo "Options:"
echo
echo "-h or --help"
echo " This help menu"
Expand All @@ -39,6 +40,9 @@ printHelp()
echo "-c or --compiler <name>"
echo " Select the compiler."
echo
echo "-j or --jobs <num_jobs>"
echo " Set number of jobs to use when building."
echo
echo "-s or --static <project_file>"
echo " Build statically linked to a project."
echo " The file should be a valid .atta"
Expand All @@ -59,7 +63,7 @@ buildDefault()
echo "---------- Building ----------"
# Build
cmake $CMAKE_BUILD_TYPE $CMAKE_COMPILER $CMAKE_ATTA_STATIC $SOURCE_PATH
make -j
make -j $NUM_JOBS

# Install
if [[ "$INSTALL_AFTER" == "true" ]]; then
Expand Down Expand Up @@ -97,7 +101,7 @@ buildWeb()
# Build
echo "---------- Building web ----------"
emcmake cmake $CMAKE_MODULE $CMAKE_BUILD_TYPE $CMAKE_ATTA_STATIC $SOURCE_PATH
make -j
make -j $NUM_JOBS

# Run
if [[ "$RUN_AFTER" == "true" ]]; then
Expand All @@ -112,7 +116,7 @@ buildDocs()
{
echo "---------- Building docs ----------"
cmake -ATTA_BUILD_DOCS=ON -DATTA_BUILD_TESTS=OFF $SOURCE_PATH
make -j
make -j $NUM_JOBS
exit
}

Expand All @@ -136,6 +140,11 @@ while [[ $# -gt 0 ]]; do
RUN_AFTER="true"
shift # past argument
;;
-j|--jobs)
NUM_JOBS="$2"
shift # past argument
shift # past value
;;
-p|--project)
PROJECT_TO_RUN="$2"
shift # past argument
Expand Down
2 changes: 2 additions & 0 deletions cmake/attaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(atta_LIBRARIES "@ATTA_INSTALL_LIBRARIES@")
set(atta_INCLUDE_DIRS "@ATTA_INSTALL_INCLUDE_DIRS@")
set(atta_DEFINITIONS "@ATTA_DEFINITIONS@")
set(atta_PCH "@ATTA_INSTALL_PCH@")
set(atta_FOUND TRUE)

Expand All @@ -20,6 +21,7 @@ macro(atta_add_target target sources)

target_include_directories(${target} PRIVATE ${atta_INCLUDE_DIRS})
target_precompile_headers(${target} PRIVATE ${atta_PCH})
target_compile_definitions(${target} PRIVATE ${atta_DEFINITIONS})

# This variable is used to include headers when building statically (necessary to register scripts)
set(headers "")
Expand Down
Loading

0 comments on commit 3e6f32a

Please sign in to comment.