view CMakeLists.txt @ 89:e6fab256ddc4

dialog/info: make some stuff more sane
author Paper <mrpapersonic@gmail.com>
date Tue, 31 Oct 2023 23:06:33 -0400
parents 8b65c417c225
children c4bb49c2f6eb
line wrap: on
line source

cmake_minimum_required(VERSION 3.16)
project(minori LANGUAGES CXX)

# this should check for the target system, rather than
# the host system, for cross-compiling purposes
if(APPLE)
	enable_language(OBJCXX)
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
option(USE_QT6 "Build with Qt 6 instead of Qt 5" OFF)

add_subdirectory(dep/anitomy)
add_subdirectory(dep/animia)
add_subdirectory(dep/pugixml)

# Fix for mingw64
list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")

if(USE_QT6)
	find_package(Qt6 COMPONENTS Widgets REQUIRED)
else()
	find_package(Qt5 COMPONENTS Widgets REQUIRED)
endif()
find_package(CURL REQUIRED)

set(LIBRARIES
	${CURL_LIBRARIES}
	anitomy
	animia
)

if(USE_QT6)
	list(APPEND LIBRARIES ${Qt6Widgets_LIBRARIES})
else()
	list(APPEND LIBRARIES ${Qt5Widgets_LIBRARIES})
endif()

# We need Cocoa for some OS X stuff
if(APPLE)
	find_library(COCOA_LIBRARY Cocoa)
	list(APPEND LIBRARIES ${COCOA_LIBRARY})
endif()

set(SRC_FILES
	# Main entrypoint
	src/main.cc

	# Core files and datatype declarations...
	src/core/anime.cc
	src/core/anime_db.cc
	src/core/config.cc
	src/core/date.cc
	src/core/filesystem.cc
	src/core/http.cc
	src/core/json.cc
	src/core/strings.cc
	src/core/time.cc

	# Main window
	src/gui/window.cc
	src/gui/dark_theme.cc

	# Main window pages
	src/gui/pages/anime_list.cc
	src/gui/pages/now_playing.cc
	src/gui/pages/statistics.cc
	src/gui/pages/search.cc
	src/gui/pages/seasons.cc
	src/gui/pages/torrents.cc
	src/gui/pages/history.cc


	# Custom widgets
	src/gui/widgets/anime_info.cc
	src/gui/widgets/poster.cc
	src/gui/widgets/clickable_label.cc
	src/gui/widgets/sidebar.cc
	src/gui/widgets/text.cc
	src/gui/widgets/optional_date.cc

	# Dialogs
	src/gui/dialog/about.cc
	src/gui/dialog/information.cc
	src/gui/dialog/settings.cc
	src/gui/dialog/settings/application.cc
	src/gui/dialog/settings/services.cc

	# Translate
	src/gui/translate/anime.cc
	src/gui/translate/anilist.cc

	# Services (only AniList for now)
	src/services/services.cc
	src/services/anilist.cc

	# Tracking
	src/track/constants.cc
	src/track/media.cc

	# Qt resources
	rc/icons.qrc
	dep/darkstyle/darkstyle.qrc
)

if(APPLE) # Mac OS X (or OS X (or macOS))
	list(APPEND SRC_FILES
		src/sys/osx/dark_theme.mm
		src/sys/osx/filesystem.mm
	)
elseif(WIN32) # Windows
	list(APPEND SRC_FILES src/sys/win32/dark_theme.cc)
endif()

add_executable(minori ${SRC_FILES})
set_property(TARGET minori PROPERTY CXX_STANDARD 11)
set_property(TARGET minori PROPERTY AUTOMOC ON)
set_property(TARGET minori PROPERTY AUTORCC ON)

target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE include dep/pugixml/src dep/animia/include dep/anitomy)
if(USE_QT6)
	target_include_directories(minori PUBLIC ${Qt6Widgets_INCLUDE_DIRS})
else()
	target_include_directories(minori PUBLIC ${Qt5Widgets_INCLUDE_DIRS})
endif()
target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast)
if(APPLE)
	target_compile_definitions(minori PUBLIC MACOSX)
elseif(WIN32)
	target_compile_definitions(minori PUBLIC WIN32)
endif()
target_link_libraries(minori ${LIBRARIES})