diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 48388a8dfc9f4595eb381631b61a2469ef4bd7e8..425a2fd67c262c587136e274478af260665a4327 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,16 +22,18 @@ stages: # List of stages for jobs, and their order of execution build-job: # This job runs in the build stage, which runs first. stage: build + before_script: + - apk update && apk --update add build-base g++ libstdc++ cmake extra-cmake-modules bash mesa-gl mesa-egl mesa-gles wayland-dev wayland-protocols libxkbcommon-dev script: - - apk update && apk --update add g++ build-base cmake bash libstdc++ - mkdir build && cd build - cmake .. - make unit-test-job: # This job runs in the test stage. stage: test # It only starts when the job in the build stage completes successfully. + before_script: + - apk update && apk --update add build-base g++ libstdc++ cmake extra-cmake-modules bash mesa-gl wayland-dev wayland-protocols script: - - apk update && apk --update add g++ build-base cmake bash libstdc++ clang-tidy - mkdir build && cd build - cmake .. && make # TODO cache build from previous step - ./tests/testfggl/fggl_test diff --git a/CMakeLists.txt b/CMakeLists.txt index d8bea12b6bc88f89efedd5cdd86ac228878c4008..6f51ed39eb6765c9d77cc54939b0c1a18420192d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,18 +1,32 @@ cmake_minimum_required(VERSION 3.10) - project(FGGL VERSION 0.1 LANGUAGES CXX) +set(FGGL_WAYLAND True) + # Set C++ version set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # depdencies +if ( NOT glfw3_FOUND ) + include(FetchContent) + set(GLFW_BUILD_EXAMPLES OFF) + set(GLFW_BUILD_TESTS OFF) + if ( FGGL_WAYLAND ) + set(GLFW_USE_WAYLAND True) + endif () + FetchContent_Declare( + glfw3 + URL https://github.com/glfw/glfw/releases/download/3.3.4/glfw-3.3.4.zip + ) + FetchContent_MakeAvailable( glfw3 ) +endif () add_subdirectory(vendor/imgui/) # engine -set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*") +#set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*") add_subdirectory(fggl) # extras diff --git a/build.sh b/build.sh index 2bfc10fe749e1115fb4f58463516c1dcda3b08b0..34be0d13dbe558f05b075feb2c12d3001a0d8956 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,10 @@ then mkdir build fi +sudo dnf install -y cmake +sudo dnf install -y wayland-devel libxkbcommon-devel wayland-protocols-devel extra-cmake-modules +sudo dnf install -y glew-devel glm-devel + # if doing shader development, disable the cache to make sure changes take affect rm -rf /tmp/fggl/ diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt index 3311372b647c62197b5d553a3043f6b992ab9050..f639ed7e5c47349bba975a935454590629ab238a 100644 --- a/fggl/CMakeLists.txt +++ b/fggl/CMakeLists.txt @@ -1,18 +1,15 @@ configure_file(FgglConfig.h.in FgglConfig.h) - -# Windowing backend -# find_package( glfw3 REQUIRED ) -if ( NOT glfw3_FOUND ) -include(FetchContent) -FetchContent_Declare( - glfw3 - URL https://github.com/glfw/glfw/releases/download/3.3.4/glfw-3.3.4.zip -) -FetchContent_MakeAvailable( glfw3 ) -endif () - -add_library(fggl fggl.cpp ecs/ecs.cpp gfx/window.cpp gfx/renderer.cpp gfx/input.cpp gfx/shader.cpp gfx/ogl.cpp data/model.cpp data/procedural.cpp debug/debug.cpp) +add_library(fggl fggl.cpp + ecs/ecs.cpp + gfx/window.cpp + gfx/renderer.cpp + gfx/input.cpp + gfx/shader.cpp + gfx/ogl.cpp + data/model.cpp + data/procedural.cpp + debug/debug.cpp) target_include_directories(fggl PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../) # Graphics backend diff --git a/vendor/imgui/CMakeLists.txt b/vendor/imgui/CMakeLists.txt index 1a017507403c2963ddf95faac53f4a48c4f324e5..4c10584457db48607ce39ef0c45506416b74af8c 100644 --- a/vendor/imgui/CMakeLists.txt +++ b/vendor/imgui/CMakeLists.txt @@ -10,5 +10,8 @@ set( IMGUI_SOURCES add_library(imgui ${IMGUI_SOURCES}) target_include_directories(imgui PUBLIC .) +# GLFW/OpenGL +target_link_libraries(imgui glfw) target_sources(imgui PRIVATE backends/imgui_impl_glfw.cpp backends/imgui_impl_opengl3.cpp) + target_include_directories(imgui PRIVATE backends)