Skip to content

Commit

Permalink
Correct cmake variables
Browse files Browse the repository at this point in the history
* correct cmake install target condition

The cmake variable BUILD_INSTALLER was renamed to
MATPLOTPP_BUILD_INSTALLER, but it was not updated in
source/matplot/CMakeLists.txt. As a result Matplot++ was not installed
completely via cmake install target with cmake presets provided.

This patch completes the renaming and now cmake install works as
expected.

* correct more cmake variable names after rename

I found more variables that seemed to be missed by the recent renaming.
This patch completes renaming of variables:
  - BUILD_FOR_DOCUMENTATION_IMAGES
  - BUILD_HIGH_RESOLUTION_WORLD_MAP
  - BUILD_WITH_PEDANTIC_WARNINGS
  - BUILD_EXPERIMENTAL_OPENGL_BACKEND
  • Loading branch information
david-x64 authored Feb 17, 2023
1 parent 7b757c0 commit e8b3e31
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmake/functions/target_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endfunction()

# @brief Maybe enable pedantic warnings for a target
function(maybe_target_pedantic_warnings TARGET_NAME)
if (BUILD_WITH_PEDANTIC_WARNINGS)
if (MATPLOTPP_BUILD_WITH_PEDANTIC_WARNINGS)
target_pedantic_warnings(${TARGET_NAME})
endif ()
endfunction ()
Expand All @@ -30,7 +30,7 @@ endmacro()

# @brief Maybe set pedantic compiler options for all targets
macro(maybe_add_pedantic_warnings)
if (BUILD_WITH_PEDANTIC_WARNINGS)
if (MATPLOTPP_BUILD_WITH_PEDANTIC_WARNINGS)
add_pedantic_warnings()
endif ()
endmacro()
Expand Down Expand Up @@ -93,4 +93,4 @@ endfunction()
# based on check_symbol_exists hasn't been enough.
function(target_nominmax_definition TARGET_NAME)
target_compile_definitions(${TARGET_NAME} PUBLIC NOMINMAX)
endfunction()
endfunction()
2 changes: 1 addition & 1 deletion index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2215,7 +2215,7 @@ There are two dependencies in [`source/3rd_party`](source/3rd_party). These depe

You can define `WITH_SYSTEM_NODESOUP=ON` or `WITH_SYSTEM_CIMG=ON` in the cmake command line to use a system-provided version of these dependencies.

There's an extra target `matplot_opengl` with the experimental [OpenGL backend](#backends). You need to define `BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON` in the CMake command line to build that target. In that case, the build script will also look for these extra dependencies:
There's an extra target `matplot_opengl` with the experimental [OpenGL backend](#backends). You need to define `MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON` in the CMake command line to build that target. In that case, the build script will also look for these extra dependencies:

* OpenGL
* GLAD
Expand Down
10 changes: 5 additions & 5 deletions source/matplot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ if (HAVE_FBUFSIZE)
endif()

# Build for documentation
if (BUILD_FOR_DOCUMENTATION_IMAGES)
if (MATPLOTPP_BUILD_FOR_DOCUMENTATION_IMAGES)
message("Building matplot for documentation images. wait() commands will be ignored. ~figure will save the files.")
target_compile_definitions(matplot PUBLIC MATPLOT_BUILD_FOR_DOCUMENTATION_IMAGES)
endif ()

# Include high-resolution world map in the binary
if (BUILD_HIGH_RESOLUTION_WORLD_MAP)
if (MATPLOTPP_BUILD_HIGH_RESOLUTION_WORLD_MAP)
target_compile_definitions(matplot PUBLIC MATPLOT_BUILD_HIGH_RESOLUTION_WORLD_MAP)
else ()
message("Not including the high resolution maps for geoplots")
Expand All @@ -163,7 +163,7 @@ endif ()
# Maybe add pedantic warning


#if (BUILD_WITH_PEDANTIC_WARNINGS)
#if (MATPLOTPP_BUILD_WITH_PEDANTIC_WARNINGS)
# if (MSVC)
# target_compile_options(matplot PRIVATE /W4 /WX)
# else ()
Expand All @@ -182,7 +182,7 @@ endif ()
#######################################################
### Experimental OpenGL backend ###
#######################################################
if (BUILD_EXPERIMENTAL_OPENGL_BACKEND)
if (MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND)
# Library for the OpenGL example
# This is an example of what an OpenGL backend *could* look like.
# The opengl backend is currently incomplete.
Expand Down Expand Up @@ -252,7 +252,7 @@ endif()
#######################################################
### Installer ###
#######################################################
if (BUILD_INSTALLER)
if (MATPLOTPP_BUILD_INSTALLER)
# Install targets
install(TARGETS matplot
EXPORT Matplot++Targets
Expand Down
4 changes: 2 additions & 2 deletions test/backends/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
if (BUILD_EXPERIMENTAL_OPENGL_BACKEND)
if (MATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND)
# Use this to create an OpenGL window as backend
add_executable(matplot_opengl_test ogl_main.cpp)
target_link_libraries(matplot_opengl_test PUBLIC matplot_opengl)

# Use this to create plots inside an existing OpenGL application
add_executable(matplot_opengl_embed_test ogl_embed_main.cpp)
target_link_libraries(matplot_opengl_embed_test PUBLIC matplot_opengl)
endif ()
endif ()
2 changes: 1 addition & 1 deletion test/generate_examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This is a visual unit test where the `generate_examples` target will run all oth

Everytime we update the library, we regenerate the examples to make sure everything is not only working ok but also *looking* good.

The library needs to be compiled with the CMake option `BUILD_FOR_DOCUMENTATION_IMAGES` for this test to work. Also, you need to run this target from the project root directory so that the filesystem can find the build and documentation directories.
The library needs to be compiled with the CMake option `MATPLOTPP_BUILD_FOR_DOCUMENTATION_IMAGES` for this test to work. Also, you need to run this target from the project root directory so that the filesystem can find the build and documentation directories.
2 changes: 1 addition & 1 deletion test/generate_examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <regex>

int main() {
// Set CMake option BUILD_FOR_DOCUMENTATION_IMAGES to ON and
// Set CMake option MATPLOTPP_BUILD_FOR_DOCUMENTATION_IMAGES to ON and
// run this executable from the root directory as working
// directory to run all examples.
// If will set 1) the figure object to save the figure when being destroyed
Expand Down

0 comments on commit e8b3e31

Please sign in to comment.