|
|
|
|
cmake_minimum_required (VERSION 2.8.8)
|
|
|
|
|
|
|
|
|
|
project(juci)
|
|
|
|
|
set(JUCI_VERSION "1.6.1.2")
|
|
|
|
|
|
|
|
|
|
set(CPACK_PACKAGE_NAME "jucipp")
|
|
|
|
|
set(CPACK_PACKAGE_CONTACT "Ole Christian Eidheim <eidheim@gmail.com>")
|
|
|
|
|
set(CPACK_PACKAGE_VENDOR ${CPACK_PACKAGE_CONTACT})
|
|
|
|
|
set(CPACK_PACKAGE_VERSION ${JUCI_VERSION})
|
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
|
|
|
|
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A lightweight, platform independent IDE made especially for C/C++.")
|
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
|
|
|
|
|
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_DEPENDS "cmake, make, g++, libclang-dev, liblldb-dev, clang-format, pkg-config, libboost-system-dev, libboost-filesystem-dev, libboost-serialization-dev libgtksourceviewmm-3.0-dev, aspell-en, libaspell-dev, libgit2-dev, universal-ctags")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://gitlab.com/cppit/jucipp")
|
|
|
|
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
|
|
|
|
include(CPack)
|
|
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
|
|
|
|
|
|
add_compile_options(-pthread -Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations)
|
|
|
|
|
add_definitions(-DJUCI_VERSION="${JUCI_VERSION}")
|
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "")
|
|
|
|
|
add_compile_options(-O3)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# temporarily disable these warnings: Only <gtksourceview/gtksource.h> can be included directly.
|
|
|
|
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
|
|
|
|
add_compile_options(-Wno-cpp)
|
|
|
|
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
|
add_compile_options("-Wno-#warnings")
|
|
|
|
|
add_compile_options(-Wthread-safety)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
|
link_directories(/usr/local/lib /usr/local/opt/gettext/lib /usr/local/opt/libsigc++@2/lib)
|
|
|
|
|
include_directories(/usr/local/opt/gettext/include)
|
|
|
|
|
set(CMAKE_MACOSX_RPATH 1)
|
|
|
|
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/libsigc++@2/lib/pkgconfig:/usr/local/opt/zlib/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig")
|
|
|
|
|
endif()
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
|
|
|
|
|
link_directories(/usr/local/lib)
|
|
|
|
|
link_directories(${CMAKE_INSTALL_PREFIX}/lib)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(BUILD_TESTING "Build tests")
|
|
|
|
|
option(BUILD_FUZZING "Build tests")
|
|
|
|
|
option(LIBCLANG_PATH "Use custom path for libclang")
|
|
|
|
|
option(LIBLLDB_PATH "Use custom path for liblldb")
|
|
|
|
|
|
|
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER 3.11.4)
|
|
|
|
|
if (${CMAKE_HOST_WIN32})
|
|
|
|
|
if("$ENV{APPVEYOR}" STREQUAL "True")
|
|
|
|
|
set(MINGW_PATH "C:/msys64/mingw64")
|
|
|
|
|
else()
|
|
|
|
|
set(MINGW_PATH "$ENV{MSYSTEM_PREFIX}")
|
|
|
|
|
endif()
|
|
|
|
|
set(MINGW_PYTHON_VERSION 3.7)
|
|
|
|
|
set(MINGW_LIBRARY_DIR "${MINGW_PATH}/lib")
|
|
|
|
|
set(MINGW_INCLUDE_DIR "${MINGW_PATH}/include")
|
|
|
|
|
find_file(Python3_LIBRARIES "libpython${MINGW_PYTHON_VERSION}m.dll.a" HINTS ${MINGW_LIBRARY_DIR} NO_DEFAULT_PATH)
|
|
|
|
|
find_path(Python3_INCLUDE_DIRS "Python.h" HINTS "${MINGW_INCLUDE_DIR}/python${MINGW_PYTHON_VERSION}m" NO_DEFAULT_PATH)
|
|
|
|
|
if (EXISTS ${Python3_LIBRARIES} AND EXISTS ${Python3_INCLUDE_DIRS})
|
|
|
|
|
set(Python3_FOUND True)
|
|
|
|
|
set(Python3_LIBRARY_DIRS "${MINGW_LIBRARY_DIR}/python${MINGW_PYTHON_VERSION}")
|
|
|
|
|
set(Python3_VERSION_MAJOR 3)
|
|
|
|
|
set(Python3_VERSION_MINOR 7)
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
find_package(Python3 COMPONENTS Development)
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
find_package(PythonLibs 3)
|
|
|
|
|
message(${PYTHONLIBS_VERSION_STRING})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(${Python3_FOUND})
|
|
|
|
|
if(${CMAKE_HOST_WIN32})
|
|
|
|
|
set(PYTHONLIBS_FOUND True)
|
|
|
|
|
set(PYTHON_MODULE_EXTENSION True)
|
|
|
|
|
endif()
|
|
|
|
|
set(PYTHONLIBS_FOUND ${Python3_FOUND})
|
|
|
|
|
set(PYTHON_LIBRARIES ${Python3_LIBRARIES})
|
|
|
|
|
set(PYTHON_INCLUDE_DIRS ${Python3_INCLUDE_DIRS})
|
|
|
|
|
set(PYTHON_LIBRARY_DIR ${Python3_LIBRARY_DIRS}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
include(FindPkgConfig)
|
|
|
|
|
|
|
|
|
|
set(PYGOBJECT_FOUND False)
|
|
|
|
|
|
|
|
|
|
if(${PYTHONLIBS_FOUND})
|
|
|
|
|
add_subdirectory(lib/pybind11)
|
|
|
|
|
pkg_check_modules(PYGOBJECT pygobject-3.0)
|
|
|
|
|
if("${PYGOBJECT_FOUND}" STREQUAL "")
|
|
|
|
|
set(PYGOBJECT_FOUND False)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(${PYGOBJECT_FOUND})
|
|
|
|
|
add_definitions(-DJUCI_ENABLE_PLUGINS)
|
|
|
|
|
else()
|
|
|
|
|
message(STATUS "Python or pygobject not found. Building juCi++ without plugin support.")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(BUILD_TESTING_SAVED ${BUILD_TESTING})
|
|
|
|
|
set(BUILD_TESTING OFF CACHE BOOL "Disable sub-project tests" FORCE)
|
|
|
|
|
add_subdirectory(lib/libclangmm)
|
|
|
|
|
add_subdirectory(lib/tiny-process-library)
|
|
|
|
|
set(BUILD_TESTING ${BUILD_TESTING_SAVED} CACHE BOOL "Set to previous value" FORCE)
|
|
|
|
|
find_package(Boost 1.54 COMPONENTS REQUIRED filesystem serialization)
|
|
|
|
|
find_package(ASPELL REQUIRED)
|
|
|
|
|
pkg_check_modules(GTKMM gtkmm-3.0 REQUIRED)
|
|
|
|
|
pkg_check_modules(GTKSVMM gtksourceviewmm-3.0 REQUIRED)
|
|
|
|
|
pkg_check_modules(LIBGIT2 libgit2 REQUIRED)
|
|
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
|
|
|
|
|
|
if(LIBCLANG_PATH)
|
|
|
|
|
find_library(LIBCLANG_LIBRARIES clang "${LIBCLANG_PATH}/lib" NO_DEFAULT_PATH)
|
|
|
|
|
set(LIBCLANG_INCLUDE_DIRS "${LIBCLANG_PATH}/include")
|
|
|
|
|
if(LIBCLANG_LIBRARIES)
|
|
|
|
|
find_package_handle_standard_args(libclang DEFAULT_MSG LIBCLANG_LIBRARIES LIBCLANG_INCLUDE_DIRS)
|
|
|
|
|
else()
|
|
|
|
|
message(FATAL_ERROR "libclang not found")
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/libclangmm/cmake_modules/")
|
|
|
|
|
find_package(LibClang REQUIRED)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(BUILD_TESTING_SAVED ${BUILD_TESTING})
|
|
|
|
|
set(BUILD_TESTING OFF CACHE BOOL "Disable sub-project tests" FORCE)
|
|
|
|
|
add_subdirectory(lib/tiny-process-library)
|
|
|
|
|
add_subdirectory(lib/libclangmm)
|
|
|
|
|
set(BUILD_TESTING ${BUILD_TESTING_SAVED} CACHE BOOL "Set to previous value" FORCE)
|
|
|
|
|
|
|
|
|
|
if(LIBLLDB_PATH)
|
|
|
|
|
find_library(LIBLLDB_LIBRARIES lldb "${LIBLLDB_PATH}/lib" NO_DEFAULT_PATH)
|
|
|
|
|
set(LIBLLDB_INCLUDE_DIRS "${LIBLLDB_PATH}/include")
|
|
|
|
|
else()
|
|
|
|
|
# Find liblldb with the same version as the version of libclang found
|
|
|
|
|
string(REPLACE libclang liblldb LIBLLDB_LIBRARIES "${LIBCLANG_LIBRARIES}")
|
|
|
|
|
set(LIBLLDB_INCLUDE_DIRS ${LIBCLANG_INCLUDE_DIRS})
|
|
|
|
|
endif()
|
|
|
|
|
if(EXISTS "${LIBLLDB_LIBRARIES}")
|
|
|
|
|
set(LIBLLDB_FOUND TRUE)
|
|
|
|
|
elseif(EXISTS "${LIBLLDB_LIBRARIES}.1")
|
|
|
|
|
set(LIBLLDB_LIBRARIES "${LIBLLDB_LIBRARIES}.1")
|
|
|
|
|
set(LIBLLDB_FOUND TRUE)
|
|
|
|
|
endif()
|
|
|
|
|
if(LIBLLDB_FOUND)
|
|
|
|
|
add_definitions(-DJUCI_ENABLE_DEBUG)
|
|
|
|
|
include_directories(${LIBLLDB_INCLUDE_DIRS})
|
|
|
|
|
find_package_handle_standard_args(liblldb DEFAULT_MSG LIBLLDB_LIBRARIES LIBLLDB_INCLUDE_DIRS)
|
|
|
|
|
else()
|
|
|
|
|
set(LIBLLDB_LIBRARIES "")
|
|
|
|
|
message("liblldb not found. Building juCi++ without debugging support")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES .*BSD|DragonFly)
|
|
|
|
|
add_definitions(-DJUCI_USE_UCTAGS) # See https://svnweb.freebsd.org/ports?view=revision&revision=452957
|
|
|
|
|
add_definitions(-DJUCI_USE_GREP_EXCLUDE) # --exclude-dir is not an argument in bsd grep
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# For both src and tests targets
|
|
|
|
|
include_directories(
|
|
|
|
|
${Boost_INCLUDE_DIRS}
|
|
|
|
|
${GTKMM_INCLUDE_DIRS}
|
|
|
|
|
${GTKSVMM_INCLUDE_DIRS}
|
|
|
|
|
${LIBCLANG_INCLUDE_DIRS}
|
|
|
|
|
${ASPELL_INCLUDE_DIR}
|
|
|
|
|
${LIBGIT2_INCLUDE_DIRS}
|
|
|
|
|
${PYTHON_INCLUDE_DIRS}
|
|
|
|
|
${PYGOBJECT_INCLUDE_DIRS}
|
|
|
|
|
${CMAKE_SOURCE_DIR}/lib/pybind11/include
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_subdirectory("src")
|
|
|
|
|
|
|
|
|
|
if(BUILD_TESTING OR BUILD_FUZZING)
|
|
|
|
|
if(BUILD_TESTING)
|
|
|
|
|
enable_testing()
|
|
|
|
|
endif()
|
|
|
|
|
add_subdirectory(tests)
|
|
|
|
|
endif()
|