c-smile / sciter-js-sdk

Sciter.JS - Sciter but with QuickJS on board instead of my TIScript
BSD 3-Clause "New" or "Revised" License
1.64k stars 97 forks source link

[Win32] Generate LIB from DLL for easier linking #292

Closed julianxhokaxhiu closed 2 years ago

julianxhokaxhiu commented 2 years ago

Hi,

I'm currently trying to kickstart my project on top of SciterJS and I'm currently in need in my CMake files to link your library. I'm fine linking it via dynamic DLL as you're currently providing, but when using find_library I'm in a scenario where my project is meant to compile statically but require only your dependency dynamically.

I'm currently doing this very same thing with the SteamSDK and they do provide a steam_api.lib file that can be linked against my project and then I need to deploy the exe and the steam_api.dll next to it to make sure it runs.

Could you maybe automate the publishing of this lib using something like this? https://www.asawicki.info/news_1420_generating_lib_file_for_dll_library Maybe you can find a better way to do so, but I hope you understood my requirement.

Feel free to ping me if I can be of any help.

Thank you in advance, Julian

c-smile commented 2 years ago

for easier linking

Not clear what problem do you have.

sciter.dll exposes only one function - SciterAPI and there is a function that loads the DLL and retrieves that function : https://github.com/c-smile/sciter-js-sdk/blob/main/include/sciter-x-api.h#L328

All other API functions are just inline thunks.

So why do you need that find_library with Sciter? What for?

julianxhokaxhiu commented 2 years ago

The main idea is that I'd like to achieve dynamic finding of your library through CMake. It's a very long story, but the idea is that find_library will allow to create a cached variable that gives the path to this file, after it's installed ( I'm using vcpkg ).

That find_library searches for lib files ( when the target is a static binary ) and is used inside a FindSCITERJS.cmake file that will allow me then later to do something like this:

find_package(SCITERJS REQUIRED)

add_executable(myapp WIN32
  main.cpp
)
target_include_directories(
  myapp
  PRIVATE ${CMAKE_SOURCE_DIR}/src
  PRIVATE ${SCITERJS_INCLUDE_DIRS}
)
target_link_libraries(
  myapp
  ${SCITERJS_LIBRARIES}
)

In order to accomplish this entire scenario, all I need from your side is a .lib file of your DLL :)

Thanks!

julianxhokaxhiu commented 2 years ago

Hello @c-smile any update on this? Would it be feasible on your end?

julianxhokaxhiu commented 2 years ago

Is there any plan on acting on this simple request?

If not, I'd rather be happy to know there will be not so in case I can consider other frameworks. Too bad because Sciter looked very promising but not having an easy integration with vcpkg and CMake IMHO hurts a lot in the long term the maintenance.

Thank you in advance, Julian

c-smile commented 2 years ago

Is there any plan on acting on this simple request?

No, as the .lib file is absolutely not required for Sciter integration and operation.

I believe that instead of find_package(SCITERJS REQUIRED) you can use other means in CMake.

julianxhokaxhiu commented 2 years ago

I do not understand the reason of being so reclutant in adding one file that you can generate automatically on each build, but I can't force you in doing so. Too bad.

you can use other means in CMake

Yes you can but it diverges from the standard way of finding packages when using CMake. I have already everything setup to work just fine, all I need on your own side are the .lib files, as your project is not FOSS, otherwise I would have accepted building it from source.

Thank you anyway and BR, Julian