Comments (12)
Other option would not be to make cpp-terminal-platforms STATIC ?
Marking cpp-terminal-platforms as STATIC can solve the problem.
❯ git diff diff --git a/cpp-terminal/platforms/CMakeLists.txt b/cpp-terminal/platforms/CMakeLists.txt index f886fee..f878d7c 100644 --- a/cpp-terminal/platforms/CMakeLists.txt +++ b/cpp-terminal/platforms/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(cpp-terminal-platforms terminal.cpp tty.cpp terminfo.cpp input.cpp screen.cpp cursor.cpp) +add_library(cpp-terminal-platforms STATIC terminal.cpp tty.cpp terminfo.cpp input.cpp screen.cpp cursor.cpp) target_link_libraries(cpp-terminal-platforms PRIVATE Warnings::Warnings) target_compile_options(cpp-terminal-platforms PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/utf-8 /wd4668 /wd4514>) target_include_directories(cpp-terminal-platforms PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> $<INSTALL_INTERFACE:include>) ruby in 🌐 fedora in cpp-terminal on master [!] via △ v3.26.3 ❯ rm -rf build/ && cmake . -B build -DBUILD_SHARED_LIBS=ON && cmake --build build/ -j6 -- The CXX compiler identification is GNU 13.0.1 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (0.2s) -- Generating done (0.0s) -- Build files have been written to: /home/ruby/build/cpp-terminal/build [ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/terminal.cpp.o [ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/tty.cpp.o [ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/terminfo.cpp.o [ 8%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/screen.cpp.o [ 10%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/input.cpp.o [ 12%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/cursor.cpp.o [ 14%] Linking CXX static library libcpp-terminal-platforms.a [ 14%] Built target cpp-terminal-platforms [ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/prompt.cpp.o [ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/input.cpp.o [ 24%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/color.cpp.o [ 26%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/key.cpp.o [ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/window.cpp.o [ 22%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal.cpp.o [ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/event.cpp.o [ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/screen.cpp.o [ 32%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/options.cpp.o [ 34%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/cursor.cpp.o [ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/io.cpp.o [ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/style.cpp.o [ 40%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/version.cpp.o [ 42%] Linking CXX shared library libcpp-terminal.so [ 42%] Built target cpp-terminal [ 55%] Building CXX object examples/CMakeFiles/cin.dir/cin.cpp.o [ 55%] Building CXX object examples/CMakeFiles/prompt_multiline.dir/prompt_multiline.cpp.o [ 55%] Building CXX object tests/CMakeFiles/test_terminal.dir/test_terminal.cpp.o [ 55%] Building CXX object examples/CMakeFiles/minimal.dir/minimal.cpp.o [ 55%] Building CXX object examples/CMakeFiles/prompt_immediate.dir/prompt_immediate.cpp.o [ 55%] Building CXX object tests/CMakeFiles/AttachConsole.dir/attach_console.test.cpp.o [ 63%] Linking CXX executable AttachConsole [ 63%] Linking CXX executable prompt_multiline [ 63%] Linking CXX executable minimal [ 63%] Linking CXX executable cin [ 65%] Linking CXX executable prompt_immediate [ 67%] Linking CXX executable test_terminal [ 67%] Built target AttachConsole [ 67%] Built target minimal [ 67%] Built target prompt_immediate [ 67%] Built target cin [ 67%] Built target prompt_multiline [ 71%] Building CXX object examples/CMakeFiles/prompt_simple.dir/prompt_simple.cpp.o [ 73%] Building CXX object examples/CMakeFiles/kilo.dir/kilo.cpp.o [ 73%] Building CXX object examples/CMakeFiles/prompt_not_immediate.dir/prompt_not_immediate.cpp.o [ 75%] Building CXX object examples/CMakeFiles/menu_window.dir/menu_window.cpp.o [ 77%] Building CXX object examples/CMakeFiles/menu.dir/menu.cpp.o [ 85%] Linking CXX executable prompt_not_immediate [ 85%] Linking CXX executable prompt_simple [ 85%] Linking CXX executable kilo [ 85%] Linking CXX executable menu [ 85%] Built target test_terminal [ 87%] Linking CXX executable menu_window [ 89%] Building CXX object examples/CMakeFiles/keys.dir/keys.cpp.o /home/ruby/build/cpp-terminal/examples/keys.cpp: In function ‘int main()’: /home/ruby/build/cpp-terminal/examples/keys.cpp:66:15: warning: case value ‘525’ not in enumerated type ‘Term::Key::Value’ [-Wswitch] 66 | case Term::Key::ALT + Term::Key::ENTER: s = "Alt+ENTER"; break; | ^~~~ [ 91%] Linking CXX executable keys [ 91%] Built target prompt_simple [ 91%] Built target prompt_not_immediate [ 91%] Built target menu [ 91%] Built target menu_window [ 91%] Built target kilo [ 95%] Building CXX object examples/CMakeFiles/colors.dir/colors.cpp.o [ 95%] Building CXX object examples/CMakeFiles/read_stdin.dir/read_stdin.cpp.o [100%] Linking CXX executable read_stdin [100%] Linking CXX executable colors [100%] Built target keys [100%] Built target colors [100%] Built target read_stdinbtw, I have a suggestion about the doctest library of the tests, maybe we can first use
find_package(doctest)
first, if not found, then use FetchContent to get it. I also do not konw the logic here, if cmake > 3.11, fetch doctest, else use find_package to find doctest?cpp-terminal/tests/CMakeLists.txt
Lines 5 to 23 in f498906
I don't want yo rely on system install... So i fetch it with the version I want... Cmake before 3.11 have no fetcontent so i try to find the package (even if i don't like this)
from cpp-terminal.
@topazus Thx for the fix I will do a PR. Strange this it's not happening in my computer. Other option would not be to make cpp-terminal-platforms STATIC ? I would like to completly hide cpp-terminal-platforms to the user
from cpp-terminal.
cpp-terminal/cpp-terminal/window.hpp
Lines 1 to 5 in f498906
I am very well known with CMake. Maybe the public header file
window.hpp
of cpp-terminal
includes header filemacros.hpp
of cpp-terminal-platforms
?ref: https://cmake.org/pipermail/cmake/2019-December/070305.html
Continuing with the example I used above, if the public headers of the
middle library refer to anything from the inner library, then
target_link_libraries() should specify PUBLIC, regardless of whether middle
or inner are static or shared libraries.
from cpp-terminal.
It seems the problem is not an header problem but the linker problem... In the cin function that is inlined so the store_and_restore is not linked correctly.. what is strange is that kt is working on CI
from cpp-terminal.
@topazus could you provide your CC CXX environment variables? Or tell my the fedora ones
from cpp-terminal.
The default is gcc and g++.
from cpp-terminal.
The above build errors appeared when linking to libcpp-terminal-platforms.so, but the cpp-terminal links PRIVATE to cpp-terminal-platforms, which compiled target cpp-terminal-platforms is only visible to cpp-terminal, not available to the target that links cpp-terminal.
from cpp-terminal.
Other option would not be to make cpp-terminal-platforms STATIC ?
Marking cpp-terminal-platforms as STATIC can solve the problem.
build log
❯ git diff
diff --git a/cpp-terminal/platforms/CMakeLists.txt b/cpp-terminal/platforms/CMakeLists.txt
index f886fee..f878d7c 100644
--- a/cpp-terminal/platforms/CMakeLists.txt
+++ b/cpp-terminal/platforms/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_library(cpp-terminal-platforms terminal.cpp tty.cpp terminfo.cpp input.cpp screen.cpp cursor.cpp)
+add_library(cpp-terminal-platforms STATIC terminal.cpp tty.cpp terminfo.cpp input.cpp screen.cpp cursor.cpp)
target_link_libraries(cpp-terminal-platforms PRIVATE Warnings::Warnings)
target_compile_options(cpp-terminal-platforms PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/utf-8 /wd4668 /wd4514>)
target_include_directories(cpp-terminal-platforms PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}> $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}> $<INSTALL_INTERFACE:include>)
ruby in 🌐 fedora in cpp-terminal on master [!] via △ v3.26.3
❯ rm -rf build/ && cmake . -B build -DBUILD_SHARED_LIBS=ON && cmake --build build/ -j6
-- The CXX compiler identification is GNU 13.0.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ruby/build/cpp-terminal/build
[ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/terminal.cpp.o
[ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/tty.cpp.o
[ 6%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/terminfo.cpp.o
[ 8%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/screen.cpp.o
[ 10%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/input.cpp.o
[ 12%] Building CXX object cpp-terminal/platforms/CMakeFiles/cpp-terminal-platforms.dir/cursor.cpp.o
[ 14%] Linking CXX static library libcpp-terminal-platforms.a
[ 14%] Built target cpp-terminal-platforms
[ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/prompt.cpp.o
[ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/input.cpp.o
[ 24%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/color.cpp.o
[ 26%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/key.cpp.o
[ 20%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/window.cpp.o
[ 22%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/terminal.cpp.o
[ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/event.cpp.o
[ 30%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/screen.cpp.o
[ 32%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/options.cpp.o
[ 34%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/cursor.cpp.o
[ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/io.cpp.o
[ 38%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/style.cpp.o
[ 40%] Building CXX object cpp-terminal/CMakeFiles/cpp-terminal.dir/version.cpp.o
[ 42%] Linking CXX shared library libcpp-terminal.so
[ 42%] Built target cpp-terminal
[ 55%] Building CXX object examples/CMakeFiles/cin.dir/cin.cpp.o
[ 55%] Building CXX object examples/CMakeFiles/prompt_multiline.dir/prompt_multiline.cpp.o
[ 55%] Building CXX object tests/CMakeFiles/test_terminal.dir/test_terminal.cpp.o
[ 55%] Building CXX object examples/CMakeFiles/minimal.dir/minimal.cpp.o
[ 55%] Building CXX object examples/CMakeFiles/prompt_immediate.dir/prompt_immediate.cpp.o
[ 55%] Building CXX object tests/CMakeFiles/AttachConsole.dir/attach_console.test.cpp.o
[ 63%] Linking CXX executable AttachConsole
[ 63%] Linking CXX executable prompt_multiline
[ 63%] Linking CXX executable minimal
[ 63%] Linking CXX executable cin
[ 65%] Linking CXX executable prompt_immediate
[ 67%] Linking CXX executable test_terminal
[ 67%] Built target AttachConsole
[ 67%] Built target minimal
[ 67%] Built target prompt_immediate
[ 67%] Built target cin
[ 67%] Built target prompt_multiline
[ 71%] Building CXX object examples/CMakeFiles/prompt_simple.dir/prompt_simple.cpp.o
[ 73%] Building CXX object examples/CMakeFiles/kilo.dir/kilo.cpp.o
[ 73%] Building CXX object examples/CMakeFiles/prompt_not_immediate.dir/prompt_not_immediate.cpp.o
[ 75%] Building CXX object examples/CMakeFiles/menu_window.dir/menu_window.cpp.o
[ 77%] Building CXX object examples/CMakeFiles/menu.dir/menu.cpp.o
[ 85%] Linking CXX executable prompt_not_immediate
[ 85%] Linking CXX executable prompt_simple
[ 85%] Linking CXX executable kilo
[ 85%] Linking CXX executable menu
[ 85%] Built target test_terminal
[ 87%] Linking CXX executable menu_window
[ 89%] Building CXX object examples/CMakeFiles/keys.dir/keys.cpp.o
/home/ruby/build/cpp-terminal/examples/keys.cpp: In function ‘int main()’:
/home/ruby/build/cpp-terminal/examples/keys.cpp:66:15: warning: case value ‘525’ not in enumerated type ‘Term::Key::Value’ [-Wswitch]
66 | case Term::Key::ALT + Term::Key::ENTER: s = "Alt+ENTER"; break;
| ^~~~
[ 91%] Linking CXX executable keys
[ 91%] Built target prompt_simple
[ 91%] Built target prompt_not_immediate
[ 91%] Built target menu
[ 91%] Built target menu_window
[ 91%] Built target kilo
[ 95%] Building CXX object examples/CMakeFiles/colors.dir/colors.cpp.o
[ 95%] Building CXX object examples/CMakeFiles/read_stdin.dir/read_stdin.cpp.o
[100%] Linking CXX executable read_stdin
[100%] Linking CXX executable colors
[100%] Built target keys
[100%] Built target colors
[100%] Built target read_stdin
cpp-terminal/tests/CMakeLists.txt
Lines 5 to 23 in f498906
from cpp-terminal.
The above build errors appeared when linking to libcpp-terminal-platforms.so, but the cpp-terminal links PRIVATE to cpp-terminal-platforms, which compiled target cpp-terminal-platforms is only visible to cpp-terminal, not available to the target that links cpp-terminal.
This is indeed what I want to have.. I guess your linux add some other options to gcc by default because on the CI Ubuntu there is no compilation errors.
from cpp-terminal.
@topazus STATIC is done in other PR that is waiting to be merged
from cpp-terminal.
@topazus this is fixed now?
from cpp-terminal.
Thanks.
from cpp-terminal.
Related Issues (20)
- Flickering HOT 20
- Windows terminal can be turned into `legacy mode` and so crash our ANSII support detection
- example 'kilo' does not support special characters HOT 7
- exception leaking destructor is dangerous HOT 10
- Compiling the examples with GCC results in errors HOT 7
- Create a list of projects that are using this library HOT 3
- Bug: cpp-terminal crashes if two utf8 are inserted simultaneously HOT 42
- Multiline prompt stopped working on macOS
- Ctrl + I and Tab HOT 6
- Bug: Text Wrap Incompatibility HOT 6
- Bring back the list of other similar libraries HOT 4
- Pressing Ctrl, Alt, Shift creates a copy paste event on windows? HOT 3
- Addition of Metakey and Key results in warning of deprecation HOT 1
- Bug in key + metakey arithmetic HOT 7
- Exception thrown at this line when typeing to fast HOT 7
- mouse sending random characters to the terminal after examples/minimal ends HOT 8
- `std::cin` doesn't read pipe redirection HOT 8
- Issue with file headers HOT 3
- Doctest.h needs to be updated to the latest version - compile error on Ubuntu 22.04 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpp-terminal.