mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
CMake: Convert Makefile build to CMake
Find libraries using cmake/Find*.cmake scripts Replace Version String with CMake implementation based on CMake Version and git ref-parse. Compile manpages in man/CMakeLists.txt to build: cmake . make manpage Set debug and release versions with cmake -DCMAKE_BUILD_TYPE=Debug and cmake -DCMAKE_BUILD_TYPE=Release Build and install process can be: cmake -DCMAKE_BUILD_TYPE=Release . make make install More build options can be found with cmake . make help Codeblocks project can be generated using cmake -G "CodeBlocks - Unix Makefiles" .
This commit is contained in:
parent
8780b9c53c
commit
a5cc950192
4
.gitignore
vendored
4
.gitignore
vendored
@ -5,3 +5,7 @@ bin/*
|
|||||||
obj/*
|
obj/*
|
||||||
*.1
|
*.1
|
||||||
*.gz
|
*.gz
|
||||||
|
Makefile
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
cmake_install.cmake
|
||||||
|
115
CMakeLists.txt
Normal file
115
CMakeLists.txt
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||||
|
project (lgogdownloader LANGUAGES CXX VERSION 2.26)
|
||||||
|
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||||
|
|
||||||
|
find_package(Boost
|
||||||
|
REQUIRED
|
||||||
|
system
|
||||||
|
filesystem
|
||||||
|
regex
|
||||||
|
program_options
|
||||||
|
date_time
|
||||||
|
)
|
||||||
|
find_package(CURL REQUIRED)
|
||||||
|
find_package(OAuth REQUIRED)
|
||||||
|
find_package(Jsoncpp REQUIRED)
|
||||||
|
find_package(Htmlcxx REQUIRED)
|
||||||
|
find_package(Tinyxml REQUIRED)
|
||||||
|
find_package(Rhash REQUIRED)
|
||||||
|
|
||||||
|
file(GLOB SRC_FILES
|
||||||
|
main.cpp
|
||||||
|
src/api.cpp
|
||||||
|
src/downloader.cpp
|
||||||
|
src/progressbar.cpp
|
||||||
|
src/util.cpp
|
||||||
|
src/blacklist.cpp
|
||||||
|
src/gamefile.cpp
|
||||||
|
src/gamedetails.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(GIT_CHECKOUT FALSE)
|
||||||
|
if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
|
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
|
find_package(Git)
|
||||||
|
if(GIT_FOUND)
|
||||||
|
set(GIT_CHECKOUT TRUE)
|
||||||
|
else(GIT_FOUND)
|
||||||
|
message(WARNING "Git executable not found")
|
||||||
|
endif(GIT_FOUND)
|
||||||
|
else(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
|
message(STATUS "Shallow Git clone detected, not attempting to retrieve version info")
|
||||||
|
endif(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/shallow)
|
||||||
|
endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
|
||||||
|
|
||||||
|
if(GIT_CHECKOUT)
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} diff --shortstat
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_SHORTSTAT
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_REV_PARSE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if(GIT_SHORTSTAT)
|
||||||
|
set(GIT_DIRTY ON)
|
||||||
|
endif(GIT_SHORTSTAT)
|
||||||
|
|
||||||
|
if(GIT_DIRTY)
|
||||||
|
set(PROJECT_VERSION_MINOR ${PROJECT_VERSION_MINOR}M)
|
||||||
|
endif(GIT_DIRTY)
|
||||||
|
|
||||||
|
set(PROJECT_VERSION_PATCH ${GIT_REV_PARSE})
|
||||||
|
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
endif(GIT_CHECKOUT)
|
||||||
|
|
||||||
|
set(VERSION_NUMBER ${PROJECT_VERSION})
|
||||||
|
set(VERSION_STRING "LGOGDownloader ${VERSION_NUMBER}")
|
||||||
|
|
||||||
|
add_definitions(-D_FILE_OFFSET_BITS=64 -DVERSION_NUMBER="${VERSION_NUMBER}" -DVERSION_STRING="${VERSION_STRING}")
|
||||||
|
|
||||||
|
add_executable (${PROJECT_NAME} ${SRC_FILES})
|
||||||
|
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(${PROJECT_NAME}
|
||||||
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
PRIVATE ${Boost_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${CURL_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${OAuth_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${Jsoncpp_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${Htmlcxx_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${Tinyxml_INCLUDE_DIRS}
|
||||||
|
PRIVATE ${Rhash_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME}
|
||||||
|
PRIVATE ${Boost_LIBRARIES}
|
||||||
|
PRIVATE ${CURL_LIBRARIES}
|
||||||
|
PRIVATE ${OAuth_LIBRARIES}
|
||||||
|
PRIVATE ${Jsoncpp_LIBRARIES}
|
||||||
|
PRIVATE ${Htmlcxx_LIBRARIES}
|
||||||
|
PRIVATE ${Tinyxml_LIBRARIES}
|
||||||
|
PRIVATE ${Rhash_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# Force to always compile with W4
|
||||||
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
||||||
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||||
|
else()
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
||||||
|
endif()
|
||||||
|
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
# Update if necessary
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic -fexceptions")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
|
||||||
|
set(INSTALL_SHARE_DIR share CACHE PATH "Installation directory for resource files")
|
||||||
|
|
||||||
|
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX} DESTINATION ${INSTALL_BIN_DIR})
|
||||||
|
add_subdirectory(man)
|
180
Makefile
180
Makefile
@ -1,180 +0,0 @@
|
|||||||
#------------------------------------------------------------------------------#
|
|
||||||
# This makefile was generated by 'cbp2make' tool rev.127 #
|
|
||||||
#------------------------------------------------------------------------------#
|
|
||||||
|
|
||||||
|
|
||||||
WORKDIR = `pwd`
|
|
||||||
|
|
||||||
DESTDIR =
|
|
||||||
PREFIX = /usr
|
|
||||||
MANPREFIX = $(PREFIX)/share
|
|
||||||
|
|
||||||
CC = gcc
|
|
||||||
CXX = g++
|
|
||||||
AR = ar
|
|
||||||
LD = g++
|
|
||||||
WINDRES = windres
|
|
||||||
|
|
||||||
INC = -Iinclude -I/usr/include/rhash -I/usr/include/jsoncpp
|
|
||||||
CFLAGS = -std=c++11 -Wall -fexceptions -D_FILE_OFFSET_BITS=64
|
|
||||||
RESINC =
|
|
||||||
LIBDIR =
|
|
||||||
LIB = -lcurl -loauth -ljsoncpp -lhtmlcxx -lboost_system -lboost_filesystem -lboost_regex -lboost_program_options -lboost_date_time -ltinyxml -lrhash
|
|
||||||
LDFLAGS =
|
|
||||||
|
|
||||||
VERSION = -DVERSION_STRING="\"$(shell sh version.sh)\""
|
|
||||||
HELP2MAN = $(shell which help2man 2> /dev/null)
|
|
||||||
MAN_DIR = man
|
|
||||||
MAN_PAGE = lgogdownloader.1
|
|
||||||
|
|
||||||
INC_DEBUG = $(INC)
|
|
||||||
CFLAGS_DEBUG = $(CFLAGS) -g -DDEBUG
|
|
||||||
RESINC_DEBUG = $(RESINC)
|
|
||||||
RCFLAGS_DEBUG = $(RCFLAGS)
|
|
||||||
LIBDIR_DEBUG = $(LIBDIR)
|
|
||||||
LIB_DEBUG = $(LIB)
|
|
||||||
LDFLAGS_DEBUG = $(LDFLAGS)
|
|
||||||
OBJDIR_DEBUG = obj/Debug
|
|
||||||
DEP_DEBUG =
|
|
||||||
OUT_DEBUG = bin/Debug/lgogdownloader
|
|
||||||
|
|
||||||
INC_RELEASE = $(INC)
|
|
||||||
CFLAGS_RELEASE = $(CFLAGS) -O2
|
|
||||||
RESINC_RELEASE = $(RESINC)
|
|
||||||
RCFLAGS_RELEASE = $(RCFLAGS)
|
|
||||||
LIBDIR_RELEASE = $(LIBDIR)
|
|
||||||
LIB_RELEASE = $(LIB)
|
|
||||||
LDFLAGS_RELEASE = $(LDFLAGS) -s
|
|
||||||
OBJDIR_RELEASE = obj/Release
|
|
||||||
DEP_RELEASE =
|
|
||||||
OUT_RELEASE = bin/Release/lgogdownloader
|
|
||||||
|
|
||||||
OBJ_DEBUG = $(OBJDIR_DEBUG)/main.o $(OBJDIR_DEBUG)/src/api.o $(OBJDIR_DEBUG)/src/downloader.o $(OBJDIR_DEBUG)/src/progressbar.o $(OBJDIR_DEBUG)/src/util.o $(OBJDIR_DEBUG)/src/blacklist.o $(OBJDIR_DEBUG)/src/gamedetails.o $(OBJDIR_DEBUG)/src/gamefile.o
|
|
||||||
|
|
||||||
OBJ_RELEASE = $(OBJDIR_RELEASE)/main.o $(OBJDIR_RELEASE)/src/api.o $(OBJDIR_RELEASE)/src/downloader.o $(OBJDIR_RELEASE)/src/progressbar.o $(OBJDIR_RELEASE)/src/util.o $(OBJDIR_RELEASE)/src/blacklist.o $(OBJDIR_RELEASE)/src/gamedetails.o $(OBJDIR_RELEASE)/src/gamefile.o
|
|
||||||
|
|
||||||
all: debug release
|
|
||||||
|
|
||||||
clean: clean_debug clean_release
|
|
||||||
|
|
||||||
before_debug:
|
|
||||||
test -d bin/Debug || mkdir -p bin/Debug
|
|
||||||
test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG)
|
|
||||||
test -d $(OBJDIR_DEBUG)/src || mkdir -p $(OBJDIR_DEBUG)/src
|
|
||||||
|
|
||||||
after_debug: out_debug
|
|
||||||
ifdef HELP2MAN
|
|
||||||
if ! test -f $(MAN_DIR)/$(MAN_PAGE).gz; then \
|
|
||||||
help2man -N -i $(MAN_DIR)/lgogdownloader.supplemental.groff -o $(MAN_DIR)/$(MAN_PAGE) $(OUT_DEBUG); \
|
|
||||||
gzip -f -9 $(MAN_DIR)/$(MAN_PAGE); \
|
|
||||||
fi
|
|
||||||
endif
|
|
||||||
|
|
||||||
debug: before_debug out_debug after_debug
|
|
||||||
|
|
||||||
out_debug: $(OBJ_DEBUG) $(DEP_DEBUG)
|
|
||||||
$(LD) $(LDFLAGS_DEBUG) $(LIBDIR_DEBUG) $(OBJ_DEBUG) $(LIB_DEBUG) -o $(OUT_DEBUG)
|
|
||||||
|
|
||||||
$(OBJ_DEBUG): | before_debug
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/main.o: main.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(VERSION) $(INC_DEBUG) -c main.cpp -o $(OBJDIR_DEBUG)/main.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/api.o: src/api.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/api.cpp -o $(OBJDIR_DEBUG)/src/api.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/downloader.o: src/downloader.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/downloader.cpp -o $(OBJDIR_DEBUG)/src/downloader.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/progressbar.o: src/progressbar.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/progressbar.cpp -o $(OBJDIR_DEBUG)/src/progressbar.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/util.o: src/util.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/util.cpp -o $(OBJDIR_DEBUG)/src/util.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/blacklist.o: src/blacklist.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/blacklist.cpp -o $(OBJDIR_DEBUG)/src/blacklist.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/gamefile.o: src/gamefile.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/gamefile.cpp -o $(OBJDIR_DEBUG)/src/gamefile.o
|
|
||||||
|
|
||||||
$(OBJDIR_DEBUG)/src/gamedetails.o: src/gamedetails.cpp
|
|
||||||
$(CXX) $(CFLAGS_DEBUG) $(INC_DEBUG) -c src/gamedetails.cpp -o $(OBJDIR_DEBUG)/src/gamedetails.o
|
|
||||||
|
|
||||||
clean_debug:
|
|
||||||
rm -f $(OBJ_DEBUG) $(OUT_DEBUG)
|
|
||||||
rm -rf bin/Debug
|
|
||||||
rm -rf $(OBJDIR_DEBUG)
|
|
||||||
rm -rf $(OBJDIR_DEBUG)/src
|
|
||||||
|
|
||||||
before_release:
|
|
||||||
test -d bin/Release || mkdir -p bin/Release
|
|
||||||
test -d $(OBJDIR_RELEASE) || mkdir -p $(OBJDIR_RELEASE)
|
|
||||||
test -d $(OBJDIR_RELEASE)/src || mkdir -p $(OBJDIR_RELEASE)/src
|
|
||||||
|
|
||||||
after_release: out_release
|
|
||||||
ifdef HELP2MAN
|
|
||||||
if ! test -f $(MAN_DIR)/$(MAN_PAGE).gz; then \
|
|
||||||
help2man -N -i $(MAN_DIR)/lgogdownloader.supplemental.groff -o $(MAN_DIR)/$(MAN_PAGE) $(OUT_RELEASE); \
|
|
||||||
gzip -f -9 $(MAN_DIR)/$(MAN_PAGE); \
|
|
||||||
fi
|
|
||||||
endif
|
|
||||||
|
|
||||||
release: before_release out_release after_release
|
|
||||||
|
|
||||||
out_release: $(OBJ_RELEASE) $(DEP_RELEASE)
|
|
||||||
$(LD) $(LDFLAGS_RELEASE) $(LIBDIR_RELEASE) $(OBJ_RELEASE) $(LIB_RELEASE) -o $(OUT_RELEASE)
|
|
||||||
|
|
||||||
$(OBJ_RELEASE): | before_release
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/main.o: main.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(VERSION) $(INC_RELEASE) -c main.cpp -o $(OBJDIR_RELEASE)/main.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/api.o: src/api.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/api.cpp -o $(OBJDIR_RELEASE)/src/api.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/downloader.o: src/downloader.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/downloader.cpp -o $(OBJDIR_RELEASE)/src/downloader.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/progressbar.o: src/progressbar.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/progressbar.cpp -o $(OBJDIR_RELEASE)/src/progressbar.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/util.o: src/util.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/util.cpp -o $(OBJDIR_RELEASE)/src/util.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/blacklist.o: src/blacklist.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/blacklist.cpp -o $(OBJDIR_RELEASE)/src/blacklist.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/gamefile.o: src/gamefile.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/gamefile.cpp -o $(OBJDIR_RELEASE)/src/gamefile.o
|
|
||||||
|
|
||||||
$(OBJDIR_RELEASE)/src/gamedetails.o: src/gamedetails.cpp
|
|
||||||
$(CXX) $(CFLAGS_RELEASE) $(INC_RELEASE) -c src/gamedetails.cpp -o $(OBJDIR_RELEASE)/src/gamedetails.o
|
|
||||||
|
|
||||||
clean_release:
|
|
||||||
rm -f $(OBJ_RELEASE) $(OUT_RELEASE)
|
|
||||||
rm -rf bin/Release
|
|
||||||
rm -rf $(OBJDIR_RELEASE)
|
|
||||||
rm -rf $(OBJDIR_RELEASE)/src
|
|
||||||
rm -f $(MAN_DIR)/$(MAN_PAGE) $(MAN_DIR)/$(MAN_PAGE).gz
|
|
||||||
|
|
||||||
install: release
|
|
||||||
install -d $(DESTDIR)/$(PREFIX)/bin/
|
|
||||||
if test -f $(OUT_DEBUG); then \
|
|
||||||
install -m 755 $(OUT_DEBUG) $(DESTDIR)/$(PREFIX)/bin/lgogdownloader; \
|
|
||||||
else \
|
|
||||||
install -m 755 $(OUT_RELEASE) $(DESTDIR)/$(PREFIX)/bin/lgogdownloader; \
|
|
||||||
fi
|
|
||||||
if test -f $(MAN_DIR)/$(MAN_PAGE).gz; then \
|
|
||||||
install -d $(DESTDIR)/$(MANPREFIX)/man/man1/; \
|
|
||||||
install -m 644 $(MAN_DIR)/$(MAN_PAGE).gz $(DESTDIR)/$(MANPREFIX)/man/man1/$(MAN_PAGE).gz; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm $(DESTDIR)/$(PREFIX)/bin/lgogdownloader
|
|
||||||
if test -f $(DESTDIR)/$(MANPREFIX)/man/man1/$(MAN_PAGE).gz; then \
|
|
||||||
rm $(DESTDIR)/$(MANPREFIX)/man/man1/$(MAN_PAGE).gz; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
.PHONY: before_debug after_debug clean_debug before_release after_release clean_release
|
|
||||||
|
|
54
cmake/FindHtmlcxx.cmake
Normal file
54
cmake/FindHtmlcxx.cmake
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# - Try to find htmlcxx
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
# Htmlcxx_FOUND - System has htmlcxx
|
||||||
|
# Htmlcxx_INCLUDE_DIRS - The htmlcxx include directories
|
||||||
|
# Htmlcxx_LIBRARIES - The libraries needed to use htmlcxx
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_HTMLCXX REQUIRED htmlcxx)
|
||||||
|
|
||||||
|
find_path(HTMLCXX_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
css/parser.h
|
||||||
|
html/tree.h
|
||||||
|
HINTS
|
||||||
|
${PC_HTMLCXX_INCLUDEDIR}
|
||||||
|
${PC_HTMLCXX_INCLUDE_DIRS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
htmlcxx
|
||||||
|
PATHS
|
||||||
|
${PC_HTMLCXX_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(HTMLCXX_LIBRARY_HTMLCXX htmlcxx
|
||||||
|
HINTS
|
||||||
|
${PC_HTMLCXX_LIBDIR}
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
PATHS
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(HTMLCXX_LIBRARY_CSS_PARSER css_parser
|
||||||
|
HINTS
|
||||||
|
${PC_HTMLCXX_LIBDIR}
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
PATHS
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(HTMLCXX_LIBRARY_CSS_PARSER_PP css_parser_pp
|
||||||
|
HINTS
|
||||||
|
${PC_HTMLCXX_LIBDIR}
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
PATHS
|
||||||
|
${PC_HTMLCXX_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(HTMLCXX_INCLUDE_DIR HTMLCXX_LIBRARY_HTMLCXX HTMLCXX_LIBRARY_CSS_PARSER HTMLCXX_LIBRARY_CSS_PARSER_PP)
|
||||||
|
|
||||||
|
if(PC_HTMLCXX_FOUND)
|
||||||
|
set(Htmlcxx_FOUND ON)
|
||||||
|
set(Htmlcxx_INCLUDE_DIRS ${HTMLCXX_INCLUDE_DIR})
|
||||||
|
set(Htmlcxx_LIBRARIES ${HTMLCXX_LIBRARY_HTMLCXX} ${HTMLCXX_LIBRARY_CSS_PARSER} ${HTMLCXX_LIBRARY_CSS_PARSER_PP})
|
||||||
|
endif(PC_HTMLCXX_FOUND)
|
34
cmake/FindJsoncpp.cmake
Normal file
34
cmake/FindJsoncpp.cmake
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# - Try to find Jsoncpp
|
||||||
|
#
|
||||||
|
# Once done, this will define
|
||||||
|
# Jsoncpp_FOUND - system has Jsoncpp
|
||||||
|
# Jsoncpp_INCLUDE_DIRS - the Jsoncpp include directories
|
||||||
|
# Jsoncpp_LIBRARIES - link these to use Jsoncpp
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_JSONCPP REQUIRED jsoncpp)
|
||||||
|
|
||||||
|
find_path(JSONCPP_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
json/features.h
|
||||||
|
HINTS
|
||||||
|
${PC_JSONCPP_INCLUDEDIR}
|
||||||
|
${PC_JSONCPP_INCLUDEDIRS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
jsoncpp
|
||||||
|
PATHS
|
||||||
|
${PC_JSONCPP_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(JSONCPP_LIBRARY jsoncpp
|
||||||
|
PATHS
|
||||||
|
${PC_JSONCPP_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(JSONCPP_INCLUDE_DIR JSONCPP_LIBRARY)
|
||||||
|
|
||||||
|
if(PC_JSONCPP_FOUND)
|
||||||
|
set(Jsoncpp_FOUND ON)
|
||||||
|
set(Jsoncpp_INCLUDE_DIRS ${JSONCPP_INCLUDE_DIR})
|
||||||
|
set(Jsoncpp_LIBRARIES ${JSONCPP_LIBRARY})
|
||||||
|
endif(PC_JSONCPP_FOUND)
|
28
cmake/FindOAuth.cmake
Normal file
28
cmake/FindOAuth.cmake
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# - Try to find oauth
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
# OAuth_FOUND - System has oauth
|
||||||
|
# OAuth_INCLUDE_DIRS - The oauth include directories
|
||||||
|
# OAuth_LIBRARIES - The libraries needed to use oauth
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_OAUTH REQUIRED oauth)
|
||||||
|
|
||||||
|
find_path(OAUTH_INCLUDE_DIR oauth.h
|
||||||
|
HINTS ${PC_OAUTH_INCLUDEDIR}
|
||||||
|
${PC_OAUTH_INCLUDE_DIRS}
|
||||||
|
PATH_SUFFIXES oauth
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(OAUTH_LIBRARY NAMES oauth
|
||||||
|
HINTS ${PC_OAUTH_LIBDIR}
|
||||||
|
${PC_OAUTH_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(OAUTH_INCLUDE_DIR OAUTH_LIBRARY)
|
||||||
|
|
||||||
|
if(PC_OAUTH_FOUND)
|
||||||
|
set(OAuth_FOUND ON)
|
||||||
|
set(OAuth_INCLUDE_DIRS ${OAUTH_INCLUDE_DIR})
|
||||||
|
set(OAuth_LIBRARIES ${OAUTH_LIBRARY})
|
||||||
|
endif(PC_OAUTH_FOUND)
|
22
cmake/FindRhash.cmake
Normal file
22
cmake/FindRhash.cmake
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# - Try to find rhash
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
# Rhash_FOUND - System has rhash
|
||||||
|
# Rhash_INCLUDE_DIRS - The rhash include directories
|
||||||
|
# Rhash_LIBRARIES - The libraries needed to use rhash
|
||||||
|
|
||||||
|
find_path(RHASH_INCLUDE_DIR rhash.h)
|
||||||
|
find_library(RHASH_LIBRARY rhash)
|
||||||
|
|
||||||
|
mark_as_advanced(RHASH_INCLUDE_DIR RHASH_LIBRARY)
|
||||||
|
|
||||||
|
if(RHASH_LIBRARY AND RHASH_INCLUDE_DIR)
|
||||||
|
set(Rhash_FOUND ON)
|
||||||
|
set(Rhash_LIBRARIES ${RHASH_LIBRARY})
|
||||||
|
set(Rhash_INCLUDE_DIRS ${RHASH_INCLUDE_DIR})
|
||||||
|
else()
|
||||||
|
set(Rhash_FOUND OFF)
|
||||||
|
if(Rhash_FIND_REQUIRED)
|
||||||
|
message(FATAL_ERROR "Could not find rhash")
|
||||||
|
endif(Rhash_FIND_REQUIRED)
|
||||||
|
endif(RHASH_LIBRARY AND RHASH_INCLUDE_DIR)
|
33
cmake/FindTinyxml.cmake
Normal file
33
cmake/FindTinyxml.cmake
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# - Try to find tinyxml
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
# Tinyxml_FOUND - System has tinyxml
|
||||||
|
# Tinyxml_INCLUDE_DIRS - The tinyxml include directories
|
||||||
|
# Tinyxml_LIBRARIES - The libraries needed to use tinyxml
|
||||||
|
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(PC_TINYXML REQUIRED tinyxml)
|
||||||
|
|
||||||
|
find_path(TINYXML_INCLUDE_DIR tinyxml.h
|
||||||
|
HINTS
|
||||||
|
${PC_TINYXML_INCLUDEDIR}
|
||||||
|
${PC_TINYXML_INCLUDE_DIRS}
|
||||||
|
PATHS
|
||||||
|
${PC_TINYXML_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(TINYXML_LIBRARY tinyxml
|
||||||
|
HINTS
|
||||||
|
${PC_TINYXML_LIBDIR}
|
||||||
|
${PC_TINYXML_LIBRARY_DIRS}
|
||||||
|
PATHS
|
||||||
|
${PC_TINYXML_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARY)
|
||||||
|
|
||||||
|
if(PC_TINYXML_FOUND)
|
||||||
|
set(Tinyxml_FOUND ON)
|
||||||
|
set(Tinyxml_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})
|
||||||
|
set(Tinyxml_LIBRARIES ${TINYXML_LIBRARY})
|
||||||
|
endif(PC_TINYXML_FOUND)
|
@ -1,76 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
||||||
<CodeBlocks_project_file>
|
|
||||||
<FileVersion major="1" minor="6" />
|
|
||||||
<Project>
|
|
||||||
<Option title="lgogdownloader" />
|
|
||||||
<Option pch_mode="2" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Build>
|
|
||||||
<Target title="Debug">
|
|
||||||
<Option output="bin/Debug/lgogdownloader" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Debug/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-g" />
|
|
||||||
<Add option="-DDEBUG" />
|
|
||||||
<Add directory="include" />
|
|
||||||
</Compiler>
|
|
||||||
</Target>
|
|
||||||
<Target title="Release">
|
|
||||||
<Option output="bin/Release/lgogdownloader" prefix_auto="1" extension_auto="1" />
|
|
||||||
<Option object_output="obj/Release/" />
|
|
||||||
<Option type="1" />
|
|
||||||
<Option compiler="gcc" />
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-O2" />
|
|
||||||
<Add directory="include" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add option="-s" />
|
|
||||||
</Linker>
|
|
||||||
</Target>
|
|
||||||
</Build>
|
|
||||||
<Compiler>
|
|
||||||
<Add option="-std=c++0x" />
|
|
||||||
<Add option="-Wall" />
|
|
||||||
<Add option="-fexceptions" />
|
|
||||||
<Add directory="include" />
|
|
||||||
</Compiler>
|
|
||||||
<Linker>
|
|
||||||
<Add library="curl" />
|
|
||||||
<Add library="oauth" />
|
|
||||||
<Add library="jsoncpp" />
|
|
||||||
<Add library="htmlcxx" />
|
|
||||||
<Add library="boost_system" />
|
|
||||||
<Add library="boost_filesystem" />
|
|
||||||
<Add library="boost_regex" />
|
|
||||||
<Add library="boost_program_options" />
|
|
||||||
<Add library="boost_date_time" />
|
|
||||||
<Add library="tinyxml" />
|
|
||||||
<Add library="rhash" />
|
|
||||||
</Linker>
|
|
||||||
<Unit filename="include/api.h" />
|
|
||||||
<Unit filename="include/blacklist.h" />
|
|
||||||
<Unit filename="include/config.h" />
|
|
||||||
<Unit filename="include/downloader.h" />
|
|
||||||
<Unit filename="include/gamedetails.h" />
|
|
||||||
<Unit filename="include/gamefile.h" />
|
|
||||||
<Unit filename="include/globalconstants.h" />
|
|
||||||
<Unit filename="include/progressbar.h" />
|
|
||||||
<Unit filename="include/util.h" />
|
|
||||||
<Unit filename="main.cpp" />
|
|
||||||
<Unit filename="src/api.cpp" />
|
|
||||||
<Unit filename="src/blacklist.cpp" />
|
|
||||||
<Unit filename="src/downloader.cpp" />
|
|
||||||
<Unit filename="src/gamedetails.cpp" />
|
|
||||||
<Unit filename="src/gamefile.cpp" />
|
|
||||||
<Unit filename="src/progressbar.cpp" />
|
|
||||||
<Unit filename="src/util.cpp" />
|
|
||||||
<Extensions>
|
|
||||||
<code_completion />
|
|
||||||
<debugger />
|
|
||||||
<envvars />
|
|
||||||
</Extensions>
|
|
||||||
</Project>
|
|
||||||
</CodeBlocks_project_file>
|
|
6
main.cpp
6
main.cpp
@ -13,12 +13,6 @@
|
|||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
|
|
||||||
#define VERSION_NUMBER "2.26"
|
|
||||||
|
|
||||||
#ifndef VERSION_STRING
|
|
||||||
# define VERSION_STRING "LGOGDownloader " VERSION_NUMBER
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace bpo = boost::program_options;
|
namespace bpo = boost::program_options;
|
||||||
|
|
||||||
template<typename T> void set_vm_value(std::map<std::string, bpo::variable_value>& vm, const std::string& option, const T& value)
|
template<typename T> void set_vm_value(std::map<std::string, bpo::variable_value>& vm, const std::string& option, const T& value)
|
||||||
|
22
man/CMakeLists.txt
Normal file
22
man/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
find_program(HELP2MAN help2man DOC "Location of the help2man program")
|
||||||
|
find_program(GZIP gzip DOC "Location of the gzip program")
|
||||||
|
mark_as_advanced(HELP2MAN)
|
||||||
|
mark_as_advanced(GZIP)
|
||||||
|
|
||||||
|
if(HELP2MAN AND GZIP)
|
||||||
|
set(H2M_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.supplemental.groff)
|
||||||
|
set(MAN_PAGE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1)
|
||||||
|
set(MAN_FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.1.gz)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${MAN_FILE}
|
||||||
|
COMMAND ${HELP2MAN} -N -i ${H2M_FILE} -o ${MAN_PAGE} ${PROJECT_BINARY_DIR}/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}
|
||||||
|
COMMAND ${GZIP} -f -9 ${MAN_PAGE}
|
||||||
|
MAIN_DEPENDENCY ${H2M_FILE}
|
||||||
|
COMMENT "Building man page"
|
||||||
|
VERBATIM
|
||||||
|
)
|
||||||
|
add_custom_target(manpage ALL DEPENDS ${MAN_FILE} ${PROJECT_NAME})
|
||||||
|
install(FILES ${MAN_FILE} DESTINATION ${INSTALL_SHARE_DIR}/man/man1)
|
||||||
|
else(HELP2MAN AND GZIP)
|
||||||
|
message("WARNING: One of the following is missing: help2man, gzip; man page will not be generated")
|
||||||
|
endif(HELP2MAN AND GZIP)
|
@ -1,9 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
version="LGOGDownloader `grep VERSION_NUMBER < main.cpp | head -n 1 | sed -e 's/.*\([0-9]\+\.[0-9]\+\).*/\1/'`"
|
|
||||||
if [ -e .git/HEAD ]; then
|
|
||||||
if git status | grep -q 'modified:'; then
|
|
||||||
version="${version}M"
|
|
||||||
fi
|
|
||||||
version="$version git `git rev-parse --short HEAD`"
|
|
||||||
fi
|
|
||||||
echo "$version"
|
|
Loading…
Reference in New Issue
Block a user