diff options
author | ConfuSomu | 2024-05-11 18:52:28 -0400 |
---|---|---|
committer | ConfuSomu | 2024-05-11 18:52:28 -0400 |
commit | 56f47656debf847afd5905c2ebed712c54508f4b (patch) | |
tree | 1bf0da0f3bf51f56c9a4be53c00029d16f3a8c31 | |
parent | 7024480b84ec1ef7ba4d371a51511bd04c48e816 (diff) | |
download | ActorViewer-56f47656debf847afd5905c2ebed712c54508f4b.tar ActorViewer-56f47656debf847afd5905c2ebed712c54508f4b.tar.gz ActorViewer-56f47656debf847afd5905c2ebed712c54508f4b.zip |
Use mastodonpp library as a submodule
This simplifies dependency management and allows compiling mastodonpp
and the rest of the program in one step.
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 15 | ||||
m--------- | lib/mastodonpp | 0 |
3 files changed, 13 insertions, 5 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0361d24 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/mastodonpp"] + path = lib/mastodonpp + url = https://git.twilightsparkle.space/mastodonpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 32b6490..e95c601 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,6 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Concurrent) # Compile option for mastodonpp support option(MASTODONPP_BUILD "Build a version with mastodonpp support" ON) -if(MASTODONPP_BUILD) - find_package(mastodonpp REQUIRED) -endif() - # Get Git commit hash, from http://xit0.org/2013/04/cmake-use-git-branch-and-commit-details-in-project/ # Get a human-readable name of the latest commit on the current branch execute_process( @@ -133,13 +129,22 @@ else() endif() if(MASTODONPP_BUILD) + # Set build options for mastodonpp + # See https://stackoverflow.com/a/20239564 + set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "") + + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/mastodonpp EXCLUDE_FROM_ALL) + # -fsanitize=undefined is required for linking, as else you get undefined symbols + target_link_libraries(ActorViewer PRIVATE mastodonpp -fsanitize=undefined) + + # Define preprocessor macro MASTODONPP_BUILD target_compile_definitions(ActorViewer PRIVATE MASTODONPP_BUILD) endif() configure_file(gen/git_version.h.in gen/git_version.h) target_include_directories(ActorViewer PRIVATE gen) -target_link_libraries(ActorViewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets mastodonpp) +target_link_libraries(ActorViewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) set_target_properties(ActorViewer PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER space.twilightsparkle.ActorViewer diff --git a/lib/mastodonpp b/lib/mastodonpp new file mode 160000 +Subproject c48f1dc3d0566cef2baf96df7b3a7c55490a3e9 |