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

new architecture #4

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ trim_trailing_whitespace = false
[*.gemspec]
indent_size = 2

[*.rb]
[*.rb,Fastfile,Gemfile,Brewfile,Podfile]
indent_size = 2

[*.bat]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1.8
with:
cmake-version: "3.20.0"
cmake-version: "3.24.0"

- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
Expand Down
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ Execute the following commands to build for Linux:
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target linux setup
python nativium.py target linux build
python nativium.py target linux run
python3 nativium.py custom install --path=../custom
python3 nativium.py target linux setup
python3 nativium.py target linux build
python3 nativium.py target linux run
```

# Build for macOS
Expand All @@ -57,10 +57,10 @@ Execute the following commands to build for macOS:
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target macos setup
python nativium.py target macos build
python nativium.py target macos run
python3 nativium.py custom install --path=../custom
python3 nativium.py target macos setup
python3 nativium.py target macos build
python3 nativium.py target macos run
```

# Build for Windows
Expand All @@ -70,10 +70,10 @@ Execute the following commands to build for Windows:
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target windows setup
python nativium.py target windows build
python nativium.py target windows run
python3 nativium.py custom install --path=../custom
python3 nativium.py target windows setup
python3 nativium.py target windows build
python3 nativium.py target windows run
```

Obs: On Windows the terminal needs to be opened as `administrator`, otherwise the `symlinks` will not be created.
Expand All @@ -85,10 +85,10 @@ Execute the following commands to build for Web Assembly (WASM):
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target wasm setup
python nativium.py target wasm build
python nativium.py target wasm serve
python3 nativium.py custom install --path=../custom
python3 nativium.py target wasm setup
python3 nativium.py target wasm build
python3 nativium.py target wasm serve
```

# Build for iOS
Expand All @@ -98,12 +98,12 @@ Execute the following commands to build for iOS:
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target ios setup
python nativium.py target ios build
python nativium.py target ios package --no-framework
python nativium.py target ios dist generate
python nativium.py app ios-pods
python3 nativium.py custom install --path=../custom
python3 nativium.py target ios setup
python3 nativium.py target ios build
python3 nativium.py target ios package --no-framework
python3 nativium.py target ios dist generate
python3 nativium.py app ios-pods
```

Open the project for Xcode:
Expand All @@ -119,11 +119,11 @@ Execute the following commands to build for Android:
```
git clone https://github.com/nativium/nativium.git nativium
cd nativium
python nativium.py custom install --path=../custom
python nativium.py target android setup
python nativium.py target android build
python nativium.py target android package
python nativium.py target android dist generate
python3 nativium.py custom install --path=../custom
python3 nativium.py target android setup
python3 nativium.py target android build
python3 nativium.py target android package
python3 nativium.py target android dist generate
```

Open the project for Android Studio:
Expand Down
12 changes: 12 additions & 0 deletions custom/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# dependencies for tests
include(${NATIVIUM_ROOT_PATH}/cmake/dependencies-tests.cmake)

if(NOT NATIVIUM_TARGET STREQUAL "wasm")
# sdl2
find_package(SDL2 CONFIG REQUIRED)
target_link_libraries(${NATIVIUM_PROJECT_NAME} PRIVATE SDL2::SDL2-static)

# sdl2 image
find_package(SDL2_image CONFIG REQUIRED)
target_link_libraries(${NATIVIUM_PROJECT_NAME} PRIVATE SDL2_image::SDL2_image-static)
endif()
50 changes: 25 additions & 25 deletions custom/custom_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import textwrap


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -39,6 +40,11 @@ def run(params):
"source": os.path.join("apps", "android"),
"target": os.path.join("apps", "android"),
},
{
"type": "copy-file",
"source": "cmake/dependencies.cmake",
"target": "cmake/dependencies.cmake",
},
{
"type": "replace-text",
"path": "core/const.py",
Expand All @@ -51,7 +57,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/android/config/target.py",
"path": "targets/android/config/target_config.py",
"list": [
{
"old": 'has_debug = True',
Expand All @@ -65,7 +71,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/ios/config/target.py",
"path": "targets/ios/config/target_config.py",
"list": [
{
"old": 'has_debug = True',
Expand Down Expand Up @@ -99,7 +105,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/linux/config/target.py",
"path": "targets/linux/config/target_config.py",
"list": [
{
"old": 'has_debug = True',
Expand All @@ -113,7 +119,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/macos/config/target.py",
"path": "targets/macos/config/target_config.py",
"list": [
{
"old": 'has_debug = True',
Expand All @@ -127,7 +133,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/windows/config/target.py",
"path": "targets/windows/config/target_config.py",
"list": [
{
"old": 'has_debug = True',
Expand All @@ -141,7 +147,7 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/wasm/config/target.py",
"path": "targets/wasm/config/target_config.py",
"list": [
{
"old": '"product_name": "Nativium"',
Expand Down Expand Up @@ -173,31 +179,25 @@ def run(params):
},
{
"type": "replace-text",
"path": "targets/android/cmake/target.cmake",
"path": "CMakeLists.txt",
"list": [
{
"old": '"${NATIVIUM_LIBRARY_LINKS}"',
"new": '"${NATIVIUM_LIBRARY_LINKS}" "android" "log" "GLESv1_CM" "GLESv2" "OpenSLES"',
"old": 'set(NATIVIUM_LIBRARY_LINKS "" CACHE STRING "Library Links")',
"new": textwrap.dedent("""
if(NATIVIUM_TARGET STREQUAL "android")
set(NATIVIUM_LIBRARY_LINKS "android" "log" "GLESv1_CM" "GLESv2" "OpenSLES" CACHE STRING "Library Links")
else()
set(NATIVIUM_LIBRARY_LINKS "" CACHE STRING "Library Links")
endif()""")
},
],
},
{
"type": "replace-text",
"path": "targets/ios/cmake/target.cmake",
"list": [
{
"old": '${NATIVIUM_FRAMEWORK_LINKS} "-framework Foundation"',
"new": '${NATIVIUM_FRAMEWORK_LINKS} "-framework Foundation" "-framework ImageIO" "-framework MobileCoreServices"',
"old": 'NATIVIUM_FRAMEWORK_LINKS_IOS "-framework Foundation"',
"new": 'NATIVIUM_FRAMEWORK_LINKS_IOS "-framework Foundation" "-framework ImageIO" "-framework MobileCoreServices"',
},
],
},
{
"type": "replace-text",
"path": "targets/wasm/cmake/target.cmake",
"list": [
{
"old": '"--bind -s MALLOC=emmalloc -s WASM_BIGINT=1"',
"new": '"--bind -s MALLOC=emmalloc -s WASM_BIGINT=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=\'[\\"jpg\\",\\"png\\"]\' --preload-file ${NATIVIUM_MODULES_PATH}/game/resources/assets@assets --use-preload-plugins"',
"old": 'set(NATIVIUM_WASM_LINK_FLAGS "--bind -s MALLOC=emmalloc -s WASM_BIGINT=1")',
"new": textwrap.dedent("""\
set(NATIVIUM_WASM_LINK_FLAGS "--bind -s MALLOC=emmalloc -s WASM_BIGINT=1 -sUSE_SDL=2 -sUSE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\\"jpg\\",\\"png\\"]' --preload-file ${NATIVIUM_MODULES_PATH}/game/resources/assets@assets --use-preload-plugins")"""),
},
],
},
Expand Down
28 changes: 14 additions & 14 deletions custom/modules/game/cmake/module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
set(MODULE_NAME "game")

# files
nativium_add_header_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/cpp/nativium/game/*.hpp")
nativium_add_header_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/nativium/game/*.hpp")
nativium_add_header_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/game/include/*.hpp")
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/cpp/nativium/game/*.hpp" GLOB)
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/nativium/game/*.hpp" GLOB)
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/game/include/*.hpp" GLOB)

nativium_add_source_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/cpp/nativium/game/*.cpp")
nativium_add_source_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/nativium/game/*.cpp")
nativium_add_source_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/game/src/*.cpp")
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/cpp/nativium/game/*.cpp" GLOB)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/nativium/game/*.cpp" GLOB)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/game/src/*.cpp" GLOB)

# search paths
nativium_add_search_path("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/cpp")
Expand All @@ -18,27 +18,27 @@ nativium_add_search_path("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation
# platform data
if(NATIVIUM_TARGET STREQUAL "android")
# files
nativium_add_header_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/jni/*.hpp")
nativium_add_source_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/jni/*.cpp")
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/jni/*.hpp" RECURSIVE)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/jni/*.cpp" RECURSIVE)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/android/main.cpp")

# search paths
nativium_add_search_path("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/jni")
elseif(NATIVIUM_TARGET STREQUAL "ios")
# files
nativium_add_header_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/objc/*.h")
nativium_add_source_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/objc/*.mm")
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/objc/*.h" RECURSIVE INSTALL INSTALL_FILTER "Private.h")
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/objc/*.mm" RECURSIVE)

# search paths
nativium_add_search_path("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/objc")
elseif(NATIVIUM_TARGET STREQUAL "wasm")
# files
nativium_add_header_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/wasm/*.hpp")
nativium_add_source_files_gr("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/wasm/*.cpp")
nativium_add_source_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/wasm/main.cpp")
nativium_add_header_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/wasm/*.hpp" RECURSIVE)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/wasm/*.cpp" RECURSIVE)
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/wasm/main.cpp")

# search paths
nativium_add_search_path("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/gluecode/generated-src/wasm")
elseif("${NATIVIUM_TARGET}" MATCHES "^(linux|macos|windows)$")
nativium_add_source_files_g("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/main/main.cpp")
nativium_add_source_files("${NATIVIUM_MODULES_PATH}/${MODULE_NAME}/implementation/cpp/main/main.cpp")
endif()
3 changes: 1 addition & 2 deletions custom/modules/game/config/module_conan.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ def configure(params={}):
conanfile: ConanFile = params["conanfile"]

if conanfile.settings.os == "Macos":
conanfile.options["sdl"].opengl = False
conanfile.options["sdl"].opengles = False
conanfile.options["sdl"].vulkan = False

Expand Down Expand Up @@ -36,5 +35,5 @@ def requirements(params={}):
conanfile: ConanFile = params["conanfile"]

if not conanfile.settings.os == "Emscripten":
conanfile.requires("sdl/2.24.0")
conanfile.requires("sdl/2.26.1")
conanfile.requires("sdl_image/2.0.5")