summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 6bf924626c3e0e5d779c6574e3c8511dc42214b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# vim:ts=4:sw=4:expandtab:autoindent:
#
# Copyright (C) 1997-2015 by Dimitri van Heesch.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation under the terms of the GNU General Public License is hereby
# granted. No representations are made about the suitability of this software
# for any purpose. It is provided "as is" without express or implied warranty.
# See the GNU General Public License for more details.
#
# Documents produced by Doxygen are derivative works derived from the
# input used in their production; they are not affected by this license.

cmake_minimum_required(VERSION 3.1.3)
project(doxygen)

option(build_wizard    "Build the GUI frontend for doxygen." OFF)
option(build_app       "Example showing how to embed doxygen in an application." OFF)
option(build_parse     "Parses source code and dumps the dependencies between the code elements." OFF)
option(build_xmlparser "Example showing how to parse doxygen's XML output." OFF)
option(build_search    "Build external search tools (doxysearch and doxyindexer)" OFF)
option(build_doc       "Build user manual" OFF)
option(use_sqlite3     "Add support for sqlite3 output [experimental]." OFF)
option(use_libclang    "Add support for libclang parsing." OFF)
option(win_static      "Link with /MT in stead of /MD on windows" OFF)
option(english_only    "Only compile in support for the English language" OFF)
option(force_qt4       "Forces doxywizard to build using Qt4 even if Qt5 is installed" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
set(TOP "${CMAKE_SOURCE_DIR}")
include(version)

set(sqlite3  "0" CACHE INTERNAL "used in settings.h")
set(clang    "0" CACHE INTERNAL "used in settings.h")
if (use_sqlite3)
	set(sqlite3  "1" CACHE INTERNAL "used in settings.h")
endif()

set(MACOS_VERSION_MIN 10.9)
if (use_libclang)
	set(clang    "1" CACHE INTERNAL "used in settings.h")
        find_package(LLVM CONFIG REQUIRED)
        find_package(Clang CONFIG REQUIRED)
    if (CMAKE_SYSTEM MATCHES "Darwin")
        set(MACOS_VERSION_MIN 10.11)
    endif()
endif()

if (CMAKE_SYSTEM MATCHES "Darwin")
    set(CMAKE_CXX_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_CXX_FLAGS}")
    set(CMAKE_C_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_C_FLAGS}")
    find_library(CORESERVICES_LIB CoreServices)
    set(EXTRA_LIBS ${CORESERVICES_LIB})
endif()

if (WIN32)
    if (NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles")
        if (NOT ICONV_DIR)
          set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
        endif()
        set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC")
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit
        add_definitions(-DLIBICONV_STATIC -D_CRT_SECURE_NO_WARNINGS)
    endif()
endif()

if(POLICY CMP0063)
  cmake_policy(SET CMP0063 NEW)
endif()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)

if (CMAKE_GENERATOR MATCHES "Ninja")
  set(LEX_FLAGS )
  set(YACC_FLAGS )
else ()
  set(LEX_FLAGS $(LEX_FLAGS))
  set(YACC_FLAGS $(YACC_FLAGS))
endif ()

find_program(DOT NAMES dot)
find_package(PythonInterp REQUIRED)
find_package(FLEX REQUIRED)
find_package(BISON REQUIRED)
find_package(Threads)

if (sqlite3)
  find_package(SQLite3 REQUIRED)
  if (SQLITE3_VERSION VERSION_LESS 3.9.0)
    message(SEND_ERROR "Doxygen requires at least sqlite3 version 3.9.0 (installed: ${SQLITE3_VERSION})")
  endif()
endif()

find_package(Iconv REQUIRED)
include_directories(${ICONV_INCLUDE_DIR})


#set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc)
set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS})
set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files")
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

# place binaries for all build types in the same directory, so we know where to find it
# when running tests or generating docs
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${EXECUTABLE_OUTPUT_PATH})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH})

# gather lang codes for translation
file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h")
if (english_only) # user only wants English
  set(lcodes "ENONLY")
else ()
  set(lcodes "")
  foreach (_lang ${lang_files})
    string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang})
    string(TOUPPER ${_lang_code} lang_code)
    list(APPEND lcodes "${lang_code}")
  endforeach()
endif()
set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in")

if (win_static)
    set(CompilerFlags
        CMAKE_CXX_FLAGS
        CMAKE_CXX_FLAGS_DEBUG
        CMAKE_CXX_FLAGS_RELEASE
        CMAKE_CXX_FLAGS_MINSIZEREL
        CMAKE_CXX_FLAGS_RELWITHDEBINFO
        CMAKE_C_FLAGS
        CMAKE_C_FLAGS_DEBUG
        CMAKE_C_FLAGS_RELEASE
        CMAKE_C_FLAGS_MINSIZEREL
        CMAKE_C_FLAGS_RELWITHDEBINFO)
    foreach(CompilerFlag ${CompilerFlags})
      string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
    endforeach()
endif()


add_subdirectory(libmd5)
add_subdirectory(qtools)
add_subdirectory(vhdlparser)
add_subdirectory(src)

if (build_doc)
    add_subdirectory(examples)
    add_subdirectory(doc)
endif ()

add_subdirectory(addon)

enable_testing()
add_subdirectory(testing)

include(cmake/packaging.cmake) # set CPACK_xxxx properties
include(CPack)