Skip to content

Commit 3e6f32a

Browse files
authored
Merge pull request #49 from brenocq/dev
v0.3.0.0
2 parents 4c2b752 + dc59e85 commit 3e6f32a

File tree

157 files changed

+5250
-2124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+5250
-2124
lines changed

.github/workflows/linux.yml

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,28 @@ jobs:
1010
matrix:
1111
config:
1212
- {
13-
name: "Ubuntu Latest",
13+
name: "Ubuntu g++",
1414
os: ubuntu-latest,
15-
build_type: "Release"
15+
compiler: "g++"
16+
}
17+
- {
18+
name: "Ubuntu clang++",
19+
os: ubuntu-latest,
20+
compiler: "clang++"
1621
}
1722

1823
steps:
19-
- name: Checkout atta
20-
uses: actions/checkout@v2
21-
22-
- name: Install dependencies on ubuntu
23-
if: startsWith(matrix.config.os, 'ubuntu')
24-
run: |
25-
sudo apt-get update
26-
sudo apt-get install cmake xorg-dev curl
27-
cmake --version
28-
gcc --version
24+
- name: Checkout atta
25+
uses: actions/checkout@v2
2926

30-
- name: Configure
31-
run: |
32-
mkdir build
33-
cd build
34-
cmake ..
27+
- name: Install dependencies
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install cmake xorg-dev curl
3531
36-
- name: Build
37-
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
32+
- name: Build
33+
run: ./build.sh --jobs 2 --compiler ${{ matrix.config.compiler }}
3834

39-
- name: Test
40-
run: ctest
41-
working-directory: build
35+
- name: Test
36+
run: ctest
37+
working-directory: build/release

.github/workflows/macos.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,24 @@ jobs:
1616
}
1717

1818
steps:
19-
- name: Checkout atta
20-
uses: actions/checkout@v2
19+
- name: Checkout atta
20+
uses: actions/checkout@v2
2121

22-
- name: Install dependencies on macos
23-
if: startsWith(matrix.config.os, 'macos')
24-
run: |
25-
brew install cmake
26-
cmake --version
22+
- name: Install dependencies on macos
23+
if: startsWith(matrix.config.os, 'macos')
24+
run: |
25+
brew install cmake
26+
cmake --version
2727
28-
- name: Configure
29-
run: |
30-
mkdir build
31-
cd build
32-
cmake ..
28+
- name: Configure
29+
run: |
30+
mkdir build
31+
cd build
32+
cmake ..
3333
34-
- name: Build
35-
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
34+
- name: Build
35+
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
3636

37-
- name: Test
38-
run: ctest
39-
working-directory: build
37+
- name: Test
38+
run: ctest
39+
working-directory: build

.github/workflows/windows.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,23 @@ jobs:
1616
}
1717

1818
steps:
19-
- name: Checkout atta
20-
uses: actions/checkout@v2
19+
- name: Checkout atta
20+
uses: actions/checkout@v2
2121

22-
- name: Install dependencies on windows
23-
if: startsWith(matrix.config.os, 'windows')
24-
run: |
25-
choco install cmake
26-
cmake --version
22+
- name: Install dependencies
23+
run: |
24+
choco install cmake
25+
cmake --version
2726
28-
- name: Configure
29-
run: |
30-
mkdir build
31-
cd build
32-
cmake ..
27+
- name: Configure
28+
run: |
29+
mkdir build
30+
cd build
31+
cmake ..
3332
34-
- name: Build
35-
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
33+
- name: Build
34+
run: cmake --build build --parallel --config ${{ matrix.config.build_type }}
3635

37-
- name: Test
38-
run: ctest
39-
working-directory: build
36+
- name: Test
37+
run: ctest
38+
working-directory: build

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
/.vs
1616
/CMakeSettings.json
1717

18+
# Vim
19+
tags
20+
1821
# Local config
1922
/src/atta/cmakeConfig.h
2023

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.14)
22

3-
project(atta VERSION 0.2.0.0 LANGUAGES CXX C)
3+
project(atta VERSION 0.3.0.0 LANGUAGES CXX C)
44

55
OPTION(ATTA_BUILD_TESTS
66
"Set to ON to build also the test executables"
@@ -14,6 +14,9 @@ OPTION(ATTA_BUILD_DOCS
1414
option(ATTA_STATIC_PROJECT_FILE
1515
"Project to be linked statically to atta"
1616
"")
17+
option(ATTA_PROFILE
18+
"Set to ON to enable code profiling"
19+
ON)
1720

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

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

28+
# Set flags necessary for the script system to work correctly
2529
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
26-
# Set flags necessary for the script system to work correctly
2730
set(CMAKE_CXX_FLAGS "-Wl,--export-dynamic")
2831
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--export-dynamic")
2932
endif()
@@ -49,6 +52,10 @@ else()
4952
set(ATTA_STATIC_PROJECT FALSE)
5053
endif()
5154

55+
if(ATTA_PROFILE)
56+
list(APPEND ATTA_DEFINITIONS "ATTA_PROFILE")
57+
endif()
58+
5259
########## OS Specific ##########
5360
atta_log(Info "Main" "cmake system name: ${CMAKE_SYSTEM_NAME}")
5461
if(CMAKE_SYSTEM_NAME STREQUAL Windows)#----- Windows build
@@ -153,7 +160,6 @@ set(ATTA_PATH ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" FORCE)
153160
########## Precompiled Headers ##########
154161
list(APPEND ATTA_PCH "${CMAKE_CURRENT_SOURCE_DIR}/src/atta/pch.h")
155162

156-
157163
########## Atta/Extern directories ##########
158164
include(FetchContent)
159165
list(APPEND ATTA_INCLUDE_DIRS ${ATTA_PATH}/src)
@@ -253,6 +259,8 @@ if(NOT (ATTA_SYSTEM_NAME MATCHES "Web") AND NOT ATTA_STATIC_PROJECT_FILE)
253259
FILES_MATCHING REGEX ".*\.(h|inl)$")
254260
install(DIRECTORY ${CMAKE_BINARY_DIR}/_deps/implot-src/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/implot
255261
FILES_MATCHING REGEX ".*\.(h|cpp)$")
262+
install(DIRECTORY ${CMAKE_BINARY_DIR}/_deps/bullet3-src/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/bullet3
263+
FILES_MATCHING REGEX ".*\.(h|cpp)$")
256264
install(DIRECTORY src/extern/glad/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/glad
257265
FILES_MATCHING REGEX ".*\.(h|inl)$")
258266
install(DIRECTORY src/extern/stb_image/ DESTINATION include/${ATTA_VERSION_SAFE}/extern/stb_image
@@ -262,6 +270,7 @@ if(NOT (ATTA_SYSTEM_NAME MATCHES "Web") AND NOT ATTA_STATIC_PROJECT_FILE)
262270
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE})
263271
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/imgui)
264272
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/implot)
273+
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/bullet3/src)
265274
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/glad/include)
266275
list(APPEND ATTA_INSTALL_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/extern/stb_image)
267276
set(ATTA_INSTALL_PCH ${CMAKE_INSTALL_PREFIX}/include/${ATTA_VERSION_SAFE}/atta/pch.h)

README.md

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,70 @@ Arrows show dependencies between modules. Green boxes show which features are im
7777
This project aims to simulate complex systems like this, mainly composed of robots.
7878

7979
## Build & test
80-
#### Dependencies
81-
To build atta properly, you need to have cmake installed.
82-
Dependencies for some operating systems:
83-
84-
**Windows:**
85-
```bash
86-
choco install cmake
87-
```
88-
89-
**MacOS:**
90-
```bash
91-
brew install cmake
92-
```
9380

94-
**Linux:**
95-
```bash
96-
sudo apt-get install cmake xorg-dev curl
97-
```
98-
99-
#### Clone
100-
Atta should build without errors when the **compiller supports C++17** (g++ >= 9.0).
81+
<!------------ Windows ------------>
82+
<details><summary> Windows </summary>
83+
<h4>Dependencies</h4>
84+
To build atta properly, you need to have cmake installed.
85+
<pre><code>choco install cmake</code></pre>
86+
Also, be sure that your <strong>compiller supports C++17</strong> (g++ >= 9.0).
10187

102-
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:.
88+
<h4>Run</h4>
89+
<pre><code>git clone git@github.com:brenocq/atta.git
90+
cd atta
91+
mkdir build
92+
cd build
93+
cmake ..
94+
</code></pre>
95+
96+
You can now use Visual Studio to open the <code>atta.sln</code> file.
97+
</details>
98+
<!------------ MacOS ------------>
99+
<details><summary> MacOS </summary>
100+
<h4>Dependencies</h4>
101+
To build atta properly, you need to have cmake installed.
102+
<pre><code>brew install cmake</code></pre>
103+
Also, be sure that your <strong>compiller supports C++17</strong> (g++ >= 9.0).
103104

104-
```bash
105-
git clone git@github.com:brenocq/atta.git
105+
<h4>Run</h4>
106+
<pre><code>git clone git@github.com:brenocq/atta.git
106107
cd atta
107108
./scripts/build.sh --help
108109
./scripts/build.sh
109110
./build/release/bin/atta_test
110111
./build/release/bin/atta
111-
```
112+
</code></pre>
113+
</details>
114+
<!------------ Linux ------------>
115+
<details><summary> Linux </summary>
116+
<h3>Dependencies</h3>
117+
To build atta, you need:
118+
<ul>
119+
<li>g++ >= 9.0</li>
120+
<li>cmake >= 3.14</li>
121+
</ul>
122+
123+
<strong>Ubuntu:</strong>
124+
<pre><code>sudo apt-get install g++ cmake git xorg-dev curl</code></pre>
125+
<i>Note: If your ubuntu is old, you may need to install the latest cmake/g++ manually.</i>
126+
127+
<strong>Fedora:</strong>
128+
<pre><code>sudo yum install g++ cmake git glfw-devel curl</code></pre>
129+
130+
<strong>Arch:</strong>
131+
<pre><code>sudo pacman -Sy g++ cmake git glfw-x11 curl</code></pre>
132+
133+
<h3>Run</h3>
134+
<pre><code>git clone git@github.com:brenocq/atta.git
135+
cd atta
136+
./build.sh --help
137+
./build.sh
138+
./build/release/bin/atta_test
139+
./build/release/bin/atta
140+
</code></pre>
141+
</details>
112142

113-
_Obs: The build script should help the user with dependencies. If you found ploblems please let me know_
143+
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:.
114144

115145
## Discussions
116146
If you want to contribute, have ideas, or have questions about atta, feel free to [start a discussion](https://github.com/brenocq/atta/discussions).

scripts/build.sh renamed to build.sh

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
5-
SOURCE_PATH="$SCRIPT_PATH/.."
5+
SOURCE_PATH="$SCRIPT_PATH"
66
BUILD_PATH="$SOURCE_PATH/build"
77
CMAKE_BUILD_TYPE="-DCMAKE_BUILD_TYPE=Release"
88
CMAKE_COMPILER=""
@@ -14,14 +14,15 @@ BUILD_TYPE="default"
1414
RUN_AFTER="false"
1515
PROJECT_TO_RUN=""
1616
INSTALL_AFTER="false"
17+
NUM_JOBS=""
1718

1819
printHelp()
1920
{
2021
echo "Atta build script"
2122
echo
22-
echo "Usage: ./build.sh [args ...]"
23+
echo "Usage: ./build.sh [option(s)]"
2324
echo
24-
echo "options:"
25+
echo "Options:"
2526
echo
2627
echo "-h or --help"
2728
echo " This help menu"
@@ -39,6 +40,9 @@ printHelp()
3940
echo "-c or --compiler <name>"
4041
echo " Select the compiler."
4142
echo
43+
echo "-j or --jobs <num_jobs>"
44+
echo " Set number of jobs to use when building."
45+
echo
4246
echo "-s or --static <project_file>"
4347
echo " Build statically linked to a project."
4448
echo " The file should be a valid .atta"
@@ -59,7 +63,7 @@ buildDefault()
5963
echo "---------- Building ----------"
6064
# Build
6165
cmake $CMAKE_BUILD_TYPE $CMAKE_COMPILER $CMAKE_ATTA_STATIC $SOURCE_PATH
62-
make -j
66+
make -j $NUM_JOBS
6367

6468
# Install
6569
if [[ "$INSTALL_AFTER" == "true" ]]; then
@@ -97,7 +101,7 @@ buildWeb()
97101
# Build
98102
echo "---------- Building web ----------"
99103
emcmake cmake $CMAKE_MODULE $CMAKE_BUILD_TYPE $CMAKE_ATTA_STATIC $SOURCE_PATH
100-
make -j
104+
make -j $NUM_JOBS
101105

102106
# Run
103107
if [[ "$RUN_AFTER" == "true" ]]; then
@@ -112,7 +116,7 @@ buildDocs()
112116
{
113117
echo "---------- Building docs ----------"
114118
cmake -ATTA_BUILD_DOCS=ON -DATTA_BUILD_TESTS=OFF $SOURCE_PATH
115-
make -j
119+
make -j $NUM_JOBS
116120
exit
117121
}
118122

@@ -136,6 +140,11 @@ while [[ $# -gt 0 ]]; do
136140
RUN_AFTER="true"
137141
shift # past argument
138142
;;
143+
-j|--jobs)
144+
NUM_JOBS="$2"
145+
shift # past argument
146+
shift # past value
147+
;;
139148
-p|--project)
140149
PROJECT_TO_RUN="$2"
141150
shift # past argument

cmake/attaConfig.cmake.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
88

99
set(atta_LIBRARIES "@ATTA_INSTALL_LIBRARIES@")
1010
set(atta_INCLUDE_DIRS "@ATTA_INSTALL_INCLUDE_DIRS@")
11+
set(atta_DEFINITIONS "@ATTA_DEFINITIONS@")
1112
set(atta_PCH "@ATTA_INSTALL_PCH@")
1213
set(atta_FOUND TRUE)
1314

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

2122
target_include_directories(${target} PRIVATE ${atta_INCLUDE_DIRS})
2223
target_precompile_headers(${target} PRIVATE ${atta_PCH})
24+
target_compile_definitions(${target} PRIVATE ${atta_DEFINITIONS})
2325

2426
# This variable is used to include headers when building statically (necessary to register scripts)
2527
set(headers "")

0 commit comments

Comments
 (0)