Skip to content

Commit

Permalink
Merge pull request #21 from plusk01/cmake
Browse files Browse the repository at this point in the history
Polish up came config
  • Loading branch information
fbbdev authored Dec 9, 2020
2 parents 11eb425 + 9baaf1d commit ac9c4dc
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,33 @@ endif()

set(CMAKE_CXX_STANDARD 14)

set(HEADER_FILES
include/braille.hpp
include/color.hpp
include/colors.hpp
include/layout.hpp
include/plot.hpp
include/point.hpp
include/real_canvas.hpp
include/rect.hpp
include/string_view.hpp
include/terminal.hpp
include/unicode_data.hpp
include/unicode_structs.hpp
include/unicode.hpp
include/utils.hpp)

string(REGEX REPLACE "([^;]+)" "${CMAKE_CURRENT_SOURCE_DIR}/\\1" HEADER_FILES "${HEADER_FILES}")

add_library(plot INTERFACE)
target_sources(plot INTERFACE ${HEADER_FILES})
target_include_directories(plot INTERFACE include)

option(BUILD_SINGLE_HEADER "Pack all headers into a single header library" OFF)
option(BUILD_EXAMPLES "Build plot examples" ON)

if(BUILD_SINGLE_HEADER)
find_package(PythonInterp 3 REQUIRED)

set(HEADER_FILES
include/braille.hpp
include/color.hpp
include/colors.hpp
include/layout.hpp
include/plot.hpp
include/point.hpp
include/real_canvas.hpp
include/rect.hpp
include/string_view.hpp
include/terminal.hpp
include/unicode_data.hpp
include/unicode_structs.hpp
include/unicode.hpp
include/utils.hpp)

string(REGEX REPLACE "([^;]+)" "${CMAKE_CURRENT_SOURCE_DIR}/\\1" HEADER_FILES "${HEADER_FILES}")

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/plot.hpp"
COMMAND "${PYTHON_EXECUTABLE}" "scripts/pack.py" "${CMAKE_CURRENT_SOURCE_DIR}/include/plot.hpp" > "${CMAKE_CURRENT_BINARY_DIR}/plot.hpp"
Expand All @@ -66,6 +67,7 @@ if(BUILD_SINGLE_HEADER)
single-header ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/plot.hpp")
endif()

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")

add_subdirectory(examples)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

0 comments on commit ac9c4dc

Please sign in to comment.