From 942fddb96dcfbc8ce42fc56c01f4668ca9b41fd6 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 16:32:26 +0100 Subject: [PATCH 1/7] Add SFML as submodule Signed-off-by: Wojciech Madry --- .gitmodules | 3 +++ SFML | 1 + 2 files changed, 4 insertions(+) create mode 160000 SFML diff --git a/.gitmodules b/.gitmodules index 0cd1b2e..cead82f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "src/BabelLib"] path = src/BabelLib url = https://github.com/wojciechmadry/BabelLib.git +[submodule "SFML"] + path = SFML + url = https://github.com/SFML/SFML.git diff --git a/SFML b/SFML new file mode 160000 index 0000000..69ea0cd --- /dev/null +++ b/SFML @@ -0,0 +1 @@ +Subproject commit 69ea0cd863aed1d4092b970b676924a716ff718b From 1ef996f5d66ff1b4763f2eeecdd6a37884ae2766 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 16:35:16 +0100 Subject: [PATCH 2/7] Build SFML from source Signed-off-by: Wojciech Madry --- CMakeLists.txt | 4 +--- readme.md | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d752bdf..9232eb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,7 @@ if(UNIX) find_package(Threads REQUIRED) endif(UNIX) -if(UNIX) - find_package(SFML COMPONENTS graphics window system REQUIRED) -endif() +add_subdirectory(SFML) include_directories( src/BabelLib diff --git a/readme.md b/readme.md index df0766b..fca1d1c 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ Requirements --- 1. CMake 2. C++20 (GCC or Clang) -3. `libsfml-dev` +3. [SFML dependencies](https://www.sfml-dev.org/tutorials/2.6/compile-with-cmake.php) Build from source --- From 8dca952a787fcd1b6ca93165a2bb19ce19930c28 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 16:54:15 +0100 Subject: [PATCH 3/7] Fix docker build, clang-ci, gcc-ci Signed-off-by: Wojciech Madry --- .github/workflows/clang.yaml | 13 ++++++++++++- .github/workflows/gcc.yml | 13 ++++++++++++- Dockerfile | 14 ++++++++++++-- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 3545a4b..c937df7 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -21,7 +21,18 @@ jobs: - name: Install Dependencies run: | - sudo apt -y install clang libsfml-dev + sudo apt -y install clang \ + libudev-dev \ + libopenal-dev \ + libvorbis-dev \ + libflac-dev \ + libx11-dev \ + libxcursor-dev \ + libxrandr-dev \ + libfreetype-dev \ + libopengl-dev \ + libglx-dev \ + libgl1-mesa-dev - name: FetchSubmodules run: | diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index 0a08343..f395945 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -21,7 +21,18 @@ jobs: - name: Install Dependencies run: | - sudo apt -y install g++ gcc libsfml-dev + sudo apt -y install g++ gcc \ + libudev-dev \ + libopenal-dev \ + libvorbis-dev \ + libflac-dev \ + libx11-dev \ + libxcursor-dev \ + libxrandr-dev \ + libfreetype-dev \ + libopengl-dev \ + libglx-dev \ + libgl1-mesa-dev - name: FetchSubmodules run: | diff --git a/Dockerfile b/Dockerfile index 36f43d1..92bfca3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,11 +5,21 @@ WORKDIR /ws RUN apt update \ && apt upgrade -y\ && apt install -y\ - libsfml-dev \ cmake \ ninja-build \ clang \ - git + git \ + libudev-dev \ + libopenal-dev \ + libvorbis-dev \ + libflac-dev \ + libx11-dev \ + libxcursor-dev \ + libxrandr-dev \ + libfreetype-dev \ + libopengl-dev \ + libglx-dev \ + libgl1-mesa-dev ENV CC=clang ENV CXX=clang++ From 58c9f46425af5b0cc030a8a0fb5da8fc040733f4 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 16:55:21 +0100 Subject: [PATCH 4/7] Kulki v.1.5 Signed-off-by: Wojciech Madry --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 391bff3..9eab80b 100644 --- a/main.cpp +++ b/main.cpp @@ -9,7 +9,7 @@ #include -static constexpr const char *VERSION = "1.4"; +static constexpr const char *VERSION = "1.5"; #define FPS 0 // Show fps in console From 7b43a1c08f5e02198c14372f74b5c63d2aa622c7 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 17:01:57 +0100 Subject: [PATCH 5/7] Add CMake stdlib flag Signed-off-by: Wojciech Madry --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9232eb8..9443f37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ add_executable(Kulki ${SRC_FILES} ) -target_compile_options(Kulki PRIVATE -O3 -Wextra -Werror -W -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common -Wconversion -pedantic -Wall) +target_compile_options(Kulki PRIVATE -O3 -Wextra -Werror -W -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common -Wconversion -pedantic -Wall -stdlib=libstdc++ -std=c++20) if(UNIX) target_link_libraries(Kulki PUBLIC Threads::Threads) From fcbf12d781887e00e23ec3b5c734b9bd0097cba3 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Mon, 27 Nov 2023 17:04:51 +0100 Subject: [PATCH 6/7] Undo std flags Signed-off-by: Wojciech Madry --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9443f37..9232eb8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ add_executable(Kulki ${SRC_FILES} ) -target_compile_options(Kulki PRIVATE -O3 -Wextra -Werror -W -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common -Wconversion -pedantic -Wall -stdlib=libstdc++ -std=c++20) +target_compile_options(Kulki PRIVATE -O3 -Wextra -Werror -W -Wshadow -Wdouble-promotion -Wformat=2 -Wundef -fno-common -Wconversion -pedantic -Wall) if(UNIX) target_link_libraries(Kulki PUBLIC Threads::Threads) From 4dce4f8418824f9b55e1398739a0a64734ffbae2 Mon Sep 17 00:00:00 2001 From: Wojciech Madry Date: Tue, 19 Dec 2023 20:03:26 +0100 Subject: [PATCH 7/7] Build gcc and clang in docker Signed-off-by: Wojciech Madry --- .github/workflows/clang.yaml | 37 ++------------- .github/workflows/clang_format.yaml | 6 +-- .../workflows/{docker_build.yaml => gcc.yaml} | 8 ++-- .github/workflows/gcc.yml | 47 ------------------- Dockerfile => Dockerfile.clang | 0 Dockerfile.gcc | 37 +++++++++++++++ 6 files changed, 49 insertions(+), 86 deletions(-) rename .github/workflows/{docker_build.yaml => gcc.yaml} (56%) delete mode 100644 .github/workflows/gcc.yml rename Dockerfile => Dockerfile.clang (100%) create mode 100644 Dockerfile.gcc diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index c937df7..e93366f 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -2,46 +2,19 @@ name: Clang on: push: - branches: - - '**' + branches: + - '**' pull_request: branches: - - '**' + - '**' jobs: build: runs-on: ubuntu-22.04 - env: - CC: clang - CXX: clang++ steps: - uses: actions/checkout@v3 - - name: Install Dependencies - run: | - sudo apt -y install clang \ - libudev-dev \ - libopenal-dev \ - libvorbis-dev \ - libflac-dev \ - libx11-dev \ - libxcursor-dev \ - libxrandr-dev \ - libfreetype-dev \ - libopengl-dev \ - libglx-dev \ - libgl1-mesa-dev - - - name: FetchSubmodules - run: | - git submodule init - git submodule update - - - name: Build Clang - run: | - mkdir -p build - cd build - cmake ../ - cmake --build . -j + - name: clang + run: docker build . --file Dockerfile.clang --tag kulki_docker_clang:$(date +%s) diff --git a/.github/workflows/clang_format.yaml b/.github/workflows/clang_format.yaml index c8dccbd..28e0c98 100644 --- a/.github/workflows/clang_format.yaml +++ b/.github/workflows/clang_format.yaml @@ -2,11 +2,11 @@ name: ClangFormat on: push: - branches: - - '**' + branches: + - '**' pull_request: branches: - - '**' + - '**' jobs: build: diff --git a/.github/workflows/docker_build.yaml b/.github/workflows/gcc.yaml similarity index 56% rename from .github/workflows/docker_build.yaml rename to .github/workflows/gcc.yaml index 2b66d94..59746d1 100644 --- a/.github/workflows/docker_build.yaml +++ b/.github/workflows/gcc.yaml @@ -1,4 +1,4 @@ -name: Dockerfile build +name: GCC on: push: @@ -9,12 +9,12 @@ on: - '**' jobs: - build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --file Dockerfile --tag kulki_docker:$(date +%s) + + - name: gcc + run: docker build . --file Dockerfile.gcc --tag kulki_docker_gcc:$(date +%s) diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml deleted file mode 100644 index f395945..0000000 --- a/.github/workflows/gcc.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: GCC - -on: - push: - branches: - - '**' - pull_request: - branches: - - '**' - -jobs: - build: - - runs-on: ubuntu-22.04 - env: - CC: gcc - CXX: g++ - - steps: - - uses: actions/checkout@v3 - - - name: Install Dependencies - run: | - sudo apt -y install g++ gcc \ - libudev-dev \ - libopenal-dev \ - libvorbis-dev \ - libflac-dev \ - libx11-dev \ - libxcursor-dev \ - libxrandr-dev \ - libfreetype-dev \ - libopengl-dev \ - libglx-dev \ - libgl1-mesa-dev - - - name: FetchSubmodules - run: | - git submodule init - git submodule update - - - name: Build GCC - run: | - mkdir -p build - cd build - cmake ../ - cmake --build . -j diff --git a/Dockerfile b/Dockerfile.clang similarity index 100% rename from Dockerfile rename to Dockerfile.clang diff --git a/Dockerfile.gcc b/Dockerfile.gcc new file mode 100644 index 0000000..39198f4 --- /dev/null +++ b/Dockerfile.gcc @@ -0,0 +1,37 @@ +FROM ubuntu:22.04 + +WORKDIR /ws + +RUN apt update \ + && apt upgrade -y\ + && apt install -y\ + cmake \ + ninja-build \ + gcc \ + git \ + libudev-dev \ + libopenal-dev \ + libvorbis-dev \ + libflac-dev \ + libx11-dev \ + libxcursor-dev \ + libxrandr-dev \ + libfreetype-dev \ + libopengl-dev \ + libglx-dev \ + libgl1-mesa-dev + +ENV CC=gcc +ENV CXX=g++ +ENV BRANCH=master + +RUN git clone https://github.com/wojciechmadry/Kulki.git \ + && cd Kulki \ + && git checkout ${BRANCH} \ + && git submodule init \ + && git submodule update \ + && mkdir -p build \ + && cd build \ + && cmake -GNinja ../ \ + && ninja +