Skip to content

Commit

Permalink
fix: cmake interface library
Browse files Browse the repository at this point in the history
  • Loading branch information
plusk01 committed Dec 9, 2020
1 parent 11eb425 commit caaa4ee
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@ 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)

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 +66,4 @@ 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)

0 comments on commit caaa4ee

Please sign in to comment.