diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build.yml similarity index 73% rename from .github/workflows/build_windows.yml rename to .github/workflows/build.yml index a3a21944..19241197 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Windows Build +name: Build on: [push, pull_request] jobs: @@ -7,10 +7,11 @@ jobs: runs-on: ${{ matrix.os }} if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: + fail-fast: false matrix: include: - # - os: ubuntu-latest - # name: Linux + - os: ubuntu-latest + name: Linux # - os: macOS-latest # name: MacOS - os: windows-latest @@ -22,10 +23,16 @@ jobs: - name: Install Xorg lib if: matrix.name == 'Linux' run: | - sudo apt install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev + sudo apt install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev liblua5.3-dev - name: Update G++ if: matrix.name == 'Linux' run: sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 + - name: Install Lua + if: matrix.name == 'Windows' + shell: bash + run: | + curl https://sourceforge.net/projects/luabinaries/files/5.4.2/Windows%20Libraries/Dynamic/lua-5.4.2_Win64_dll16_lib.zip/download -L > lua.zip + unzip lua - name: Build run: | mkdir build && cd build diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml deleted file mode 100644 index 9f352ac4..00000000 --- a/.github/workflows/build_linux.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Linux Build (Epitech Container) -on: [push, pull_request] - -jobs: - testbox: - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository - runs-on: ubuntu-latest - container: - image: epitechcontent/epitest-docker:latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Build - run: | - mkdir build && cd build - cmake .. - cmake --build . - - name: CheckBinaryName - shell: bash - run: test -f build/bomberman \ No newline at end of file diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index 2b9a2f3e..88d67e18 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -9,6 +9,8 @@ jobs: - uses: actions/checkout@v1 with: submodules: true + - name: Install lua + run: sudo apt install -y liblua5.3-dev - name: Exec shell: bash run: ./build_web.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e87b9b9d..ae5f9a29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: submodules: true - name: Install Xorg lib run: | - sudo apt install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev + sudo apt install -y libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev liblua5.3-dev - name: Update G++ run: sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 - name: Build diff --git a/CMakeLists.txt b/CMakeLists.txt index c724de45..62a1882b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,22 +3,20 @@ project(bomberman) set(CMAKE_CXX_STANDARD 20) -cmake_minimum_required(VERSION 3.10) - -include_directories(bomberman lib/Ray/sources) -include_directories(bomberman lib/wal/sources) -include_directories(bomberman lib/LuaGate/sources) -include_directories(bomberman sources) +include_directories(lib/Ray/sources) +include_directories(lib/wal/sources) +include_directories(lib/LuaGate/sources) +include_directories(sources) add_subdirectory(${PROJECT_SOURCE_DIR}/lib/wal) add_subdirectory(${PROJECT_SOURCE_DIR}/lib/Ray) add_subdirectory(${PROJECT_SOURCE_DIR}/lib/LuaGate) if (EMSCRIPTEN) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DISABLE_EXCEPTION_CATCHING --shell-file ../sources/wasm/frontend.html --preload-file ../assets") - set(CMAKE_EXECUTABLE_SUFFIX ".html") + set(CMAKE_EXECUTABLE_SUFFIX ".html") endif() set(SOURCES @@ -151,13 +149,11 @@ add_executable(bomberman sources/main.cpp ${SOURCES} ) - -target_include_directories(bomberman PUBLIC sources ${LUA_INCLUDE_DIR}) -target_link_libraries(bomberman PUBLIC wal ray ${LUA_LIBRARIES} LuaGate) +target_link_libraries(bomberman PUBLIC wal ray LuaGate) add_executable(unit_tests EXCLUDE_FROM_ALL ${SOURCES} - tests/CacheTest.cpp + tests/CacheTest.cpp tests/EntityTests.cpp tests/MainTest.cpp tests/EngineTests.cpp @@ -166,8 +162,7 @@ add_executable(unit_tests EXCLUDE_FROM_ALL tests/ViewTest.cpp tests/CollisionTest.cpp ) -target_include_directories(unit_tests PUBLIC sources) -target_link_libraries(unit_tests PUBLIC wal ray ${LUA_LIBRARIES}) +target_link_libraries(unit_tests PUBLIC wal ray LuaGate) find_package(Catch2 QUIET) if (NOT Catch2_FOUND) diff --git a/lib/LuaGate/CMakeLists.txt b/lib/LuaGate/CMakeLists.txt index 527fd990..eb227570 100644 --- a/lib/LuaGate/CMakeLists.txt +++ b/lib/LuaGate/CMakeLists.txt @@ -1,9 +1,8 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.11) +cmake_minimum_required(VERSION 3.11) set(CMAKE_CXX_STANDARD 20) -set(LIB_NAME "LuaGate") +project(LuaGate) -project("${LIB_NAME}") -include_directories(${LIB_NAME} ./sources) +include_directories(sources) if (CMAKE_COMPILER_IS_GNUCXX) set(GCC_COVERAGE_COMPILE_FLAGS "-Wall -Wextra -Werror -Wshadow") @@ -18,9 +17,17 @@ set(SRC sources/LuaGate.cpp ) -add_library(${LIB_NAME} STATIC ${SRC} ${HEADERS}) - - include(FindLua) -include_directories(${LIB_NAME} ${LUA_INCLUDE_DIR}) -target_link_libraries(${LIB_NAME} ${LUA_LIBRARIES}) +if (NOT LUA_FOUND) + if (EXISTS ${CMAKE_SOURCE_DIR}/include/lua.hpp) + message("Using local lua") + set(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/) + set(LUA_LIBRARIES ${CMAKE_SOURCE_DIR}/lua54.lib) + else() + message(FATAL_ERROR "Lua could not be found.") + endif() +endif() + +add_library(LuaGate STATIC ${SRC} ${HEADERS}) +target_include_directories(LuaGate PUBLIC ${LUA_INCLUDE_DIR}) +target_link_libraries(LuaGate ${LUA_LIBRARIES}) diff --git a/lib/LuaGate/sources/LuaGate.hpp b/lib/LuaGate/sources/LuaGate.hpp index dfaa2965..cf59833a 100644 --- a/lib/LuaGate/sources/LuaGate.hpp +++ b/lib/LuaGate/sources/LuaGate.hpp @@ -3,7 +3,7 @@ // #include -#include "lua.hpp" +#include namespace LuaG { diff --git a/sources/Component/IAControllable/IAControllableComponent.cpp b/sources/Component/IAControllable/IAControllableComponent.cpp index 5bfa2643..f594ef19 100644 --- a/sources/Component/IAControllable/IAControllableComponent.cpp +++ b/sources/Component/IAControllable/IAControllableComponent.cpp @@ -7,7 +7,6 @@ #include "Map/MapInfo.hpp" #include "Component/IAControllable/IAControllableComponent.hpp" -//#include "System/IAControllable/IAControllableSystem.hpp" namespace BBM { diff --git a/sources/Component/IAControllable/IAControllableComponent.hpp b/sources/Component/IAControllable/IAControllableComponent.hpp index 99e6393e..a1556662 100644 --- a/sources/Component/IAControllable/IAControllableComponent.hpp +++ b/sources/Component/IAControllable/IAControllableComponent.hpp @@ -11,7 +11,6 @@ #include "Component/Component.hpp" #include "Entity/Entity.hpp" #include "Models/Vector3.hpp" -#include "lua.hpp" #include "LuaGate.hpp" namespace BBM