Select Git revision
FindXKBCommon.cmake
-
Jonas Ådahl authored
Adds libxkbcommon as a dependency when enabling the Wayland backend.
Jonas Ådahl authoredAdds libxkbcommon as a dependency when enabling the Wayland backend.
CMakeLists.txt 3.45 KiB
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
# SET (CMAKE_CXX_COMPILER "/usr/bin/clang++-15" CACHE STRING "C++ compiler" FORCE)
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
######################################################################################
# 1) Set your application properties up
######################################################################################
# Define your project name
project(MH_Builder)
# Define language
enable_language(C)
enable_language(CXX)
#set(CMAKE_C_COMPILER "/usr/bin/clang-15")
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++-15")
# Set your compilation options ("-g" for debug)
set(CMAKE_CXX_FLAGS "-std=c++20 -Wall -Wextra -DWITHOUT_NUMPY")
add_compile_options(-Wno-overloaded-virtual)
# For debug/release specific flags
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g --coverage -fprofile-arcs -ftest-coverage -lgcov")
# For test coverage
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage")
# Uncomment to build in debug mode (default: release mode)
set(CMAKE_BUILD_TYPE Debug)
######################################################################################
# 2) Setup standard paths
######################################################################################
# Include sources from /src
include_directories(${CMAKE_SOURCE_DIR}/src)
# Add external hypervolume library
add_subdirectory(external/hypervolume)
# Add /src-bin for binary compilation
# --> Requires a CMakeList.txt file in /src-bin
add_subdirectory(src-bin)
add_subdirectory(src-bin/mpl)
# set location of generated executables
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# Add /src for libraries compilation
# --> Requires a CMakeList.txt file in /src
add_subdirectory(src)
######################################################################################
# 3) Google Test
######################################################################################
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# Include tests from /tests
include_directories(${CMAKE_SOURCE_DIR}/tests ${gtest_SOURCE_DIR}/include)
# Add /tests for libraries compilation
# --> Requires a CMakeList.txt file in /tests
add_subdirectory(tests)
######################################################################################
# 4) Doxygen
######################################################################################
option(BUILD_DOC "Build Documentation" ON)
find_package(Doxygen)
if (DOXYGEN_FOUND)
if (NOT EXISTS ${BUILD_DOC_DIR})
set(BUILD_DOC_DIR ${CMAKE_SOURCE_DIR}/doxygen)
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
endif ()
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen build started")
add_custom_target(Doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else (DOXYGEN_FOUND)
message("Doxygen needs to be installed to generate the documentation.")
endif (DOXYGEN_FOUND)