Blame CMakeLists.txt

Packit Service 50c9f2
# vim:ts=4:sw=4:expandtab:autoindent:
Packit Service 50c9f2
#
Packit Service 50c9f2
# Copyright (C) 1997-2015 by Dimitri van Heesch.
Packit Service 50c9f2
#
Packit Service 50c9f2
# Permission to use, copy, modify, and distribute this software and its
Packit Service 50c9f2
# documentation under the terms of the GNU General Public License is hereby
Packit Service 50c9f2
# granted. No representations are made about the suitability of this software
Packit Service 50c9f2
# for any purpose. It is provided "as is" without express or implied warranty.
Packit Service 50c9f2
# See the GNU General Public License for more details.
Packit Service 50c9f2
#
Packit Service 50c9f2
# Documents produced by Doxygen are derivative works derived from the
Packit Service 50c9f2
# input used in their production; they are not affected by this license.
Packit Service 50c9f2
Packit Service 50c9f2
cmake_minimum_required(VERSION 2.8.12)
Packit Service 50c9f2
project(doxygen)
Packit Service 50c9f2
Packit Service 50c9f2
option(build_wizard    "Build the GUI frontend for doxygen." OFF)
Packit Service 50c9f2
option(build_app       "Example showing how to embed doxygen in an application." OFF)
Packit Service 50c9f2
option(build_parse     "Parses source code and dumps the dependencies between the code elements." OFF)
Packit Service 50c9f2
option(build_xmlparser "Example showing how to parse doxygen's XML output." OFF)
Packit Service 50c9f2
option(build_search    "Build external search tools (doxysearch and doxyindexer)" OFF)
Packit Service 50c9f2
option(build_doc       "Build user manual" OFF)
Packit Service 50c9f2
option(use_sqlite3     "Add support for sqlite3 output [experimental]." OFF)
Packit Service 50c9f2
option(use_libclang    "Add support for libclang parsing." OFF)
Packit Service 50c9f2
option(win_static      "Link with /MT in stead of /MD on windows" OFF)
Packit Service 50c9f2
option(english_only    "Only compile in support for the English language" OFF)
Packit Service 50c9f2
option(force_qt4       "Forces doxywizard to build using Qt4 even if Qt5 is installed" OFF)
Packit Service 50c9f2
Packit Service 50c9f2
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
Packit Service 50c9f2
set(TOP "${CMAKE_SOURCE_DIR}")
Packit Service 50c9f2
include(version)
Packit Service 50c9f2
Packit Service 50c9f2
set(sqlite3  "0" CACHE INTERNAL "used in settings.h")
Packit Service 50c9f2
set(clang    "0" CACHE INTERNAL "used in settings.h")
Packit Service 50c9f2
if (use_sqlite3)
Packit Service 50c9f2
	set(sqlite3  "1" CACHE INTERNAL "used in settings.h")
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
set(MACOS_VERSION_MIN 10.5)
Packit Service 50c9f2
if (use_libclang)
Packit Service 50c9f2
	set(clang    "1" CACHE INTERNAL "used in settings.h")
Packit Service 50c9f2
        find_package(LLVM CONFIG REQUIRED)
Packit Service 50c9f2
        find_package(Clang CONFIG REQUIRED)
Packit Service 50c9f2
    if (CMAKE_SYSTEM MATCHES "Darwin")
Packit Service 50c9f2
        set(MACOS_VERSION_MIN 10.11)
Packit Service 50c9f2
    endif()
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
if (CMAKE_SYSTEM MATCHES "Darwin")
Packit Service 50c9f2
    set(CMAKE_CXX_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_CXX_FLAGS}")
Packit Service 50c9f2
    set(CMAKE_C_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_C_FLAGS}")
Packit Service 50c9f2
    find_library(CORESERVICES_LIB CoreServices)
Packit Service 50c9f2
    set(EXTRA_LIBS ${CORESERVICES_LIB})
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
if (WIN32)
Packit Service 50c9f2
    if (NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles")
Packit Service 50c9f2
        if (NOT ICONV_DIR)
Packit Service 50c9f2
          set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
Packit Service 50c9f2
        endif()
Packit Service 50c9f2
        set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC")
Packit Service 50c9f2
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit
Packit Service 50c9f2
        add_definitions(-DLIBICONV_STATIC -D_CRT_SECURE_NO_WARNINGS)
Packit Service 50c9f2
    endif()
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
if(POLICY CMP0063)
Packit Service 50c9f2
  cmake_policy(SET CMP0063 NEW)
Packit Service 50c9f2
endif()
Packit Service 50c9f2
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
Packit Service 50c9f2
set(CMAKE_C_VISIBILITY_PRESET hidden)
Packit Service 50c9f2
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
Packit Service 50c9f2
Packit Service 50c9f2
if (CMAKE_GENERATOR MATCHES "Ninja")
Packit Service 50c9f2
  set(LEX_FLAGS )
Packit Service 50c9f2
  set(YACC_FLAGS )
Packit Service 50c9f2
else ()
Packit Service 50c9f2
  set(LEX_FLAGS $(LEX_FLAGS))
Packit Service 50c9f2
  set(YACC_FLAGS $(YACC_FLAGS))
Packit Service 50c9f2
endif ()
Packit Service 50c9f2
Packit Service 50c9f2
find_program(DOT NAMES dot)
Packit Service 50c9f2
find_package(PythonInterp REQUIRED)
Packit Service 50c9f2
find_package(FLEX REQUIRED)
Packit Service 50c9f2
find_package(BISON REQUIRED)
Packit Service 50c9f2
find_package(Threads)
Packit Service 50c9f2
Packit Service 50c9f2
if (sqlite3)
Packit Service 50c9f2
    find_package(SQLite3 REQUIRED)
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
find_package(Iconv REQUIRED)
Packit Service 50c9f2
include_directories(${ICONV_INCLUDE_DIR})
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
#set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
Packit Service 50c9f2
set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc)
Packit Service 50c9f2
set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS})
Packit Service 50c9f2
set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files")
Packit Service 50c9f2
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
Packit Service 50c9f2
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
Packit Service 50c9f2
Packit Service 50c9f2
# place binaries for all build types in the same directory, so we know where to find it
Packit Service 50c9f2
# when running tests or generating docs
Packit Service 50c9f2
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
Packit Service 50c9f2
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
Packit Service 50c9f2
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
Packit Service 50c9f2
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})
Packit Service 50c9f2
Packit Service 50c9f2
# gather lang codes for translation
Packit Service 50c9f2
file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h")
Packit Service 50c9f2
if (english_only) # user only wants English
Packit Service 50c9f2
  set(lcodes "ENONLY")
Packit Service 50c9f2
else ()
Packit Service 50c9f2
  set(lcodes "")
Packit Service 50c9f2
  foreach (_lang ${lang_files})
Packit Service 50c9f2
    string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang})
Packit Service 50c9f2
    string(TOUPPER ${_lang_code} lang_code)
Packit Service 50c9f2
    list(APPEND lcodes "${lang_code}")
Packit Service 50c9f2
  endforeach()
Packit Service 50c9f2
endif()
Packit Service 50c9f2
set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in")
Packit Service 50c9f2
Packit Service 50c9f2
if (win_static)
Packit Service 50c9f2
    set(CompilerFlags
Packit Service 50c9f2
        CMAKE_CXX_FLAGS
Packit Service 50c9f2
        CMAKE_CXX_FLAGS_DEBUG
Packit Service 50c9f2
        CMAKE_CXX_FLAGS_RELEASE
Packit Service 50c9f2
        CMAKE_CXX_FLAGS_MINSIZEREL
Packit Service 50c9f2
        CMAKE_CXX_FLAGS_RELWITHDEBINFO
Packit Service 50c9f2
        CMAKE_C_FLAGS
Packit Service 50c9f2
        CMAKE_C_FLAGS_DEBUG
Packit Service 50c9f2
        CMAKE_C_FLAGS_RELEASE
Packit Service 50c9f2
        CMAKE_C_FLAGS_MINSIZEREL
Packit Service 50c9f2
        CMAKE_C_FLAGS_RELWITHDEBINFO)
Packit Service 50c9f2
    foreach(CompilerFlag ${CompilerFlags})
Packit Service 50c9f2
      string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
Packit Service 50c9f2
    endforeach()
Packit Service 50c9f2
endif()
Packit Service 50c9f2
Packit Service 50c9f2
Packit Service 50c9f2
add_subdirectory(libmd5)
Packit Service 50c9f2
add_subdirectory(qtools)
Packit Service 50c9f2
add_subdirectory(vhdlparser)
Packit Service 50c9f2
add_subdirectory(src)
Packit Service 50c9f2
Packit Service 50c9f2
if (build_doc)
Packit Service 50c9f2
    add_subdirectory(examples)
Packit Service 50c9f2
    add_subdirectory(doc)
Packit Service 50c9f2
endif ()
Packit Service 50c9f2
Packit Service 50c9f2
add_subdirectory(addon)
Packit Service 50c9f2
Packit Service 50c9f2
enable_testing()
Packit Service 50c9f2
add_subdirectory(testing)
Packit Service 50c9f2
Packit Service 50c9f2
include(cmake/packaging.cmake) # set CPACK_xxxx properties
Packit Service 50c9f2
include(CPack)