Skip to content
Merged
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
14 changes: 0 additions & 14 deletions .gitattributes

This file was deleted.

16 changes: 7 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Setup cache
uses: actions/cache@v4
with:
path: "_deps"
path: "./build/release/_deps"
key: deps-${{ runner.os }}

- uses: mymindstorm/setup-emsdk@v14
Expand All @@ -45,19 +45,17 @@ jobs:
run: |
embuilder build harfbuzz

- name: Run CMake
run: emcmake cmake -G "Unix Makefiles" .
- name: Configure
run: emcmake cmake --preset release

- name: Make
run: emmake make -j4
- name: Build
run: cmake --build --preset release

- uses: actions/upload-pages-artifact@v3
if: github.ref == 'refs/heads/main'
with:
path: ./build
path: ./build/release/target/

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
id: deployment
uses: actions/deploy-pages@v4

Expand All @@ -66,7 +64,7 @@ jobs:
uses: adsgames/deploy-to-adsgames@v1.1.2
with:
project-id: memory
build-dir: ./build/
build-dir: ./build/release/target/
platform: WEB
bucket-access-key: ${{ secrets.LINODE_BUCKET_ACCESS_KEY }}
bucket-secret-key: ${{ secrets.LINODE_BUCKET_SECRET_KEY }}
Expand Down
19 changes: 2 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ Icon
.Spotlight-V100
.Trashes

CppCheckResults.xml
CMakeFiles
CMakeCache.txt
Makefile
*.cmake
install_manifest.txt
bin
docs

.ninja*
build.ninja
*.exe
# Build
/build
.idea
Testing/
compile_commands.json
_deps/
!/cmake/get_cpm.cmake

2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Win32",
"includePath": ["${default}"],
"defines": ["_DEBUG", "UNICODE", "_UNICODE"],
"compileCommands": "${workspaceFolder}/build/compile_commands.json",
"compileCommands": "${workspaceFolder}/build/debug/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@
"stop_token": "cpp",
"thread": "cpp"
},
"sonarlint.pathToCompileCommands": "${workspaceFolder}\\compile_commands.json"
"sonarlint.connectedMode.project": {
"connectionId": "adsgames",
"projectKey": "AdsGames_memory"
},
"sonarlint.pathToCompileCommands": "${workspaceFolder}/build/debug/compile_commands.json"
}
18 changes: 0 additions & 18 deletions .vscode/tasks.json

This file was deleted.

65 changes: 18 additions & 47 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,66 +1,37 @@
cmake_minimum_required(VERSION 3.24)

project(Memory VERSION 0.1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/build)

# ---- Project ----

project (
Memory
VERSION 0.1.0
LANGUAGES CXX
)

# ---- Dependencies ----
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/target)

include(cmake/get_cpm.cmake)
CPMAddPackage("gh:adsgames/asw@0.5.7")

# ---- Source code ----
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HEADERS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)

file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.h)

# ---- Executable ----

add_executable (${PROJECT_NAME} ${SOURCES} ${HEADERS})
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -pedantic)

# ---- Libs ----

if(MINGW)
target_link_libraries(${PROJECT_NAME} -lmingw32)
endif(MINGW)

target_link_libraries(
${PROJECT_NAME}
asw
)

# ---- Emscripten ----
target_link_libraries(${PROJECT_NAME} PRIVATE asw)

if(EMSCRIPTEN)
set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "index")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set_target_properties(${PROJECT_NAME} PROPERTIES
OUTPUT_NAME "index"
SUFFIX ".html"
)

target_link_libraries(
${PROJECT_NAME}
-sWASM=1
-sALLOW_MEMORY_GROWTH=1
target_link_options(${PROJECT_NAME} PRIVATE
-sWASM=1
-sALLOW_MEMORY_GROWTH=1
-sMAXIMUM_MEMORY=1gb
)

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"
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"
)
endif(EMSCRIPTEN)

# ---- Assets ----

file(COPY ${CMAKE_CURRENT_LIST_DIR}/assets/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets/)
endif()

file(COPY ${CMAKE_CURRENT_LIST_DIR}/assets/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets/)
44 changes: 44 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "debug",
"hidden": false,
"generator": "Unix Makefiles",
"description": "Debug build",
"binaryDir": "${sourceDir}/build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "release",
"hidden": false,
"generator": "Unix Makefiles",
"description": "Release build",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "debug",
"description": "Build a debug build",
"displayName": "debug",
"configurePreset": "debug"
},
{
"name": "release",
"description": "Build a release build",
"displayName": "release",
"configurePreset": "release"
}
]
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Match all the cards on the table in four different difficulties. Compete against
### CMake

```bash
cmake -B build .
cmake --build ./build
cmake --preset debug
cmake --build --preset debug
```

### Build Emscripten

```bash
emcmake cmake -B build .
cmake --build ./build
emcmake cmake --preset debug
cmake --build --preset debug
```