Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't figure out how to include in a Cmake project #2729

Open
sbowman opened this issue Aug 31, 2023 · 9 comments
Open

Can't figure out how to include in a Cmake project #2729

sbowman opened this issue Aug 31, 2023 · 9 comments
Assignees
Labels
bug Something isn't working macOS
Milestone

Comments

@sbowman
Copy link

sbowman commented Aug 31, 2023

I've tried both FetchContent and using a homebrew install (on macOS) of notcurses and just using find_package(Notcurses CONFIG REQUIRED), but I can't manage to get notcurses to install correctly.

I think notcurses isn't configuring itself correctly in its .cmake files. When I try to reference Notcurses_INCLUDE_DIRS, it's blank. And when I look in the .cmake files, it's blank. The libraries get configured properly, though.

Now I'm not a particularly advanced C++ developer, so I could be doing something wrong. Do you perhaps have a sample app that's using CmakeLists.txt so I can get a sense of how I should be building this? Or should I be including notcurses as a submodule and building it with my app?

@sbowman sbowman added the userquestion not quite bugs--inquiries from users label Aug 31, 2023
@dankamongmen dankamongmen self-assigned this Aug 31, 2023
@dankamongmen dankamongmen added this to the 3.1.0 milestone Aug 31, 2023
@dankamongmen
Copy link
Owner

I've got a mac here I can boot up if need be. Into what directories are the Notcurses .h and .so files being installed?

@sbowman
Copy link
Author

sbowman commented Aug 31, 2023

If I use brew install notcurses, notcurses is installed into /usr/local/Cellar/notcurses/3.0.9_2. In that folder, there's bin, include, lib and shared folders.

In the lib folder, there's a cmake folder (/usr/local/Cellar/notcurses/3.0.9_2/lib/cmake. There's three folders in there for Notcurses, Notcurses++, and NotcursesCore. Inside those folders are the .cmake files. If I open up say lib/cmake/Notcurses/NotcursesConfig.cmake, it contains the following:

####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
####### Any changes to this file will be overwritten by the next CMake run ####
####### The input file was NotcursesConfig.cmake.in                            ########

get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)

macro(set_and_check _var _file)
  set(${_var} "${_file}")
  if(NOT EXISTS "${_file}")
    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
  endif()
endmacro()

macro(check_required_components _NAME)
  foreach(comp ${${_NAME}_FIND_COMPONENTS})
    if(NOT ${_NAME}_${comp}_FOUND)
      if(${_NAME}_FIND_REQUIRED_${comp})
        set(${_NAME}_FOUND FALSE)
      endif()
    endif()
  endforeach()
endmacro()

####################################################################################
set(Notcurses_DIR "")

# Compute paths
get_filename_component(Notcurses_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(Notcurses_INCLUDE_DIRS "")
set(Notcurses_LIBRARY_DIRS "")

set(Notcurses_LIBRARIES -lnotcurses-core -lnotcurses)

I feel like from some of the samples I've found online that Notcurses_INCLUDE_DIRS should have values in it?

@dankamongmen
Copy link
Owner

yeah, if it's being installed to /usr/local it ought probably be populated.

can you run the tools e.g. notcurses-info?

i'll look into this as soon as i can. feel free to take a pass yourself if you're capable!

@dankamongmen dankamongmen added bug Something isn't working macOS and removed userquestion not quite bugs--inquiries from users labels Aug 31, 2023
@sbowman
Copy link
Author

sbowman commented Sep 1, 2023

Here's notcurses-info output:

notcurses 3.0.9 on Kitty 0.29.2 (macOS 13.5)
50 rows (36px) 147 cols (17px) 1800x2499 rgb+256 colors
Apple LLVM 14.0.3 (clang-1403.0.22.14.1) (LE)
terminfo 6.4.20221231 libdeflate 1.18 GPM n/a
avformat 60.3.100 avutil 58.2.100 swscale 7.1.100 avcodec 60.3.100
af+ ab+ sum- vpa+ hpa+ sgr0+ op+ fgop+ bgop+ bce- rect-                         
bold+ ital+ struck+ ucurl+ uline+ u7+ ccc+ rgb+ el+                             
utf8+ 2x1+ 2x2+ 3x2- 4x2+ img+ vid+ indn+ gpm- kbd+                             
default fg 0xdddddd default bg 0x000000 pmouse+                                 
1st gen rgba pixel animation support                   🯁🯂🯃https://notcurses.com 
 ▘▝▀▖▌▞▛▗▚▐▜▄▙▟█⎧ 🬀🬁🬂🬃🬄🬅🬆🬇🬈🬊🬋🬌🬍🬎🬏🬐🬑🬒🬓▌🬔🬕🬖🬗🬘🬙🬚🬛🬜🬝⎫♠♥🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹⅗⅘⅙⅚⅛⎧▕▏⎫┌╥─╥─╥┐🭩⎛⎞
╲╿╱ ◨◧ ◪◩ ◖◗ ⫷⫸ ⎩🬟🬠🬡🬢🬣🬤🬥🬦🬧▐🬨🬩🬪🬫🬬🬭🬮🬯🬰🬱🬲🬳🬴🬵🬶🬷🬸🬹🬺🬻█⎭♦♣¼½¾⅐⅑⅒⅓⅔⅕⅖⅜⅝⅞⅟↉⎪🮇▎⎪├╜╓╫╖╙┤🭫⎜⎟
╾╳╼ ◲◱ ◶◵ 🮣🮠 🮤🮥◜◝ ◿◺ 🮞🮟 ◢◣ ┌┐─ ┏┓━ ╭╮─ ╔╗═ 🭽🭾▁♟♜♞⩘▵△▹▷▿▽◃◁⭡⭣⭠⭢⭧⭩⭦⭨⎪🮈▍⎪├─╨╫╨─┤┇⎜⎟
╱╽╲ ◳◰ ◷◴ 🮡🮢 🮦🮧◟◞ ◹◸ 🮝🮜 ◥◤ └┘│ ┗┛┃ ╰╯│ ╚╝║ 🭼🭿🭵♝♛♚⩗▴⏶⯅▲▸⏵⯈▶▾⏷⯆▼◂⏴⯇◀⎪▐▌⎪╞═╤╬╤═╡┋⎜⎟
⎡⠀⠁⠈⠉⠂⠃⠊⠋⠐⠑⠘⠙⠒⠓⠚⠛⠄⠅⠌⠍⠆⠇⠎⠏⠔⠕⠜⠝⠖⠗⠞⠟⠠⠡⠨⠩⠢⠣⠪⠫⠰⠱⠸⠹⠲⠳⠺⠻⠤⠥⠬⠭⠦⠧⠮⠯⠴⠵⠼⠽⠶⠷⠾⠿⎤⎨🮉▋⎬╞╕╘╬╛╒╡┊⎜⎟
⎢⡀⡁⡈⡉⡂⡃⡊⡋⡐⡑⡘⡙⡒⡓⡚⡛⡄⡅⡌⡍⡆⡇⡎⡏⡔⡕⡜⡝⡖⡗⡞⡟⡠⡡⡨⡩⡢⡣⡪⡫⡰⡱⡸⡹⡲⡳⡺⡻⡤⡥⡬⡭⡦⡧⡮⡯⡴⡵⡼⡽⡶⡷⡾⡿⎥⎪🮊▊⎪└┴─╨─┴┘╏⎝⎠
⎢⢀⢁⢈⢉⢂⢃⢊⢋⢐⢑⢘⢙⢒⢓⢚⢛⢄⢅⢌⢍⢆⢇⢎⢏⢔⢕⢜⢝⢖⢗⢞⢟⢠⢡⢨⢩⢢⢣⢪⢫⢰⢱⢸⢹⢲⢳⢺⢻⢤⢥⢬⢭⢦⢧⢮⢯⢴⢵⢼⢽⢶⢷⢾⢿⎥⎪🮋▉⎪╭──╮⟬⟭╔╗≶≷
⎣⣀⣁⣈⣉⣂⣃⣊⣋⣐⣑⣘⣙⣒⣓⣚⣛⣄⣅⣌⣍⣆⣇⣎⣏⣔⣕⣜⣝⣖⣗⣞⣟⣠⣡⣨⣩⣢⣣⣪⣫⣰⣱⣸⣹⣲⣳⣺⣻⣤⣥⣬⣭⣦⣧⣮⣯⣴⣵⣼⣽⣶⣷⣾⣿⎦⎪██⎪│╭╮│╔═╝║⊆⊇
 ▔🭶🭷🭸🭹🭺🭻▁ 🭁🭌 🭂🭍 🭃🭎 🭄🭏 🭅🭐 🭆🭑 🭇🬼 🭈🬽 🭉🬾 🭊🬿 🭋🭀 ₀₁₂₃₄₅₆₇₈₉ ⎛ ▁▂▃▄▅▆▇█🭫⎞⎪🭨🭪⎪╰╯││║╔═╝⊴⊵
 ▏🭰🭱🭲🭳🭴🭵▕ 🭒🭝 🭓🭞 🭔🭟 🭕🭠 🭖🭡 🭧🭜 🭢🭗 🭣🭘 🭤🭙 🭥🭚 🭦🭛 ⁰¹²³⁴⁵⁶⁷⁸⁹ ⎝ ▔🮂🮃▀🮄🮅🮆█🭩⎠⎩🭪🭨⎭⧒⧑╰╯╚╝❨❩⟃⟄
👾🏴🤘🚬🌍🌎🌏🥆💣🗡🔫⚗️⚛️☢️☣️🌿🎱🏧💉💊🕴️📡🤻🦑🇦🇶👩‍🔬🪤🚱✊🏿🔬🧬🏴‍☠️🤽🏼‍♀️                              
17 renders, 4.26ms (214.00µs min, 250.71µs avg, 523.00µs max)
17 rasters, 1.82ms (79.00µs min, 107.06µs avg, 137.00µs max)
17 writes, 3.14ms (45.00µs min, 184.88µs avg, 2.32ms max)
135.37KiB (88B min, 7.96KiB avg, 131.90KiB max) 54 inputs Ghpa: 0
0 failed renders, 0 failed rasters, 0 refreshes, 0 input errors
RGB emits:elides: def 2:1296 fg 1:2473 bg 1176:0
Cell emits:elides: 2474:247338 (99.01%) 99.85% 99.96% 0.00%
Bmap emits:elides: 1:0 (0.00%) 107.49KiB (79.40%) SuM: 0 (0.00%)

@sbowman
Copy link
Author

sbowman commented Sep 1, 2023

Which obviously looks better in the terminal

@dankamongmen
Copy link
Owner

ok, so programs are running fine. thanks for confirming that.

@spinicist
Copy link
Contributor

By coincidence I discovered Notcurses today, installed via brew and then promptly hit this exact problem. I'm not familiar enough with brew to know where this needs to be fixed?

@spinicist
Copy link
Contributor

Hi, I'd really like to help out with fixing this, but I am right at the edge of my CMake knowledge.

I think the problem lies in the .cmake.in files. However I can't find a good tutorial/documentation for these on the CMake website.

Qualitatively, the notcurses ones, e.g. https://github.com/dankamongmen/notcurses/blob/master/tools/NotcursesConfig.cmake.in look different to other ones I can find in well known projects, e.g. https://github.com/fmtlib/fmt/blob/master/support/cmake/fmt-config.cmake.in

In particular, I cannot find any mention of the CONF_INCLUDE_DIRS and CONF_LIBRARY_DIRS variables that are referenced by notcurses. Which I think fits with the observed behaviour above - if those variables don't exist, CMake will substitute an empty string, and we end up with the empty paths in the generated .cmake files.

But I'm not sure where to go from here. Any suggestions on what to try?

@spinicist
Copy link
Contributor

(Apologies for separate posts)

I am pretty sure the same thing happens in the Linux CMake files - the INCLUDE_DIRS and LIBRARY_DIRS strings are empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working macOS
Projects
None yet
Development

No branches or pull requests

3 participants