mirror of
https://github.com/CorsixTH/CorsixTH.git
synced 2025-07-23 04:13:01 +02:00
Cmakelists.txt and docs cleanup
This commit is contained in:
@@ -1,24 +1,58 @@
|
||||
# Find doxygen.
|
||||
find_package(Doxygen)
|
||||
|
||||
# Generate build targets and the doc/index.html file.
|
||||
if(DOXYGEN_FOUND OR LUA_PROGRAM_FOUND)
|
||||
add_custom_target(doc)
|
||||
# Find Lua
|
||||
if(WITH_LUAJIT)
|
||||
set(LUA_PROGRAM_NAMES luajit-2.0.3 luajit)
|
||||
else()
|
||||
message("Cannot locate Doxygen or lua, 'doc' target is not available")
|
||||
set(LUA_PROGRAM_NAMES lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua)
|
||||
endif()
|
||||
|
||||
# Add sub-targets of the 'doc' target.
|
||||
if(DOXYGEN_FOUND)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxyGen/animview.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/animview.doxygen @ONLY)
|
||||
find_program(LUA_PROGRAM_PATH ${LUA_PROGRAM_NAMES}
|
||||
PATHS
|
||||
ENV LUA_DIR
|
||||
/opt
|
||||
/opt/local
|
||||
~
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
)
|
||||
|
||||
add_custom_target(doc_animview
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/animview.doxygen
|
||||
# Find Doxygen.
|
||||
find_package(Doxygen)
|
||||
|
||||
if(DOXYGEN_FOUND OR LUA_PROGRAM_PATH)
|
||||
add_custom_target(doc)
|
||||
# Add sub-targets of the 'doc' target.
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<!DOCTYPE html>\n<html>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<head><title>CorsixTH source code documentation</title></head>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<body>\n<h1>CorsixTH main program source code documentation</h1>\n<ul>\n")
|
||||
else()
|
||||
message("Cannot locate Doxygen or Lua, 'doc' target is not available")
|
||||
endif()
|
||||
|
||||
if(LUA_PROGRAM_PATH)
|
||||
add_custom_target(doc_corsixth_lua
|
||||
${LUA_PROGRAM_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/main.lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/corner_right.gif ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/logo.png ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/main.css ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
|
||||
COMMENT "Generating API documentation for AnimView" VERBATIM
|
||||
COMMENT "Generating API documentation for corsixth_lua" VERBATIM
|
||||
)
|
||||
add_dependencies(doc doc_animview)
|
||||
add_dependencies(doc doc_corsixth_lua)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<li><a href='corsixth_lua/index.html'>CorsixTH Lua documentation</a>\n")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxyGen/corsixth_engine.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/corsixth_engine.doxygen @ONLY)
|
||||
|
||||
add_custom_target(doc_corsixth_engine
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/corsixth_engine.doxygen
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
|
||||
COMMENT "Generating API documentation for corsixth_engine" VERBATIM
|
||||
)
|
||||
add_dependencies(doc doc_corsixth_engine)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<li><a href='corsixth_engine/html/index.html'>CorsixTH engine documentation</a>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</ul>\n<h1>CorsixTH helper programs source code documentation</h1>\n<ul>\n")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxyGen/leveledit.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/leveledit.doxygen @ONLY)
|
||||
@@ -29,57 +63,20 @@ if(DOXYGEN_FOUND)
|
||||
COMMENT "Generating API documentation for LevelEdit" VERBATIM
|
||||
)
|
||||
add_dependencies(doc doc_leveledit)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<li><a href='leveledit/html/index.html'>Level editor documentation</a>\n")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxyGen/corsixth_engine.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/corsixth_engine.doxygen @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/DoxyGen/animview.doxygen.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/animview.doxygen @ONLY)
|
||||
|
||||
add_custom_target(doc_corsixth_engine
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/corsixth_engine.doxygen
|
||||
add_custom_target(doc_animview
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/DoxyGen/animview.doxygen
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
|
||||
COMMENT "Generating API documentation for corsixth_engine" VERBATIM
|
||||
COMMENT "Generating API documentation for AnimView" VERBATIM
|
||||
)
|
||||
add_dependencies(doc doc_corsixth_engine)
|
||||
add_dependencies(doc doc_animview)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<li><a href='animview/html/index.html'>Animation viewer documentation</a>\n")
|
||||
endif()
|
||||
|
||||
if(LUA_PROGRAM_FOUND)
|
||||
add_custom_target(doc_corsixth_lua
|
||||
${LUA_PROGRAM_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/main.lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/corner_right.gif ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/logo.png ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/LDocGen/output/main.css ${CMAKE_CURRENT_BINARY_DIR}/doc/corsixth_lua
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
|
||||
COMMENT "Generating API documentation for corsixth_lua" VERBATIM
|
||||
)
|
||||
add_dependencies(doc doc_corsixth_lua)
|
||||
endif()
|
||||
|
||||
# Generate doc/index.html file.
|
||||
if(DOXYGEN_FOUND OR LUA_PROGRAM_FOUND)
|
||||
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<html>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<head><title>CorsixTH source code documentation</title></head>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<body>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<h1>CorsixTH main program source code documentation</h1>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<ul>\n")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html " <li><a href=\"corsixth_engine/html/index.html\">CorsixTH engine documentation</a>\n")
|
||||
endif()
|
||||
|
||||
if(LUA_PROGRAM_FOUND)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html " <li><a href=\"corsixth_lua/index.html\">CorsixTH Lua documentation</a>\n")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</ul>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<h1>CorsixTH helper programs source code documentation</h1>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "<ul>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html " <li><a href=\"animview/html/index.html\">Animation viewer documentation</a>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html " <li><a href=\"leveledit/html/index.html\">Level editor documentation</a>\n")
|
||||
endif()
|
||||
|
||||
if(DOXYGEN_FOUND OR LUA_PROGRAM_FOUND)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</ul>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</body>\n")
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</html>\n")
|
||||
if(DOXYGEN_FOUND OR LUA_PROGRAM_PATH)
|
||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doc/index.html "</ul>\n</body>\n</html>\n")
|
||||
endif()
|
||||
|
@@ -1,28 +1,30 @@
|
||||
# Cmake File for CorsixTH
|
||||
# OPTIONS AVAILABLE:
|
||||
# At most, one of the following:
|
||||
# - WITH_SDL : Activate SDL Renderer (default)
|
||||
# Any of the following:
|
||||
# - WITH_AUDIO : Activate Sound (enabled by default)
|
||||
# - WITH_FREETYPE2
|
||||
# - WITH_MOVIES : Activate movies (requires Sound)
|
||||
# - BUILD_ANIMVIEWER
|
||||
# - WITH_LUAJIT : Whether to use LuaJIT 2 instead of Lua51 (default is LuaJIT 2)
|
||||
# - WITH_LIBAV : Whether to use LibAV (as opposed to FFMEPG) when building movies
|
||||
# - WITH_VLD : Build with Visual Leak Detector (requires Visual Studio)
|
||||
# Any of the following: (default)
|
||||
# - WITH_AUDIO : Activate sound (yes)
|
||||
# - WITH_FREETYPE2 : Active support for non-Latin script alphabets (yes)
|
||||
# - WITH_MOVIES : Activate movies (requires with_audio, FFmpeg) (yes)
|
||||
# - WITH_LUAJIT : Use LuaJIT instead of Lua (must specify library path) (no)
|
||||
# - WITH_LIBAV : Use Libav instead of FFmpeg when building movies (no)
|
||||
# - USE_SOURCE_DATADIRS : Use the source directory for loading resources. Incompatible with the install target (no)
|
||||
|
||||
# - WITH_VLD : Build with Visual Leak Detector (requires Visual Studio) (no)
|
||||
# - USE_PRECOMPILED_DEPS : Use precompiled dependencies on *nix (no)
|
||||
# - USE_VCPKG_DEPS : Build vcpkg dependencies locally (requires Visual Studio) (no)
|
||||
|
||||
# - ENABLE_UNIT_TESTS : Enable Unit Testing Target (requires Catch2) (no)
|
||||
# - BUILD_ANIMVIEWER : Generate AnimViewer build files (no)
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
|
||||
|
||||
option(ENABLE_UNIT_TESTS "Enables Unit Testing Targets" OFF)
|
||||
|
||||
if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015" OR CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017")
|
||||
option(USE_VCPKG_DEPS "Build vcpkg dependencies locally" OFF)
|
||||
endif()
|
||||
|
||||
if(USE_VCPKG_DEPS)
|
||||
# This must be before the project for tool-chain to work correctly
|
||||
# This must be before the project for the tool-chain to work correctly
|
||||
message("Note: Using locally built vcpkg dependencies.")
|
||||
include(VcpkgDeps)
|
||||
endif()
|
||||
@@ -37,23 +39,24 @@ include(CheckIncludeFiles)
|
||||
|
||||
set(CORSIX_TH_DONE_TOP_LEVEL_CMAKE ON)
|
||||
|
||||
# Define our options
|
||||
option(WITH_AUDIO "Activate sound" ON)
|
||||
option(WITH_FREETYPE2 "Enhanced font support" ON)
|
||||
option(WITH_MOVIES "Activate in game movies" ON)
|
||||
option(WITH_LUAJIT "Use LuaJIT instead of Lua" OFF)
|
||||
option(WITH_LIBAV "Use LibAV instead of FFmpeg" OFF)
|
||||
option(USE_SOURCE_DATADIRS "Use the source directory for loading resources. Incompatible with the install target" OFF)
|
||||
|
||||
if(MSVC)
|
||||
option(WITH_VLD "Build with Visual Leak Detector for Visual Studio" OFF)
|
||||
endif()
|
||||
# Dependency management
|
||||
if(UNIX AND CMAKE_COMPILER_IS_GNU)
|
||||
option(USE_PRECOMPILED_DEPS "Use Precompiled Dependencies" OFF) # Make *nix systems opt in
|
||||
endif()
|
||||
|
||||
# Define our options
|
||||
option(USE_SOURCE_DATADIRS "Use the source directory for loading resources. Incompatible with the install target" OFF)
|
||||
option(WITH_SDL "Activate SDL Renderer" ON) # our default option
|
||||
option(WITH_AUDIO "Activate Sound" ON) # enabled by default
|
||||
option(WITH_MOVIES "Activate in game movies" ON)
|
||||
option(WITH_FREETYPE2 "Enhanced Font Support" ON)
|
||||
option(WITH_LUAJIT "Use LuaJIT instead of Lua" OFF)
|
||||
option(WITH_LIBAV "Use LibAV instead of FFmpeg" OFF)
|
||||
option(ENABLE_UNIT_TESTS "Enables Unit Testing Targets" OFF)
|
||||
option(BUILD_ANIMVIEWER "Build the animation viewer as part of the build process" OFF)
|
||||
if(MSVC)
|
||||
option(WITH_VLD "Build with Visual Leak Detector for Visual Studio" OFF)
|
||||
endif()
|
||||
|
||||
if(WITH_AUDIO)
|
||||
set(CORSIX_TH_USE_SDL_MIXER ON)
|
||||
@@ -72,17 +75,17 @@ if(WITH_MOVIES)
|
||||
else()
|
||||
set(CORSIX_TH_USE_FFMPEG ON)
|
||||
set(CORSIX_TH_USE_LIBAV OFF)
|
||||
message("Note: FFMPEG video is enabled (default)")
|
||||
message("Note: FFmpeg video is enabled (default)")
|
||||
endif()
|
||||
else()
|
||||
set(CORSIX_TH_USE_FFMPEG OFF)
|
||||
set(CORSIX_TH_USE_LIBAV OFF)
|
||||
message("Note: FFMPEG video disabled since it requires SDL audio.")
|
||||
message("Note: FFmpeg video disabled since it requires SDL audio.")
|
||||
endif()
|
||||
else()
|
||||
set(CORSIX_TH_USE_FFMPEG OFF)
|
||||
set(CORSIX_TH_USE_LIBAV OFF)
|
||||
message("Note: FFMPEG video is disabled")
|
||||
message("Note: FFmpeg video is disabled")
|
||||
endif()
|
||||
|
||||
if(WITH_FREETYPE2)
|
||||
@@ -127,30 +130,7 @@ if(BUILD_ANIMVIEWER)
|
||||
message("Building AnimView")
|
||||
add_subdirectory(AnimView)
|
||||
endif()
|
||||
message("")
|
||||
|
||||
# Documentation generation, construct 'doc' target (or a message it is disabled).
|
||||
|
||||
# Try to find 'lua'
|
||||
if(WITH_LUAJIT)
|
||||
set(LUA_PROGRAM_NAMES luajit-2.0.3 luajit)
|
||||
else()
|
||||
set(LUA_PROGRAM_NAMES lua53 lua5.3 lua-5.3 lua52 lua5.2 lua-5.2 lua51 lua5.1 lua-5.1 lua)
|
||||
endif()
|
||||
|
||||
find_program(LUA_PROGRAM_PATH ${LUA_PROGRAM_NAMES}
|
||||
PATHS
|
||||
ENV LUA_DIR
|
||||
/opt
|
||||
/opt/local
|
||||
~
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
)
|
||||
|
||||
if(LUA_PROGRAM_PATH)
|
||||
set(LUA_PROGRAM_FOUND TRUE)
|
||||
else()
|
||||
set(LUA_PROGRAM_FOUND FALSE)
|
||||
endif()
|
||||
|
||||
# Documentation generation, construct 'doc' target
|
||||
include(GenerateDoc)
|
||||
|
@@ -1989,12 +1989,6 @@ EXTERNAL_GROUPS = YES
|
||||
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of 'which perl').
|
||||
# The default file (with absolute path) is: /usr/bin/perl.
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2008,15 +2002,6 @@ PERL_PATH = /usr/bin/perl
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see:
|
||||
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
|
@@ -1989,12 +1989,6 @@ EXTERNAL_GROUPS = YES
|
||||
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of 'which perl').
|
||||
# The default file (with absolute path) is: /usr/bin/perl.
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2008,15 +2002,6 @@ PERL_PATH = /usr/bin/perl
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see:
|
||||
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
|
@@ -1989,12 +1989,6 @@ EXTERNAL_GROUPS = YES
|
||||
|
||||
EXTERNAL_PAGES = YES
|
||||
|
||||
# The PERL_PATH should be the absolute path and name of the perl script
|
||||
# interpreter (i.e. the result of 'which perl').
|
||||
# The default file (with absolute path) is: /usr/bin/perl.
|
||||
|
||||
PERL_PATH = /usr/bin/perl
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
@@ -2008,15 +2002,6 @@ PERL_PATH = /usr/bin/perl
|
||||
|
||||
CLASS_DIAGRAMS = YES
|
||||
|
||||
# You can define message sequence charts within doxygen comments using the \msc
|
||||
# command. Doxygen will then run the mscgen tool (see:
|
||||
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
|
||||
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
|
||||
# the mscgen tool resides. If left empty the tool is assumed to be found in the
|
||||
# default search path.
|
||||
|
||||
MSCGEN_PATH =
|
||||
|
||||
# You can include diagrams made with dia in doxygen documentation. Doxygen will
|
||||
# then run dia to produce the diagram and insert it in the documentation. The
|
||||
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
|
||||
|
Reference in New Issue
Block a user