Skip to content

Commit

Permalink
use cmake
Browse files Browse the repository at this point in the history
runtest.pl replaced by testing/test_driver.cmake
version.py replaced by cmake/version.cmake
lang_cfg.py replaced by cmake/lang_cfg.cmake
settings.py implemented in src/CMakeLists.txt
increasebuffer.py replaced by defining the YY_BUF_SIZE and YY_READ_BUF_SIZE

Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
  • Loading branch information
groleo committed May 15, 2015
1 parent ac576bd commit 2e099b1
Show file tree
Hide file tree
Showing 16 changed files with 868 additions and 0 deletions.
80 changes: 80 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,80 @@
# 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.0)
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_xmlparser "Example showing how to parse doxygen's XML output." OFF)
option(build_search "Build external search tools (doxysearch and doxyindexer)" OFF)
option(use_sqlite3 "Add support for sqlite3 output [experimental]." OFF)
option(use_libclang "Add support for libclang parsing." OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
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()
if (use_libclang)
set(clang "1" CACHE INTERNAL "used in settings.h")
endif()


if (${CMAKE_SYSTEM} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS "-Wno-deprecated-register ${CMAKE_CXX_FLAGS}")
find_library(CORESERVICES_LIB CoreServices)
set(EXTRA_LIBS ${CORESERVICES_LIB})
endif()

if (WIN32)
set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild")
set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC")
add_definitions(-DLIBICONV_STATIC -D_CRT_SECURE_NO_WARNINGS)
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)
endif()

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

set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs")
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)

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

add_subdirectory(addon/doxmlparser)
add_subdirectory(addon/doxyapp)
add_subdirectory(addon/doxysearch)
add_subdirectory(addon/doxywizard)

enable_testing()
add_subdirectory(testing)
Empty file.
25 changes: 25 additions & 0 deletions addon/doxyapp/CMakeLists.txt
@@ -0,0 +1,25 @@
if (build_app)

find_package(Iconv)

include_directories(
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/qtools
${ICONV_INCLUDE_DIR}
)

add_executable(doxyapp
doxyapp.cpp
)
target_link_libraries(doxyapp
_doxygen
qtools
md5
doxycfg
vhdlparser
${ICONV_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
${SQLITE3_LIBRARIES}
)

endif()
24 changes: 24 additions & 0 deletions addon/doxysearch/CMakeLists.txt
@@ -0,0 +1,24 @@
if (build_search)

find_package(Xapian REQUIRED)

include_directories(
${CMAKE_SOURCE_DIR}/qtools
${XAPIAN_INCLUDE_DIR}
)
add_executable(doxyindexer
doxyindexer.cpp
)
target_link_libraries(doxyindexer
${XAPIAN_LIBRARIES}
qtools
)

add_executable(doxysearch.cgi
doxysearch.cpp
)
target_link_libraries(doxysearch.cgi
${XAPIAN_LIBRARIES}
)

endif()
55 changes: 55 additions & 0 deletions addon/doxywizard/CMakeLists.txt
@@ -0,0 +1,55 @@
if (build_wizard)

include_directories(
.
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/qtools
${GENERATED_SRC}
)

add_definitions(-DQT_ARCH_X86_64 -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII)
set(QT_USE_QTXML TRUE)
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})

add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -wiz ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configdoc.cpp
OUTPUT ${GENERATED_SRC}/configdoc.cpp
)
set_source_files_properties(${GENERATED_SRC}/configdoc.cpp PROPERTIES GENERATED 1)

FLEX_TARGET(config_doxyw config_doxyw.l ${GENERATED_SRC}/config_doxyw.cpp COMPILE_FLAGS "-Pconfig_doxywYY")

QT4_WRAP_CPP(doxywizard_MOC
doxywizard.h
expert.h
helplabel.h
inputint.h
inputbool.h
inputstring.h
inputstrlist.h
wizard.h
)

QT4_ADD_RESOURCES(doxywizard_RESOURCES_RCC doxywizard.qrc)

add_executable(doxywizard
doxywizard.cpp
expert.cpp
wizard.cpp
inputbool.cpp
inputstring.cpp
inputint.cpp
inputstrlist.cpp
${GENERATED_SRC}/settings.h
${GENERATED_SRC}/version.cpp
${GENERATED_SRC}/config_doxyw.cpp
${GENERATED_SRC}/configdoc.cpp
${doxywizard_MOC}
${doxywizard_RESOURCES_RCC}
)
target_link_libraries(doxywizard
qtools md5 vhdlparser ${QT_LIBRARIES}
)

endif()
115 changes: 115 additions & 0 deletions cmake/FindIconv.cmake
@@ -0,0 +1,115 @@
# vim:ts=4:sw=4:expandtab:autoindent:
#
# The MIT License
#
# Copyright (c) 2008, 2009 Flusspferd contributors (see "CONTRIBUTORS" or
# http://flusspferd.org/contributors.txt)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

Include(CheckFunctionExists)
include(CheckCXXSourceCompiles)

if(ICONV_INCLUDE_DIR)
set(ICONV_FIND_QUIETLY TRUE)
endif()

find_path(ICONV_INCLUDE_DIR iconv.h
HINTS
${CMAKE_PREFIX_PATH}
${ICONV_DIR}
$ENV{ICONV_DIR}
PATH_SUFFIXES include
)

if(NOT ICONV_INCLUDE_DIR STREQUAL "ICONV_INCLUDE_DIR-NOTFOUND")
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
check_function_exists(iconv_open ICONV_IN_GLIBC)
endif()

if(NOT ICONV_IN_GLIBC)
find_library(ICONV_LIBRARY
NAMES iconv
HINTS
${CMAKE_PREFIX_PATH}
${ICONV_DIR}
$ENV{ICONV_DIR}
PATH_SUFFIXES lib64 lib
)
set(ICONV_TEST ${ICONV_LIBRARY})
else()
set(ICONV_TEST "In glibc")
endif()

set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
check_cxx_source_compiles(
"#include <iconv.h>
int main() {
iconv(iconv_t(-1), 0, 0, 0, 0);
}"
ICONV_COMPILES)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ICONV DEFAULT_MSG ICONV_TEST ICONV_INCLUDE_DIR ICONV_COMPILES)

if(ICONV_FOUND)
set(ICONV_LIBRARIES ${ICONV_LIBRARY})
else(ICONV_FOUND)
set(ICONV_LIBRARIES)
endif(ICONV_FOUND)

if(ICONV_FOUND)
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})

if (NOT DEFINED ICONV_ACCEPTS_NONCONST_INPUT)
# Display a useful message first time we come through here
message(STATUS "One (and only one) of the ICONV_ACCEPTS_... tests must pass")
endif()
check_cxx_source_compiles(
"#include <iconv.h>
int main() {
char *p = 0;
iconv(iconv_t(-1), &p, 0, 0, 0);
}"
ICONV_ACCEPTS_NONCONST_INPUT)

check_cxx_source_compiles(
"#include <iconv.h>
int main() {
char const *p = 0;
iconv(iconv_t(-1), &p, 0, 0, 0);
}"
ICONV_ACCEPTS_CONST_INPUT)

if (ICONV_LIBRARY)
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})
list(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
endif()
endif()

if(NOT ICONV_ACCEPTS_CONST_INPUT AND NOT ICONV_ACCEPTS_NONCONST_INPUT)
MESSAGE(FATAL_ERROR "Unable to determine iconv() signature")
elseif(ICONV_ACCEPTS_CONST_INPUT AND ICONV_ACCEPTS_NONCONST_INPUT)
MESSAGE(FATAL_ERROR "Unable to determine iconv() signature - both test cases passed!")
endif()

mark_as_advanced(ICONV_LIBRARY ICONV_INCLUDE_DIR)
86 changes: 86 additions & 0 deletions cmake/FindSQLite3.cmake
@@ -0,0 +1,86 @@
# - Try to find Sqlite3
# Once done this will define
#
# SQLITE3_FOUND - system has Sqlite3
# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory
# SQLITE3_LIBRARIES - Link these to use Sqlite3
# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3
#
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
# in cache already
set(SQLITE3_FOUND TRUE)
else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
include(UsePkgConfig)
pkgconfig(sqlite3 _SQLITE3_INCLUDEDIR _SQLITE3_LIBDIR _SQLITE3_LDFLAGS _SQLITE3_CFLAGS)
else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_package(PkgConfig)
if (PKG_CONFIG_FOUND)
pkg_check_modules(_SQLITE3 sqlite3)
endif (PKG_CONFIG_FOUND)
endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
find_path(SQLITE3_INCLUDE_DIR
NAMES
sqlite3.h
PATHS
${_SQLITE3_INCLUDEDIR}
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)

find_library(SQLITE3_LIBRARY
NAMES
sqlite3
PATHS
${_SQLITE3_LIBDIR}
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)

if (SQLITE3_LIBRARY)
set(SQLITE3_FOUND TRUE)
endif (SQLITE3_LIBRARY)

set(SQLITE3_INCLUDE_DIRS
${SQLITE3_INCLUDE_DIR}
)

if (SQLITE3_FOUND)
set(SQLITE3_LIBRARIES
${SQLITE3_LIBRARIES}
${SQLITE3_LIBRARY}
)
endif (SQLITE3_FOUND)

if (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
set(SQLITE3_FOUND TRUE)
endif (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)

if (SQLITE3_FOUND)
if (NOT Sqlite3_FIND_QUIETLY)
message(STATUS "Found Sqlite3: ${SQLITE3_LIBRARIES}")
endif (NOT Sqlite3_FIND_QUIETLY)
else (SQLITE3_FOUND)
if (Sqlite3_FIND_REQUIRED)
message(FATAL_ERROR "Could not find Sqlite3")
endif (Sqlite3_FIND_REQUIRED)
endif (SQLITE3_FOUND)

# show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view
mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)

endif (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)

0 comments on commit 2e099b1

Please sign in to comment.