cmake update
This commit is contained in:
		
							
								
								
									
										43
									
								
								cmake/Modules/Cog.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								cmake/Modules/Cog.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
find_package(PythonInterp)
 | 
			
		||||
find_package(PythonModule)
 | 
			
		||||
find_python_module(cogapp REQUIRED)
 | 
			
		||||
 | 
			
		||||
function(cog_sources globtarget output)
 | 
			
		||||
        file(GLOB_RECURSE targetsources RELATIVE "${CMAKE_SOURCE_DIR}"
 | 
			
		||||
                "${CMAKE_SOURCE_DIR}/${globtarget}")
 | 
			
		||||
        file(GLOB_RECURSE targetcoggedsources RELATIVE "${CMAKE_SOURCE_DIR}"
 | 
			
		||||
                "${CMAKE_SOURCE_DIR}/${globtarget}.cog")
 | 
			
		||||
        foreach(targetcog ${targetcoggedsources})
 | 
			
		||||
                string(REGEX REPLACE ".cog\$" "" this "${targetcog}")
 | 
			
		||||
                set(targetsources ${targetsources} ${this})
 | 
			
		||||
        endforeach(targetcog)
 | 
			
		||||
 | 
			
		||||
        set(${output} ${targetsources} PARENT_SCOPE)
 | 
			
		||||
endfunction(cog_sources)
 | 
			
		||||
 | 
			
		||||
macro(cog_target)
 | 
			
		||||
    # macro to add target to run cog for ALL files
 | 
			
		||||
    # useful for dependency management
 | 
			
		||||
    set(coggedfiles)
 | 
			
		||||
    
 | 
			
		||||
    file(GLOB_RECURSE cogfiles RELATIVE "${CMAKE_SOURCE_DIR}"
 | 
			
		||||
            "${CMAKE_SOURCE_DIR}/*.cog")
 | 
			
		||||
    
 | 
			
		||||
    foreach(cogfile ${cogfiles})
 | 
			
		||||
            # thisfile = absolute path to output file
 | 
			
		||||
            # outfile = relative path
 | 
			
		||||
            # TODO: fix that
 | 
			
		||||
            string(REGEX REPLACE ".cog\$" "" outfile "${cogfile}")
 | 
			
		||||
            set(thisfile "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
 | 
			
		||||
    
 | 
			
		||||
            add_custom_command(OUTPUT "${thisfile}" PRE_BUILD
 | 
			
		||||
                    COMMAND ${PYTHON_EXECUTABLE} -m cogapp -d -o "${thisfile}" "${cogfile}"
 | 
			
		||||
                    DEPENDS ${cogfile}
 | 
			
		||||
                    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 | 
			
		||||
                    COMMENT "Greasing the cog for ${BoldCyan}${outfile}${ColourReset}")
 | 
			
		||||
    
 | 
			
		||||
            set(coggedfiles ${coggedfiles} "${thisfile}")
 | 
			
		||||
    endforeach(cogfile)
 | 
			
		||||
    
 | 
			
		||||
    add_custom_target(cog DEPENDS ${coggedfiles})
 | 
			
		||||
endmacro(cog_target)
 | 
			
		||||
							
								
								
									
										24
									
								
								cmake/Modules/Colours.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								cmake/Modules/Colours.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
# basically an assembled version of https://stackoverflow.com/questions/18968979/how-to-get-colorized-output-with-cmake
 | 
			
		||||
# spelled with a u because the guy in the answer seemed to insist on it
 | 
			
		||||
 | 
			
		||||
if(NOT MSVC)
 | 
			
		||||
    string(ASCII 27 Esc)
 | 
			
		||||
    set(ColourReset "${Esc}[0m")
 | 
			
		||||
    set(ColourBold  "${Esc}[1m")
 | 
			
		||||
    set(Red         "${Esc}[0;31m")
 | 
			
		||||
    set(Green       "${Esc}[0;32m")
 | 
			
		||||
    set(Yellow      "${Esc}[0;33m")
 | 
			
		||||
    set(Blue        "${Esc}[0;34m")
 | 
			
		||||
    set(Magenta     "${Esc}[0;35m")
 | 
			
		||||
    set(Cyan        "${Esc}[0;36m")
 | 
			
		||||
    set(White       "${Esc}[0;37m")
 | 
			
		||||
    set(BoldRed     "${Esc}[1;31m")
 | 
			
		||||
    set(BoldGreen   "${Esc}[1;32m")
 | 
			
		||||
    set(BoldYellow  "${Esc}[1;33m")
 | 
			
		||||
    set(BoldBlue    "${Esc}[1;34m")
 | 
			
		||||
    set(BoldMagenta "${Esc}[1;35m")
 | 
			
		||||
    set(BoldCyan    "${Esc}[1;36m")
 | 
			
		||||
    set(BoldWhite   "${Esc}[1;37m")
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								cmake/Modules/FindCrypto++.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								cmake/Modules/FindCrypto++.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
# from https://github.com/harningt/cryptoface
 | 
			
		||||
# note: that's actually a library for supporting multiple crypto implementations
 | 
			
		||||
# might consider switching to that
 | 
			
		||||
# - Find Crypto++
 | 
			
		||||
 | 
			
		||||
if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
   set(CRYPTO++_FOUND TRUE)
 | 
			
		||||
 | 
			
		||||
else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
  find_path(CRYPTO++_INCLUDE_DIR cryptlib.h
 | 
			
		||||
      /usr/include/crypto++
 | 
			
		||||
      /usr/include/cryptopp
 | 
			
		||||
      /usr/local/include/crypto++
 | 
			
		||||
      /usr/local/include/cryptopp
 | 
			
		||||
      /opt/local/include/crypto++
 | 
			
		||||
      /opt/local/include/cryptopp
 | 
			
		||||
      $ENV{SystemDrive}/Crypto++/include
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
  find_library(CRYPTO++_LIBRARIES NAMES cryptopp
 | 
			
		||||
      PATHS
 | 
			
		||||
      /usr/lib
 | 
			
		||||
      /usr/local/lib
 | 
			
		||||
      /opt/local/lib
 | 
			
		||||
      $ENV{SystemDrive}/Crypto++/lib
 | 
			
		||||
      )
 | 
			
		||||
 | 
			
		||||
  if(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
    set(CRYPTO++_FOUND TRUE)
 | 
			
		||||
    message(STATUS "Found Crypto++: ${CRYPTO++_INCLUDE_DIR}, ${CRYPTO++_LIBRARIES}")
 | 
			
		||||
  else(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
    set(CRYPTO++_FOUND FALSE)
 | 
			
		||||
    message(STATUS "Crypto++ not found.")
 | 
			
		||||
  endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
 | 
			
		||||
  mark_as_advanced(CRYPTO++_INCLUDE_DIR CRYPTO++_LIBRARIES)
 | 
			
		||||
 | 
			
		||||
endif(CRYPTO++_INCLUDE_DIR AND CRYPTO++_LIBRARIES)
 | 
			
		||||
@@ -46,7 +46,7 @@ function(git_submodule)
 | 
			
		||||
 | 
			
		||||
        execute_process(COMMAND git submodule update --init -- "${GIT_SUBMODULE_DIR}/${GIT_SUBMODULE_TARGET}"
 | 
			
		||||
            WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
 | 
			
		||||
            COMMENT "Updating submodule ${GIT_SUBMODULE_DIR}/${GIT_SUBMODULE_TARGET}"
 | 
			
		||||
            COMMENT "Updating submodule ${Magenta}${GIT_SUBMODULE_DIR}/${GIT_SUBMODULE_TARGET}${ColourReset}"
 | 
			
		||||
            VERBATIM)
 | 
			
		||||
    endif(IS_GIT_REPO)
 | 
			
		||||
endfunction(git_submodule)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										94
									
								
								cmake/Modules/LavaTargets.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								cmake/Modules/LavaTargets.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
			
		||||
link_directories(${CMAKE_CURRENT_BINARY_DIR})
 | 
			
		||||
 | 
			
		||||
function(lava_create_library)
 | 
			
		||||
        set(multiValueArgs SUBDIRS DEPENDS LIBRARIES)
 | 
			
		||||
        set(oneValueArgs TARGET)
 | 
			
		||||
        cmake_parse_arguments(lava_create_library "" "${oneValueArgs}"
 | 
			
		||||
                "${multiValueArgs}" ${ARGN})
 | 
			
		||||
 | 
			
		||||
        set(target ${lava_create_library_TARGET})
 | 
			
		||||
 | 
			
		||||
        set(targetsources)
 | 
			
		||||
        foreach(subdir ${lava_create_library_SUBDIRS})
 | 
			
		||||
                cog_sources("src/${subdir}/*.cpp" subdirsources)
 | 
			
		||||
 | 
			
		||||
                foreach(source ${subdirsources})
 | 
			
		||||
                        set(targetsources ${targetsources} ${source})
 | 
			
		||||
                endforeach(source)
 | 
			
		||||
        endforeach(subdir)
 | 
			
		||||
 | 
			
		||||
        add_library(${target} SHARED ${targetsources})
 | 
			
		||||
	if(MINGW)
 | 
			
		||||
	    # MinGW (or CMake?) does a stupid, redundant thing where it names all output DLLs
 | 
			
		||||
        # "libblah.dll" and it's kinda stupid and redundant
 | 
			
		||||
	    # this removes the "lib" prefix because removing ".dll" causes things to break
 | 
			
		||||
	    set_target_properties(${target} PROPERTIES PREFIX "")
 | 
			
		||||
	endif()
 | 
			
		||||
        if(lava_create_library_LIBRARIES)
 | 
			
		||||
            foreach(library ${lava_create_library_LIBRARIES})
 | 
			
		||||
                target_link_libraries(${target} "${library}")
 | 
			
		||||
            endforeach()
 | 
			
		||||
        endif()
 | 
			
		||||
        if(lava_create_library_DEPENDS)
 | 
			
		||||
            add_dependencies(${target} ${lava_create_library_DEPENDS})
 | 
			
		||||
        endif()
 | 
			
		||||
endfunction(lava_create_library)
 | 
			
		||||
 | 
			
		||||
function(lava_create_gutlib)
 | 
			
		||||
        set(multiValueArgs SUBDIRS DEPENDS LIBRARIES LIBRARYVARS)
 | 
			
		||||
        cmake_parse_arguments(lava_create_gutlib "" ""
 | 
			
		||||
                "${multiValueArgs}" ${ARGN})
 | 
			
		||||
 | 
			
		||||
        foreach(subdir ${lava_create_gutlib_SUBDIRS})
 | 
			
		||||
                cog_sources("src/${subdir}/*.cpp" subdirsources)
 | 
			
		||||
 | 
			
		||||
                foreach(source ${subdirsources})
 | 
			
		||||
                        set(targetsources ${targetsources} ${source})
 | 
			
		||||
                endforeach(source)
 | 
			
		||||
        endforeach(subdir)
 | 
			
		||||
 | 
			
		||||
        add_library(gutlib SHARED ${targetsources})
 | 
			
		||||
        set_target_properties(gutlib PROPERTIES OUTPUT_NAME ${CMAKE_PROJECT_NAME})
 | 
			
		||||
	if(MINGW)
 | 
			
		||||
	    # MinGW (or CMake?) does a stupid, redundant thing where it names all output DLLs
 | 
			
		||||
        # "libblah.dll" and it's kinda stupid and redundant
 | 
			
		||||
	    # this removes the "lib" prefix because removing ".dll" causes things to break
 | 
			
		||||
	    set_target_properties(gutlib PROPERTIES PREFIX "")
 | 
			
		||||
	endif()
 | 
			
		||||
        if(lava_create_gutlib_LIBRARIES)
 | 
			
		||||
            foreach(library ${lava_create_gutlib_LIBRARIES})
 | 
			
		||||
               target_link_libraries(gutlib "${library}")
 | 
			
		||||
            endforeach()
 | 
			
		||||
        endif()
 | 
			
		||||
        if(lava_create_gutlib_DEPENDS)
 | 
			
		||||
            add_dependencies(gutlib ${lava_create_gutlib_DEPENDS})
 | 
			
		||||
        endif()
 | 
			
		||||
endfunction(lava_create_gutlib)
 | 
			
		||||
 | 
			
		||||
function(lava_create_executable)
 | 
			
		||||
        set(multiValueArgs SUBDIRS LIBRARIES DEPENDS)
 | 
			
		||||
        set(oneValueArgs TARGET)
 | 
			
		||||
        cmake_parse_arguments(lava_create_executable "" "${oneValueArgs}"
 | 
			
		||||
                "${multiValueArgs}" ${ARGN})
 | 
			
		||||
 | 
			
		||||
        set(target ${lava_create_executable_TARGET})
 | 
			
		||||
 | 
			
		||||
        set(targetsources)
 | 
			
		||||
        foreach(subdir ${lava_create_executable_SUBDIRS})
 | 
			
		||||
                cog_sources("src/${subdir}/*.cpp" subdirsources)
 | 
			
		||||
 | 
			
		||||
                foreach(source ${subdirsources})
 | 
			
		||||
                        set(targetsources ${targetsources} ${source})
 | 
			
		||||
                endforeach(source)
 | 
			
		||||
        endforeach(subdir)
 | 
			
		||||
 | 
			
		||||
        add_executable(${target} ${targetsources})
 | 
			
		||||
        if(lava_create_executable_LIBRARIES)
 | 
			
		||||
            foreach(library ${lava_create_executable_LIBRARIES})
 | 
			
		||||
                target_link_libraries(${target} "${library}")
 | 
			
		||||
            endforeach()
 | 
			
		||||
        endif()
 | 
			
		||||
        if(lava_create_executable_DEPENDS)
 | 
			
		||||
            add_dependencies(${target} ${lava_create_executable_DEPENDS})
 | 
			
		||||
        endif()
 | 
			
		||||
endfunction(lava_create_executable)
 | 
			
		||||
							
								
								
									
										47
									
								
								cmake/Modules/Platform.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								cmake/Modules/Platform.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
set(CMAKE_CXX_STANDARD 11)
 | 
			
		||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
 | 
			
		||||
 | 
			
		||||
set(PLATFORM_FOREIGN_ENV FALSE)
 | 
			
		||||
 | 
			
		||||
if(WIN32)
 | 
			
		||||
    set(PLATFORM_WINDOWS TRUE)
 | 
			
		||||
else()
 | 
			
		||||
    set(PLATFORM_WINDOWS FALSE)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 | 
			
		||||
    set(PLATFORM_WINDOWS TRUE)
 | 
			
		||||
    set(PLATFORM_FOREIGN_ENV TRUE)
 | 
			
		||||
else()
 | 
			
		||||
    set(CMAKE_CXX_FLAGS "-pipe ${CMAKE_CXX_FLAGS}")
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall")
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_RELEASE "-O2")
 | 
			
		||||
    set(CMAKE_CXX_FLAGS_RELWITHDBGINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
 | 
			
		||||
 | 
			
		||||
    if(MINGW OR MSYS)
 | 
			
		||||
        set(PLATFORM_WINDOWS TRUE)
 | 
			
		||||
        string(APPEND CMAKE_CXX_FLAGS " -mwin32 -Wl,-subsystem,windows")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    if(CYGWIN)
 | 
			
		||||
        set(PLATFORM_FOREIGN_ENV TRUE)
 | 
			
		||||
    endif()
 | 
			
		||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
 | 
			
		||||
 | 
			
		||||
if(NOT CMAKE_BUILD_TYPE)
 | 
			
		||||
    message(STATUS "${BoldGreen}Assuming this is a release build. ${BoldYellow}-DCMAKE_BUILD_TYPE=Debug${Green} otherwise.${ColourReset}")
 | 
			
		||||
    set(CMAKE_BUILD_TYPE Release)
 | 
			
		||||
endif(NOT CMAKE_BUILD_TYPE)
 | 
			
		||||
 | 
			
		||||
if(PLATFORM_WINDOWS)
 | 
			
		||||
    message(STATUS "Compiling for Windows - good luck, commander.
 | 
			
		||||
    Remember to track down and bundle any DLLs you may need.")
 | 
			
		||||
    set(PLATFORM_TYPE win32)
 | 
			
		||||
else()
 | 
			
		||||
    set(PLATFORM_TYPE linux)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(PLATFORM_FOREIGN_ENV)
 | 
			
		||||
    message(WARNING "${Yellow}This is an unfamiliar build environment.${ColourReset} Tread carefully and expect failure.
 | 
			
		||||
    If you manage to get it working I'd love to hear about it.")
 | 
			
		||||
endif()
 | 
			
		||||
							
								
								
									
										68
									
								
								cmake/Modules/Qt.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								cmake/Modules/Qt.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
 | 
			
		||||
include_directories(${Qt5_INCLUDES} ${Qt5_DIR})
 | 
			
		||||
 | 
			
		||||
file(READ "${CMAKE_SOURCE_DIR}/res/moc.txt" moclist)
 | 
			
		||||
string(REGEX REPLACE "\n" ";" moclist ${moclist}) # split into array by line
 | 
			
		||||
 | 
			
		||||
# note: i am aware of the existence of qt5_wrap_cpp and friends, but those functions
 | 
			
		||||
#       aren't aware of my code generator so i have to do it myself
 | 
			
		||||
#       also, qt5_wrap_ui just dumps headers in the root of the build dir. ew.
 | 
			
		||||
 | 
			
		||||
if(NOT QT_UIC_EXECUTABLE)
 | 
			
		||||
    string(REPLACE moc uic QT_UIC_EXECUTABLE "${QT_MOC_EXECUTABLE}")
 | 
			
		||||
endif()
 | 
			
		||||
  
 | 
			
		||||
set(mocsources)
 | 
			
		||||
set(qtcogged FALSE)
 | 
			
		||||
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/src/qtgenerated")
 | 
			
		||||
        file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/src/qtgenerated")
 | 
			
		||||
endif()
 | 
			
		||||
foreach(mocfile ${moclist})
 | 
			
		||||
    if(EXISTS ${CMAKE_SOURCE_DIR}/${mocfile})
 | 
			
		||||
        string(REGEX REPLACE ".h\$" ".cpp" implfile_rel "${mocfile}")
 | 
			
		||||
        string(REGEX REPLACE "include/" "src/qtgenerated/moc_" implfile_rel "${implfile_rel}")
 | 
			
		||||
        set(implfile_abs "${CMAKE_CURRENT_BINARY_DIR}/${implfile_rel}")
 | 
			
		||||
        add_custom_command(OUTPUT "${implfile_abs}" PRE_BUILD
 | 
			
		||||
                COMMAND ${QT_MOC_EXECUTABLE} -o "${implfile_abs}" "${CMAKE_SOURCE_DIR}/${mocfile}"
 | 
			
		||||
                DEPENDS "${CMAKE_SOURCE_DIR}/${mocfile}"
 | 
			
		||||
                COMMENT "Qt MOC: ${BoldCyan}${mocfile}${ColourReset}")
 | 
			
		||||
    elseif(EXISTS ${CMAKE_SOURCE_DIR}/${mocfile}.cog)
 | 
			
		||||
        set(qtcogged TRUE)
 | 
			
		||||
        string(REGEX REPLACE ".h\$" ".cpp" implfile_rel "${mocfile}")
 | 
			
		||||
        string(REGEX REPLACE "include/" "src/qtgenerated/moc_" implfile_rel "${implfile_rel}")
 | 
			
		||||
        set(implfile_abs "${CMAKE_CURRENT_BINARY_DIR}/${implfile_rel}")
 | 
			
		||||
        add_custom_command(OUTPUT "${implfile_abs}" PRE_BUILD
 | 
			
		||||
                COMMAND ${QT_MOC_EXECUTABLE} -o "${implfile_abs}" "${CMAKE_CURRENT_BINARY_DIR}/${mocfile}"
 | 
			
		||||
                DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${mocfile}"
 | 
			
		||||
                COMMENT "Qt MOC: ${BoldCyan}${mocfile}${ColourReset}")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    set(mocsources ${mocsources} "${implfile_abs}")
 | 
			
		||||
endforeach()
 | 
			
		||||
 | 
			
		||||
file(GLOB_RECURSE uilist RELATIVE "${CMAKE_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}/res/ui/*.ui")
 | 
			
		||||
set(uicsources)
 | 
			
		||||
foreach(uifile ${uilist})
 | 
			
		||||
    string(REGEX REPLACE "res/ui/" "" uiname ${uifile})
 | 
			
		||||
    string(REGEX REPLACE ".ui\$" "" uiname ${uiname})
 | 
			
		||||
    string(REGEX REPLACE "/" "_" uiname ${uiname})
 | 
			
		||||
    # res/ui/dlg/license.ui should result in ${uiname} being "dlg_license" at this point
 | 
			
		||||
    
 | 
			
		||||
    set(headerfile "${CMAKE_CURRENT_BINARY_DIR}/include/ui_${uiname}.h")
 | 
			
		||||
 | 
			
		||||
    add_custom_command(OUTPUT "${headerfile}" PRE_BUILD
 | 
			
		||||
            # TODO: not hardcode this path
 | 
			
		||||
            COMMAND ${QT_UIC_EXECUTABLE} -o "${headerfile}" "${CMAKE_SOURCE_DIR}/${uifile}"
 | 
			
		||||
            DEPENDS "${CMAKE_SOURCE_DIR}/${uifile}"
 | 
			
		||||
            COMMENT "Qt UIC: ${BoldCyan}${uifile}${ColourReset}")
 | 
			
		||||
 | 
			
		||||
    set(uicsources ${uicsources} "${headerfile}")
 | 
			
		||||
endforeach()
 | 
			
		||||
 | 
			
		||||
add_library(qtgenerated STATIC ${mocsources} ${uicsources})
 | 
			
		||||
target_link_libraries(qtgenerated Qt5::Core Qt5::Widgets)
 | 
			
		||||
if (qtcogged)
 | 
			
		||||
    add_dependencies(qtgenerated cog)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
message(STATUS "Found Qt: ${Qt5_VERSION}")
 | 
			
		||||
@@ -2,7 +2,7 @@ find_program(RONN ronn)
 | 
			
		||||
find_program(GZIP gzip)
 | 
			
		||||
 | 
			
		||||
if(NOT RONN OR NOT GZIP)
 | 
			
		||||
	message(WARNING "Not generating manpages")
 | 
			
		||||
    message(WARNING "${BoldYellow}Not generating manpages${ColourReset}")
 | 
			
		||||
	if(NOT RONN)
 | 
			
		||||
		message(WARNING "    ronn not installed")
 | 
			
		||||
	endif(NOT RONN)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								cmake/Modules/Sphinx.cmake
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								cmake/Modules/Sphinx.cmake
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
find_program(DVIPNG dvipng)
 | 
			
		||||
find_program(DVISVGM dvisvgm)
 | 
			
		||||
find_program(SPHINX_BUILD sphinx-build)
 | 
			
		||||
 | 
			
		||||
if(NOT DOCS_TOO)
 | 
			
		||||
    set(DOCS_TOO 0)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
if(NOT DVIPNG OR NOT DVISVGM OR NOT SPHINX_BUILD)
 | 
			
		||||
        message(WARNING "${BoldYellow}Cannot build library documentation.${ColourReset}")
 | 
			
		||||
 | 
			
		||||
    # report what's missing
 | 
			
		||||
    if(NOT DVIPNG)
 | 
			
		||||
        message(WARNING "    dvipng not installed.")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(NOT DVISVGM)
 | 
			
		||||
        message(WARNING "    dvisvgm not installed.")
 | 
			
		||||
    endif()
 | 
			
		||||
    if(NOT SPHINX_BUILD)
 | 
			
		||||
        message(WARNING "    Sphinx not installed.")
 | 
			
		||||
    endif()
 | 
			
		||||
 | 
			
		||||
    if (DOCS_TOO EQUAL 1)
 | 
			
		||||
        message(FATAL_ERROR "${BoldRed}This is a problem, since you specified DOCS_TOO.${ColourReset}")
 | 
			
		||||
    endif()
 | 
			
		||||
else()
 | 
			
		||||
    if(DOCS_TOO EQUAL 1)
 | 
			
		||||
        set(MAYBE_ALL ALL)
 | 
			
		||||
    else()
 | 
			
		||||
            message(STATUS "${Green}Not building docs automatically. Build them with: ${BoldGreen}${CMAKE_MAKE_PROGRAM} sphinx${ColourReset}
 | 
			
		||||
   An alternative strategy would be to run CMake again with ${BoldYellow}-DDOCS_TOO=1${ColourReset}")
 | 
			
		||||
        set(MAYBE_ALL "")
 | 
			
		||||
    endif()
 | 
			
		||||
    
 | 
			
		||||
    add_custom_target(sphinx ${MAYBE_ALL}
 | 
			
		||||
        COMMAND ${SPHINX_BUILD} -b html "${CMAKE_SOURCE_DIR}/doc/sphinx" "${CMAKE_CURRENT_BINARY_DIR}/doc")
 | 
			
		||||
endif()
 | 
			
		||||
		Reference in New Issue
	
	Block a user