Fix up build and start site generator.

This commit is contained in:
jmsgrogan 2022-10-03 07:45:10 +01:00
parent d471609712
commit bd60a28eef
15 changed files with 267 additions and 96 deletions

View file

@ -7,22 +7,22 @@ CommandLineArgs::CommandLineArgs()
}
std::unique_ptr<CommandLineArgs> CommandLineArgs::CreateUnique()
std::unique_ptr<CommandLineArgs> CommandLineArgs::Create()
{
return std::make_unique<CommandLineArgs>();
}
std::filesystem::path CommandLineArgs::GetLaunchPath()
std::filesystem::path CommandLineArgs::getLaunchPath()
{
return mLaunchPath;
}
void CommandLineArgs::RecordLaunchPath()
void CommandLineArgs::recordLaunchPath()
{
mLaunchPath = std::filesystem::current_path();
}
void CommandLineArgs::Process(int argc, char *argv[])
void CommandLineArgs::process(int argc, char *argv[])
{
for(int idx=0; idx<argc; idx++)
{
@ -30,17 +30,17 @@ void CommandLineArgs::Process(int argc, char *argv[])
}
}
void CommandLineArgs::Process(const std::vector<std::string>& args)
void CommandLineArgs::process(const std::vector<std::string>& args)
{
mArugments = args;
}
std::size_t CommandLineArgs::GetNumberOfArgs() const
std::size_t CommandLineArgs::getNumberOfArgs() const
{
return mArugments.size();
}
std::string CommandLineArgs::GetArg(std::size_t index) const
std::string CommandLineArgs::getArg(std::size_t index) const
{
if(index<mArugments.size())
{

View file

@ -6,26 +6,27 @@
class CommandLineArgs
{
std::vector<std::string> mArugments;
std::filesystem::path mLaunchPath;
public:
CommandLineArgs();
static std::unique_ptr<CommandLineArgs> CreateUnique();
static std::unique_ptr<CommandLineArgs> Create();
void RecordLaunchPath();
std::filesystem::path getLaunchPath();
std::filesystem::path GetLaunchPath();
std::size_t getNumberOfArgs() const;
void Process(int argc, char *argv[]);
std::string getArg(std::size_t index) const;
void Process(const std::vector<std::string>& args);
void process(int argc, char *argv[]);
std::size_t GetNumberOfArgs() const;
void process(const std::vector<std::string>& args);
std::string GetArg(std::size_t index) const;
void recordLaunchPath();
private:
std::vector<std::string> mArugments;
std::filesystem::path mLaunchPath;
};
using CommandLineArgsUPtr = std::unique_ptr<CommandLineArgs>;

View file

@ -17,13 +17,13 @@ list(APPEND image_DEFINES "")
find_package(PNG QUIET)
if(PNG_FOUND)
list(APPEND image_LIBS PNG::PNG)
list(APPEND image_LIB_INCLUDES
PngWriterLibPng.cpp
)
list(APPEND image_DEFINES HAS_LIBPNG)
list(APPEND image_LIBS PNG::PNG)
list(APPEND image_LIB_INCLUDES
PngWriterLibPng.cpp
)
list(APPEND image_DEFINES HAS_LIBPNG)
else()
message(STATUS "LIBRARY CHECK: libPNG not found - disabling libPNG based image i/o.")
message(STATUS "LIBRARY CHECK: libPNG not found - disabling libPNG based image i/o.")
endif()

View file

@ -8,7 +8,9 @@ class Image;
class PngWriterImpl
{
public:
virtual ~PngWriterImpl() = default;
virtual void setPath(const std::string& path) = 0;
virtual void write(const std::unique_ptr<Image>& image) const = 0;
};
};

View file

View file

View file

View file

@ -1,40 +1,50 @@
list(APPEND video_HEADERS
Video.h
FfmpegInterface.h
BasicVideoConverter.h
IVideoConverter.h
)
list(APPEND video_LIB_INCLUDES
Video.cpp
FfmegInterface.cpp
BasicVideoConverter.cpp
)
list(APPEND video_DEFINES "")
find_package(PkgConfig QUIET)
set(_HAS_FFMPEG Off)
if(PkgConfig)
pkg_check_modules(LIBAV IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
list(APPEND video_LIBS PkgConfig::LIBAV)
list(APPEND video_HEADERS
FfmpegInterface.h
)
list(APPEND video_LIB_INCLUDES
FfmegInterface.cpp
)
list(APPEND video_DEFINES "HAS_FFMPEG")
set(_HAS_FFMPEG ON)
else()
message(STATUS "LIBRARY CHECK: PkgConfig not found - disabling ffmpeg based video i/o.")
endif()
set(HAS_FFMPEG ${_HAS_FFMPEG} CACHE BOOL "Can build with FFMPEG")
add_library(video SHARED ${video_LIB_INCLUDES} ${video_HEADERS})
target_include_directories(video PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}"
)
target_include_directories(video PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
set_target_properties( video PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
list(APPEND video_LIBS image)
find_package(PkgConfig QUIET)
if(PkgConfig)
pkg_check_modules(LIBAV IMPORTED_TARGET
libavdevice
libavfilter
libavformat
libavcodec
libswresample
libswscale
libavutil
)
list(APPEND video_LIBS PkgConfig::LIBAV)
else()
message(STATUS "LIBRARY CHECK: PkgConfig not found - disabling ffmpeg based video i/o.")
endif()
target_link_libraries( video PUBLIC ${video_LIBS})
set_property(TARGET video PROPERTY FOLDER src)
set_property(TARGET video PROPERTY FOLDER src)

View file

View file

@ -1,59 +1,68 @@
set (platform_INCLUDES "")
set (platform_LIBS "")
if(UNIX)
list(APPEND platform_INCLUDES
ui_interfaces/x11/XcbInterface.cpp
ui_interfaces/x11/XcbEventInterface.cpp
ui_interfaces/x11/XcbWindow.cpp
ui_interfaces/x11/XcbScreen.cpp
ui_interfaces/x11/XcbWindowInterface.cpp
ui_interfaces/x11/XcbLayerInterface.cpp
ui_interfaces/x11/XcbTextInterface.cpp
ui_interfaces/x11/XcbKeyboard.cpp
ui_interfaces/x11/GlxInterface.cpp
ui_interfaces/wayland/WaylandWindowInterface.cpp
ui_interfaces/wayland/WaylandSurface.cpp
ui_interfaces/wayland/WaylandBuffer.cpp
)
set(_HAS_WAYLAND Off)
list(APPEND platform_LIBS
X11 X11-xcb xcb )
if(UNIX)
list(APPEND platform_INCLUDES
ui_interfaces/x11/XcbInterface.cpp
ui_interfaces/x11/XcbEventInterface.cpp
ui_interfaces/x11/XcbWindow.cpp
ui_interfaces/x11/XcbScreen.cpp
ui_interfaces/x11/XcbWindowInterface.cpp
ui_interfaces/x11/XcbLayerInterface.cpp
ui_interfaces/x11/XcbTextInterface.cpp
ui_interfaces/x11/XcbKeyboard.cpp
ui_interfaces/x11/GlxInterface.cpp
)
list(APPEND platform_LIBS
X11 X11-xcb xcb )
find_path(
WAYLAND_CLIENT_INCLUDE_DIR
NAMES wayland-client.h
)
)
list(APPEND WAYLAND_INCLUDE_DIRS ${WAYLAND_CLIENT_INCLUDE_DIR})
find_path(
WAYLAND_EXTENSIONS_INCLUDE_DIR
NAMES xdg-shell-client-protocol.h
HINTS ENV WAYLAND_EXTENSION_DIR
)
find_library(
WAYLAND_CLIENT_LIBRARY
NAMES wayland-client libwayland-client
)
list(APPEND platform_INCLUDES
ui_interfaces/win32/Win32UIInterface.h
${WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp
)
)
if(NOT ${WAYLAND_EXTENSIONS_INCLUDE_DIR-NOTFOUND})
find_library(
WAYLAND_CLIENT_LIBRARY
NAMES wayland-client libwayland-client
)
list(APPEND WAYLAND_INCLUDE_DIRS ${WAYLAND_EXTENSIONS_INCLUDE_DIR})
list(APPEND platform_INCLUDES
ui_interfaces/wayland/WaylandWindowInterface.cpp
ui_interfaces/wayland/WaylandSurface.cpp
ui_interfaces/wayland/WaylandBuffer.cpp
${WAYLAND_EXTENSIONS_INCLUDE_DIR}/xdg-shell-protocol.cpp
)
set(_HAS_WAYLAND ON)
else()
message(STATUS "Wayland Extensions Header not found - not building Wayland support")
endif()
else()
list(APPEND platform_INCLUDES
ui_interfaces/win32/Win32UIInterface.h
ui_interfaces/win32/Win32UIInterface.cpp
ui_interfaces/win32/Win32WindowInterface.h
ui_interfaces/win32/Win32WindowInterface.cpp
ui_interfaces/win32/Win32Window.h
ui_interfaces/win32/Win32Window.cpp
)
list(APPEND platform_INCLUDES
ui_interfaces/win32/Win32UIInterface.h
ui_interfaces/win32/Win32UIInterface.cpp
ui_interfaces/win32/Win32WindowInterface.h
ui_interfaces/win32/Win32WindowInterface.cpp
ui_interfaces/win32/Win32Window.h
ui_interfaces/win32/Win32Window.cpp
)
endif()
set(HAS_WAYLAND ${_HAS_WAYLAND} CACHE BOOL "Can build with Wayland")
list(APPEND windows_LIB_INCLUDES
managers/WindowManager.cpp
managers/DesktopManager.cpp
@ -73,11 +82,10 @@ target_include_directories(windows PUBLIC
"${PROJECT_SOURCE_DIR}/src/graphics"
"${PROJECT_SOURCE_DIR}/src/ui_elements"
"${PROJECT_SOURCE_DIR}/src/ui_elements/widgets"
${WAYLAND_CLIENT_INCLUDE_DIR}
${WAYLAND_EXTENSIONS_INCLUDE_DIR}
${WAYLAND_INCLUDE_DIRS}
)
target_link_libraries(windows PUBLIC ${platform_LIBS} core geometry graphics ui_elements ${WAYLAND_CLIENT_LIBRARY})
set_property(TARGET windows PROPERTY FOLDER src)
set_target_properties( windows PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )
set_target_properties( windows PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON )