From d3a0d8470e09138b1c770ac0c5a4284ca5a442e0 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 2 Oct 2021 13:02:12 +0200 Subject: [PATCH 1/4] Add CMake Signed-off-by: Bensuperpc --- .gitignore | 3 ++ .gitmodules | 2 + CMakeLists.txt | 135 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index 44cc3de7..329c63f2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,6 @@ logs/* *.d .deps .dirstamp +cmake-build-debug/ +build/ +**/*.o diff --git a/.gitmodules b/.gitmodules index 90de0e89..f8eb2fe0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,5 @@ [submodule "src/core"] path = src/core url = https://github.com/acaudwell/Core.git +[submodule "cmake/sdl2/"] + url = https://github.com/bensuperpc/sdl2-cmake-modules.git diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..38d8de5b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,135 @@ +project(gource LANGUAGES CXX) +cmake_minimum_required(VERSION 3.10) + +set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} + ${PROJECT_SOURCE_DIR}/cmake) + +#=== C++ VERSION CHECK === +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CXX_EXTENSIONS ON) +set(CMAKE_CXX_STANDARD 17) + +#=== Autogen +#autogen.sh + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wconversion -Wshadow") + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/sdl2) + +find_package(SDL2 REQUIRED) +find_package(SDL2_image REQUIRED) + +find_package(Freetype REQUIRED) +find_package(PNG REQUIRED) + + +set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external) + +include(ExternalProject) +ExternalProject_Add(libpcre + GIT_REPOSITORY https://github.com/vmg/libpcre.git + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} +) + +include_directories(${EXTERNAL_INSTALL_LOCATION}/include) +link_directories(${EXTERNAL_INSTALL_LOCATION}/lib) + +find_package(OpenGL REQUIRED COMPONENTS OpenGL) +find_package(GLUT REQUIRED) + +find_package(GLEW REQUIRED) + +find_package(Boost REQUIRED COMPONENTS filesystem system) + +#add_definitions(-DGOURCE_FONT_FILE=data/fonts/FreeSans.ttf) + +add_executable(gource + src/action.cpp + src/bloom.cpp + src/caption.cpp + src/core/conffile.cpp + src/core/display.cpp + src/core/frustum.cpp + src/core/fxfont.cpp + src/core/logger.cpp + src/core/mousecursor.cpp + src/core/plane.cpp + src/core/ppm.cpp + src/core/quadtree.cpp + src/core/regex.cpp + src/core/resource.cpp + src/core/sdlapp.cpp + src/core/seeklog.cpp + src/core/settings.cpp + src/core/shader.cpp + src/core/shader_common.cpp + src/core/stringhash.cpp + src/core/texture.cpp + src/core/png_writer.cpp + src/core/timezone.cpp + src/core/vbo.cpp + src/core/vectors.cpp + src/dirnode.cpp + src/file.cpp + src/formats/apache.cpp + src/formats/bzr.cpp + src/formats/commitlog.cpp + src/formats/custom.cpp + src/formats/cvs-exp.cpp + src/formats/cvs2cl.cpp + src/formats/git.cpp + src/formats/gitraw.cpp + src/formats/hg.cpp + src/formats/svn.cpp + src/gource.cpp + src/gource_shell.cpp + src/gource_settings.cpp + src/key.cpp + src/logmill.cpp + src/main.cpp + src/pawn.cpp + src/slider.cpp + src/spline.cpp + src/textbox.cpp + src/user.cpp + src/zoomcamera.cpp + # Use USE_BUNDLED_TINYXML + src/tinyxml/tinyxmlerror.cpp + src/tinyxml/tinystr.cpp + src/tinyxml/tinyxml.cpp + src/tinyxml/tinyxmlparser.cpp + ) + + +#include_directories(gource ${SDL2_INCLUDE_DIRS}) +#target_link_libraries(gource ${SDL2_LIBRARIES}) +target_link_libraries(gource SDL2::Main SDL2::Image) + +include_directories(gource ${FREETYPE_INCLUDE_DIRS}) +target_link_libraries(gource ${FREETYPE_LIBRARIES}) + +include_directories(gource ${PNG_INCLUDE_DIR}) +target_link_libraries(gource ${PNG_LIBRARY}) + +add_dependencies(gource libpcre) +target_link_libraries(gource pcre) + + +#add_dependencies(gource OpenGL::OpenGL) +#target_include_directories(gource PRIVATE ${GLUT_INCLUDE_DIRS}) +#target_link_libraries(gource OpenGL::OpenGL ${GLUT_LIBRARY}) + + +#add_dependencies(gource OpenGL::OpenGL) +include_directories(${GLUT_INCLUDE_DIRS} ) + +target_link_libraries(gource OpenGL::OpenGL ${GLUT_LIBRARY} ${OPENGL_glu_LIBRARY}) + + + +include_directories(gource ${GLEW_INCLUDE_DIRS}) +target_link_libraries(gource ${GLEW_LIBRARIES}) + +include_directories(gource ${Boost_INCLUDE_DIR}) +target_link_libraries(gource ${Boost_LIBRARIES}) From 60c031b2dbde50cb4de4cda4941ae1da1801f5db Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 2 Oct 2021 13:13:09 +0200 Subject: [PATCH 2/4] Fix submodule Signed-off-by: Bensuperpc --- .gitmodules | 3 ++- cmake/sdl2 | 1 + ninja-builder.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 160000 cmake/sdl2 create mode 100644 ninja-builder.sh diff --git a/.gitmodules b/.gitmodules index f8eb2fe0..f6f6f4eb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,6 @@ [submodule "src/core"] path = src/core url = https://github.com/acaudwell/Core.git -[submodule "cmake/sdl2/"] +[submodule "cmake/sdl2"] + path = cmake/sdl2 url = https://github.com/bensuperpc/sdl2-cmake-modules.git diff --git a/cmake/sdl2 b/cmake/sdl2 new file mode 160000 index 00000000..52901b49 --- /dev/null +++ b/cmake/sdl2 @@ -0,0 +1 @@ +Subproject commit 52901b4900e54345e7d4e71f89a5242b1f603920 diff --git a/ninja-builder.sh b/ninja-builder.sh new file mode 100644 index 00000000..87eaa7c7 --- /dev/null +++ b/ninja-builder.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -euo pipefail +#////////////////////////////////////////////////////////////// +#// ____ // +#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ // +#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| // +#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ // +#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| // +#// |_| |_| // +#////////////////////////////////////////////////////////////// +#// // +#// Script, 2020 // +#// Created: 06, October, 2020 // +#// Modified: 30, July, 2021 // +#// file: - // +#// - // +#// Source: // +#// OS: ALL // +#// CPU: ALL // +#// // +#////////////////////////////////////////////////////////////// + +mkdir -p build + +cmake -S . -B build -G Ninja "$*" + +ninja -C build From 869f77697d02477a82ff205ef79afc7081e8f114 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 2 Oct 2021 13:18:16 +0200 Subject: [PATCH 3/4] clean up Signed-off-by: Bensuperpc --- ninja-builder.sh | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 ninja-builder.sh diff --git a/ninja-builder.sh b/ninja-builder.sh deleted file mode 100644 index 87eaa7c7..00000000 --- a/ninja-builder.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail -#////////////////////////////////////////////////////////////// -#// ____ // -#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ // -#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| // -#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ // -#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| // -#// |_| |_| // -#////////////////////////////////////////////////////////////// -#// // -#// Script, 2020 // -#// Created: 06, October, 2020 // -#// Modified: 30, July, 2021 // -#// file: - // -#// - // -#// Source: // -#// OS: ALL // -#// CPU: ALL // -#// // -#////////////////////////////////////////////////////////////// - -mkdir -p build - -cmake -S . -B build -G Ninja "$*" - -ninja -C build From acc7dd729c8fc47454fb49aae2691accaf8e6a17 Mon Sep 17 00:00:00 2001 From: Bensuperpc Date: Sat, 2 Oct 2021 13:31:55 +0200 Subject: [PATCH 4/4] clean up CMake Signed-off-by: Bensuperpc --- .gitignore | 2 -- CMakeLists.txt | 11 ----------- 2 files changed, 13 deletions(-) diff --git a/.gitignore b/.gitignore index 329c63f2..aa3b41ee 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,4 @@ logs/* *.d .deps .dirstamp -cmake-build-debug/ build/ -**/*.o diff --git a/CMakeLists.txt b/CMakeLists.txt index 38d8de5b..ba57603f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,8 +102,6 @@ add_executable(gource ) -#include_directories(gource ${SDL2_INCLUDE_DIRS}) -#target_link_libraries(gource ${SDL2_LIBRARIES}) target_link_libraries(gource SDL2::Main SDL2::Image) include_directories(gource ${FREETYPE_INCLUDE_DIRS}) @@ -115,19 +113,10 @@ target_link_libraries(gource ${PNG_LIBRARY}) add_dependencies(gource libpcre) target_link_libraries(gource pcre) - -#add_dependencies(gource OpenGL::OpenGL) -#target_include_directories(gource PRIVATE ${GLUT_INCLUDE_DIRS}) -#target_link_libraries(gource OpenGL::OpenGL ${GLUT_LIBRARY}) - - -#add_dependencies(gource OpenGL::OpenGL) include_directories(${GLUT_INCLUDE_DIRS} ) target_link_libraries(gource OpenGL::OpenGL ${GLUT_LIBRARY} ${OPENGL_glu_LIBRARY}) - - include_directories(gource ${GLEW_INCLUDE_DIRS}) target_link_libraries(gource ${GLEW_LIBRARIES})