-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: use asw and add emscripten target * chore: update readme * fix: emscripten build * fix: submodule
- Loading branch information
1 parent
70fd412
commit 3abaaf2
Showing
222 changed files
with
822 additions
and
1,016 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Deploy Game | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- v* | ||
|
||
env: | ||
EM_VERSION: "latest" | ||
EM_CACHE_FOLDER: "emsdk-cache" | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup cache | ||
id: cache-system-libraries | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{env.EM_CACHE_FOLDER}} | ||
key: ${{env.EM_VERSION}}-${{ runner.os }} | ||
|
||
- uses: mymindstorm/setup-emsdk@v11 | ||
with: | ||
version: ${{env.EM_VERSION}} | ||
actions-cache-folder: ${{env.EM_CACHE_FOLDER}} | ||
|
||
- name: Run CMake | ||
run: emcmake cmake -G "Unix Makefiles" . | ||
|
||
- name: Make | ||
run: emmake make -j4 | ||
|
||
- uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: ./build | ||
|
||
- name: Deploy to GitHub Pages | ||
if: github.ref == 'refs/heads/main' | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
|
||
- name: Deploy to A.D.S. Games | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: adsgames/[email protected] | ||
with: | ||
project-id: jimsalienadventure | ||
build-dir: ./build/ | ||
platform: WEB | ||
bucket-access-key: ${{ secrets.LINODE_BUCKET_ACCESS_KEY }} | ||
bucket-secret-key: ${{ secrets.LINODE_BUCKET_SECRET_KEY }} | ||
api-key: ${{ secrets.ADSGAMES_API_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "lib/asw"] | ||
path = lib/asw | ||
url = https://github.com/AdsGames/asw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Win32", | ||
"includePath": ["${default}", "${workspaceFolder}/lib/asw/include"], | ||
"defines": ["_DEBUG", "UNICODE", "_UNICODE"], | ||
"compileCommands": "${workspaceFolder}/compile_commands.json", | ||
"configurationProvider": "ms-vscode.cmake-tools" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
{ | ||
"files.associations": { | ||
"any": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"*.tcc": "cpp", | ||
"bitset": "cpp", | ||
"cctype": "cpp", | ||
"charconv": "cpp", | ||
"chrono": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"codecvt": "cpp", | ||
"compare": "cpp", | ||
"concepts": "cpp", | ||
"condition_variable": "cpp", | ||
"cstdarg": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"cwctype": "cpp", | ||
"deque": "cpp", | ||
"forward_list": "cpp", | ||
"list": "cpp", | ||
"map": "cpp", | ||
"set": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"vector": "cpp", | ||
"exception": "cpp", | ||
"algorithm": "cpp", | ||
"functional": "cpp", | ||
"iterator": "cpp", | ||
"memory": "cpp", | ||
"memory_resource": "cpp", | ||
"numeric": "cpp", | ||
"optional": "cpp", | ||
"random": "cpp", | ||
"ratio": "cpp", | ||
"source_location": "cpp", | ||
"string_view": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"format": "cpp", | ||
"fstream": "cpp", | ||
"future": "cpp", | ||
"initializer_list": "cpp", | ||
"iomanip": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"istream": "cpp", | ||
"limits": "cpp", | ||
"mutex": "cpp", | ||
"new": "cpp", | ||
"numbers": "cpp", | ||
"ostream": "cpp", | ||
"semaphore": "cpp", | ||
"span": "cpp", | ||
"sstream": "cpp", | ||
"stdexcept": "cpp", | ||
"stdfloat": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"thread": "cpp", | ||
"cinttypes": "cpp", | ||
"typeinfo": "cpp", | ||
"variant": "cpp", | ||
"ranges": "cpp", | ||
"valarray": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
// See https://go.microsoft.com/fwlink/?LinkId=733558 | ||
// for the documentation about the tasks.json format | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Build", | ||
"type": "shell", | ||
"detail": "Run and build jim farm", | ||
"command": "cmake --build . && cd build && ./JimsAlienAdventure", | ||
"windows": { | ||
"command": "cmake --build . && cd build && JimsAlienAdventure.exe" | ||
}, | ||
"group": "build", | ||
"problemMatcher": "$gcc" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,94 @@ | ||
cmake_minimum_required(VERSION 3.11) | ||
|
||
set(CMAKE_CXX_STANDARD 14) | ||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
include(FetchContent) | ||
|
||
project (JimsAlienAdventure) | ||
|
||
# Source code | ||
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) | ||
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h) | ||
file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/lib/*.cpp) | ||
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h ${CMAKE_CURRENT_SOURCE_DIR}/lib/*.h) | ||
|
||
add_executable (${PROJECT_NAME} ${SOURCES} ${HEADERS}) | ||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) | ||
|
||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic) | ||
|
||
FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz) | ||
FetchContent_MakeAvailable(json) | ||
|
||
add_subdirectory(lib/asw) | ||
|
||
# Find libs | ||
find_library(ALLEGRO_LIBRARY NAMES alleg44 alleg REQUIRED) | ||
find_library(ALLEGRO_PNG_LIBRARY NAMES loadpng REQUIRED) | ||
find_library(ALLEGRO_OGG_LIBRARY NAMES logg REQUIRED) | ||
if(NOT EMSCRIPTEN) | ||
find_library(SDL_LIBRARY NAMES SDL2 REQUIRED) | ||
find_library(SDL_MIXER_LIBRARY NAMES SDL2_mixer REQUIRED) | ||
find_library(SDL_IMAGE_LIBRARY NAMES SDL2_image REQUIRED) | ||
find_library(SDL_TTF_LIBRARY NAMES SDL2_ttf REQUIRED) | ||
find_library(SDL_GFX_LIBRARY NAMES SDL2_gfx REQUIRED) | ||
find_library(SDL_MAIN_LIBRARY NAMES SDL2main REQUIRED) | ||
endif(NOT EMSCRIPTEN) | ||
|
||
|
||
# Link Libs | ||
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_LIBRARY}) | ||
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_PNG_LIBRARY}) | ||
target_link_libraries(${PROJECT_NAME} ${ALLEGRO_OGG_LIBRARY}) | ||
# Emscripten support | ||
if(EMSCRIPTEN) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "index") | ||
set(CMAKE_EXECUTABLE_SUFFIX ".html") | ||
target_compile_options( | ||
${PROJECT_NAME} | ||
PRIVATE | ||
-sUSE_SDL=2 | ||
-sUSE_SDL_IMAGE=2 | ||
-sUSE_SDL_TTF=2 | ||
-sUSE_SDL_MIXER=2 | ||
-sUSE_SDL_GFX=2 | ||
-sSDL2_IMAGE_FORMATS=["png"] | ||
-sSTACK_SIZE=128MB | ||
) | ||
target_link_libraries( | ||
${PROJECT_NAME} | ||
-sWASM=1 | ||
-sUSE_SDL=2 | ||
-sUSE_SDL_IMAGE=2 | ||
-sUSE_SDL_TTF=2 | ||
-sUSE_SDL_MIXER=2 | ||
-sUSE_SDL_GFX=2 | ||
-sSDL2_IMAGE_FORMATS=["png"] | ||
-sDEMANGLE_SUPPORT=1 | ||
-sTOTAL_MEMORY=512MB | ||
-sSTACK_SIZE=128MB | ||
nlohmann_json::nlohmann_json | ||
asw | ||
) | ||
set_target_properties( | ||
${PROJECT_NAME} | ||
PROPERTIES | ||
LINK_FLAGS | ||
"--preload-file ${CMAKE_CURRENT_LIST_DIR}/assets@/assets --use-preload-plugins --shell-file ${CMAKE_CURRENT_LIST_DIR}/index.html" | ||
) | ||
|
||
# Run of the mill executable | ||
else(EMSCRIPTEN) | ||
if(MINGW) | ||
target_link_libraries(${PROJECT_NAME} -lmingw32) | ||
endif(MINGW) | ||
target_link_libraries( | ||
${PROJECT_NAME} | ||
-lm | ||
${SDL_MAIN_LIBRARY} | ||
${SDL_LIBRARY} | ||
${SDL_MIXER_LIBRARY} | ||
${SDL_IMAGE_LIBRARY} | ||
${SDL_TTF_LIBRARY} | ||
${SDL_GFX_LIBRARY} | ||
nlohmann_json::nlohmann_json | ||
asw | ||
) | ||
endif(EMSCRIPTEN) | ||
|
||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/assets/ DESTINATION ${CMAKE_BINARY_DIR}/build/assets/) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.