clip icon indicating copy to clipboard operation
clip copied to clipboard

option to exclude image support

Open lunu-bounir opened this issue 3 years ago • 6 comments

In my application, I only need to copy and paste text content. Is it possible to remove the compiling of image.cpp to reduce the dependencies and size?

lunu-bounir avatar Oct 24 '20 07:10 lunu-bounir

Hi there @lunu-bounir, sure, we could add some option in the CMakeLists.txt to exclude the image support. I'll take this next week.

dacap avatar Oct 24 '20 11:10 dacap

@dacap great!

btw, is it possible to generate MT_StaticRelease instead of MD_DynamicRelease

cmake --build . --target clip --config Release

lunu-bounir avatar Oct 24 '20 11:10 lunu-bounir

You can use the https://cmake.org/cmake/help/v3.19/variable/CMAKE_USER_MAKE_RULES_OVERRIDE.html for that in your own project.

You can check an example: https://github.com/aseprite/laf/blob/9c3092901416ed0aef85b49f33ad514c7988cfa4/CMakeLists.txt#L7 https://github.com/aseprite/laf/blob/master/cmake/c_flag_overrides.cmake https://github.com/aseprite/laf/blob/master/cmake/cxx_flag_overrides.cmake

All that before you include the add_subdirectory(clip)

In case that you want to compile clip standalone (without a parent project), you can configure the flags from the command line:

cmake -D "CMAKE_C_FLAGS:STRING=..." -D "CMAKE_CXX_FLAGS:STRING=..." ...

dacap avatar Oct 24 '20 12:10 dacap

I don't seem to be able to make it work. Based on your suggestion I use:

git clone --branch "v1.2" https://github.com/dacap/clip

cd clip
  cmake -D "CMAKE_C_FLAGS:STRING=/MT /O2 /Ob2 /D NDEBUG" -D "CMAKE_CXX_FLAGS:STRING=/MT /O2 /Ob2 /D NDEBUG" .
  cmake --build . --target clip --config Release
cd ..

Used in:

cl.exe /D NDEBUG /c /W3 /WX- /EHsc /MT extra/win.cpp

Here is the error I get

clip.lib(clip.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in win.obj

lunu-bounir avatar Oct 24 '20 13:10 lunu-bounir

🤔 I'm not sure about this one, I should give a try on my Windows notebook.

You can take a look to your CMakeCache.txt file in the build directory and check the values of CMAKE_CXX_FLAGS and CMAKE_CXX_FLAGS_RELEASE (maybe CMAKE_CXX_FLAGS_RELEASE is using /MD). You could try editing the file manually to use the proper flags in CMAKE_CXX_FLAGS_RELEASE:STRING=... (or just replace /MD by /MT in the whole file, it's something I've done before in some projects).

dacap avatar Oct 25 '20 23:10 dacap

Thanks @dacap, I'll figure it out.

lunu-bounir avatar Oct 26 '20 09:10 lunu-bounir