Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile compatible #93

Merged
merged 65 commits into from
Aug 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
b6a6bd6
Android support in cmake
sayansil Mar 2, 2023
57b2718
Ecosystem root separate from setup
sayansil Mar 2, 2023
2de04e7
Ignore dangling fetchcontent
sayansil Mar 2, 2023
a9b6fc7
SSO
sayansil Mar 2, 2023
d4f6d6b
Export clean_slate
sayansil Mar 4, 2023
1d64b63
Export hny
sayansil Mar 4, 2023
4c3aea3
God killer
sayansil Mar 4, 2023
f95765f
Platform independant path in setu[
sayansil Mar 11, 2023
a07a738
Clear organisms in wrapper destructor
sayansil Mar 11, 2023
ba3e368
Remove redundant return from setup
sayansil Mar 11, 2023
35621f4
God state machine in wrapper
sayansil Mar 11, 2023
e7e5290
Ignore hidden files
sayansil Mar 11, 2023
180b3ca
Revive god
sayansil Mar 11, 2023
bae965e
Enum class
sayansil Mar 12, 2023
4e19fd7
Fix lint
sayansil Mar 12, 2023
8a26dce
Fix lint
sayansil Mar 12, 2023
c9730d4
Disable fetchcontent cache for windows
sayansil Mar 12, 2023
fca2147
Add CMake presets for Android
DarkStar1997 Mar 12, 2023
aa0d1e3
dart fbs for plots
sayansil Mar 21, 2023
b7876af
Add plotbundle
sayansil Mar 21, 2023
73be3bc
Ignore dstore, add kingdom to population fbs
sayansil Mar 24, 2023
a8eb155
Dart does not support imports
sayansil Mar 24, 2023
b615768
Remove generated fb schemas from repo
sayansil Mar 25, 2023
7b20dbe
Add json string output
DarkStar1997 Mar 30, 2023
7ee9009
Fix lint
DarkStar1997 Mar 30, 2023
e3977d4
Shamelessly gain sqlite write performance at the cost of reliability
DarkStar1997 Apr 1, 2023
e62942d
Add reflection support to introspect the world dynamically
DarkStar1997 Apr 2, 2023
683b22d
Fix lint
DarkStar1997 Apr 2, 2023
75d3dac
Preparations for adding querying support
DarkStar1997 Apr 2, 2023
32ae276
Add helper function to get json from flatbuffer
DarkStar1997 Apr 3, 2023
87179d2
Fix lint
DarkStar1997 Apr 3, 2023
181ec77
Introspection half-way done
DarkStar1997 Apr 3, 2023
b65638d
Fix lint
DarkStar1997 Apr 3, 2023
83067c3
Introspection finally done. Filters to be added next
DarkStar1997 Apr 3, 2023
6d53f8a
Filter by species stats functional
DarkStar1997 Apr 3, 2023
92dd747
Fix lint yet again
DarkStar1997 Apr 3, 2023
86cd7dd
Extraction and filter queries working like a charm
DarkStar1997 Apr 4, 2023
2033f50
Extraction working with ranges as well
DarkStar1997 Apr 4, 2023
ea46006
Nicer query json syntax
DarkStar1997 Apr 9, 2023
625444a
Fix wrapper functions to return pointers as handlers
DarkStar1997 Apr 9, 2023
5d98047
Fix lint
DarkStar1997 Apr 9, 2023
d4d6256
Ranges!!!
DarkStar1997 Apr 10, 2023
a75e6a3
Embrace modernity
DarkStar1997 Apr 22, 2023
d7346e9
Store avg world instance in god object
DarkStar1997 Apr 23, 2023
74ad481
Average plot handler added
DarkStar1997 Apr 23, 2023
a8921cc
Inspection now being done elegantly and possibly more efficiently
DarkStar1997 Apr 24, 2023
eb38f24
Move unnecessary query print
DarkStar1997 Apr 24, 2023
d9995ae
Enable link time optimization (LTO)
DarkStar1997 May 4, 2023
b22f902
Remove redundant font files
DarkStar1997 May 4, 2023
c5b9109
The other guy has a habit of breaking things in production
DarkStar1997 May 13, 2023
7b26179
The platform which gives me the biggest headaches
DarkStar1997 May 13, 2023
fc82b8c
we kill and then think
sayansil May 27, 2023
217a674
Update wrapper
sayansil May 27, 2023
6e8e33c
Get plot attribute list as string
DarkStar1997 May 28, 2023
51bc9b3
Extract organism attributes
DarkStar1997 May 28, 2023
0e45394
Extract plot stats and record them
DarkStar1997 May 28, 2023
d25d336
Disable IPO for Debug builds
DarkStar1997 May 30, 2023
9495d8d
remove non-num from plot attr
sayansil May 28, 2023
664e377
Add population in attributes
sayansil May 28, 2023
9a3a72e
Lint fix
sayansil May 28, 2023
2c46b68
Add default values to missing json entries
DarkStar1997 Aug 5, 2023
c1a4940
Remove mesa dependency
DarkStar1997 Aug 5, 2023
261198d
Remove xorg dependency
DarkStar1997 Aug 5, 2023
0199183
Don't build graphs
DarkStar1997 Aug 5, 2023
0ceb247
Remove dependencies from test as well
DarkStar1997 Aug 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
build_type: [dbg, rel]
include:
- compiler: gcc
dependencies: 'ninja-build xorg-dev libglu1-mesa-dev'
dependencies: 'ninja-build'
- compiler: clang
dependencies: 'ninja-build xorg-dev libglu1-mesa-dev clang-14'
dependencies: 'ninja-build clang-14'
steps:
- uses: actions/checkout@v3
- uses: actions/cache/restore@v3
Expand Down Expand Up @@ -173,11 +173,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ilammy/[email protected]
- uses: actions/cache/restore@v3
id: cache_load_content
with:
path: simulation/build/.fetchcontent_cache
key: fetchcontent-win-${{ github.event.pull_request.head.sha }}
- uses: actions/cache/restore@v3
id: cache_load_build
with:
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
build_type: [dbg, rel]
include:
- compiler: gcc
dependencies: 'ninja-build xorg-dev libglu1-mesa-dev'
dependencies: 'ninja-build'
- compiler: clang
dependencies: 'ninja-build xorg-dev libglu1-mesa-dev clang-12'
dependencies: 'ninja-build clang-12'
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -178,11 +178,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.sha }}

- uses: ilammy/[email protected]
- uses: actions/cache/restore@v3
id: cache_load_content
with:
path: simulation/build/.fetchcontent_cache
key: fetchcontent-win-${{ github.event.pull_request.head.sha }}
- uses: actions/cache/restore@v3
id: cache_load_build
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ ecosystem-*
tags
**/output/**
**/.DS_Store
checks.json
checks.json
**/.fetchcontent_cache/
33 changes: 27 additions & 6 deletions simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ if(${ENABLE_CLANG_TIDY})
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "-checks=-*,${CLANG_TIDY_CHECKS}-*")
endif()

if (NOT MSVC)
include(CheckIPOSupported)
check_ipo_supported(RESULT result OUTPUT output)
if(result)
message("IPO support enabled")
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
else()
message(WARNING "IPO is not supported: ${output}")
endif()
endif()

find_program(CCACHE_PROGRAM ccache)

if(CCACHE_PROGRAM)
Expand All @@ -38,7 +49,7 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_POSITION_INDEPENDENT_CODE 1)

set(FETCHCONTENT_QUIET FALSE)
Expand Down Expand Up @@ -104,15 +115,25 @@ FetchContent_Declare(
FetchContent_Populate(whereami)
include_directories(${whereami_SOURCE_DIR}/src)

FetchContent_Declare(
rangev3
GIT_REPOSITORY "https://github.com/ericniebler/range-v3"
GIT_TAG 0.12.0
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(rangev3)
include_directories(${rangev3_SOURCE_DIR}/include)

add_subdirectory(src)
add_subdirectory(schema)

include_directories(schema/cpp)
add_subdirectory(RandomTests)
# add_subdirectory(setup)
add_subdirectory(run)
#add_subdirectory(python)
#add_subdirectory(WebApp)

if(NOT ANDROID)
add_subdirectory(RandomTests)
# TODO: xorg and mesa dependency is currently broken on Ubuntu servers. Fix dependencies in workflows and then enable this
#add_subdirectory(run)
endif()

include(CTest)
add_subdirectory(tests)
53 changes: 53 additions & 0 deletions simulation/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@
"rhs": "Darwin"
}
},
{
"name": "conf-android-common",
"description": "Android settings for NDK toolchain",
"hidden": true,
"inherits": "conf-common",
"cacheVariables": {
"CMAKE_ANDROID_NDK": "$env{NDK}",
"CMAKE_TOOLCHAIN_FILE": "$env{NDK}/build/cmake/android.toolchain.cmake",
"ANDROID_PLATFORM": "android-19",
"ANDROID_STL": "c++_shared",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "win-msvc-dbg",
"displayName": "msvc Debug (Developer Mode)",
Expand Down Expand Up @@ -207,6 +220,34 @@
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "and-arm64v8a",
"displayName": "Android arm64-v8a",
"description": "Target android with architecture arm64-v8a",
"inherits": "conf-android-common",
"cacheVariables": {
"ANDROID_ABI": "arm64-v8a"
}
},
{
"name": "and-armeabiv7a",
"displayName": "Android armeabi-v7a",
"description": "Target android with architecture armeabi-v7a",
"inherits": "conf-android-common",
"cacheVariables": {
"ANDROID_ABI": "armeabi-v7a"
}
},
{
"name": "and-armeabiv7a-neon",
"displayName": "Android armeabi-v7a with neon",
"description": "Target android with architecture armeabi-v7a with Neon",
"inherits": "conf-android-common",
"cacheVariables": {
"ANDROID_ABI": "armeabi-v7a",
"ANDROID_ARM_NEON": "ON"
}
}
],
"buildPresets":[
Expand Down Expand Up @@ -257,6 +298,18 @@
{
"name": "osx-gcc-dbg",
"configurePreset": "osx-gcc-dbg"
},
{
"name": "and-arm64v8a",
"configurePreset": "and-arm64v8a"
},
{
"name": "and-armeabiv7a",
"configurePreset": "and-armeabiv7a"
},
{
"name": "and-armeabiv7a-neon",
"configurePreset": "and-armeabiv7a-neon"
}
],
"testPresets": [
Expand Down
8 changes: 3 additions & 5 deletions simulation/RandomTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ endfunction()

add_code(reportgen_test)
add_code(sanity_test)
# add_code(unit_tests)
# add_code(test1)
add_code(test1)
add_code(test2)
# add_code(test3)
# add_code(client)
# add_code(server)
add_code(test3)
add_code(test4)

add_c_code(test1)
5 changes: 3 additions & 2 deletions simulation/RandomTests/reportgen_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ int main() {
std::vector<std::vector<FBuffer>> rows;
const size_t simulation_years = 250;

auto root_path = setup::setup();
std::filesystem::path ecosystem_root = helper::get_ecosystem_root();
setup::setup(ecosystem_root);

const size_t initial_organism_count = 500;

Expand All @@ -21,7 +22,7 @@ int main() {
{{"kind", "deer"}, {"kingdom", "0"}, {"age", "20"}});
}

God allah(root_path, true);
God allah(ecosystem_root, true);
allah.cleanSlate();
allah.createWorld(organisms);
for (size_t i = 0; i < simulation_years; i++) {
Expand Down
3 changes: 2 additions & 1 deletion simulation/RandomTests/sanity_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#include <vector>

int main() {
setup::setup();
std::filesystem::path ecosystem_root = helper::get_ecosystem_root();
setup::setup(ecosystem_root);

const size_t initial_organism_count = 500;
const size_t simulation_years = 10;
Expand Down
35 changes: 29 additions & 6 deletions simulation/RandomTests/test1.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,35 @@
#include <ecosystem_wrapper.hpp>

int main() {
create_god(0);
void *session = session_init();
create_god(session, 1, get_ecosystem_root(session));
clean_slate(session);

set_initial_organisms(0, "deer", 10, 10);
set_initial_organisms(0, "deer", 20, 100);
set_initial_organisms(0, "deer", 30, 50);
set_initial_organisms(session, 0, "deer", 10, 10);
set_initial_organisms(session, 0, "deer", 20, 100);
set_initial_organisms(session, 0, "deer", 30, 50);
set_initial_organisms(session, 1, "bamboo", 30, 50);

create_world();
run_simulation(100);
create_world(session);

for (size_t i = 0; i < 5; i++) {
happy_new_year(session);
add_current_world_record(session);
}

struct FloatData fData =
get_plot_values(session, "deer", "weight_on_speed");
for (size_t i = 0; i < fData.length; i++) {
printf("%f\n", fData.data[i]);
}

fData = get_plot_values(session, "bamboo", "population");
for (size_t i = 0; i < fData.length; i++) {
printf("%f\n", fData.data[i]);
}

printf("%s\n", get_plot_attributes(session));

free_god(session);
free_session(session);
}
Loading
Loading