-
Notifications
You must be signed in to change notification settings - Fork 16
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
refactor: structure code for ease of use as module #1
Comments
I think this is reasonable... it could be restructured as |
I'm not sure there's much of a distinction until competing implementations arise? |
That's right. |
Actually, I tried hacking on this a little bit and I'm not sure anymore what problem you're trying to solving, exactly. It seems to me that the cmake-only |
|
Maybe we could talk to Matt about adding this project as an optional "library" on CE? Then the IDE/CMake projects could just |
That's a great idea! |
I just pinged him on Slack. Happy to make changes here to facilitate CE integration :) |
Success: https://godbolt.org/z/T5q4b8of5. I replaced my module with add_library(cppfront_cpp2util INTERFACE)
add_library(cppfront::cpp2util ALIAS cppfront_cpp2util)
target_include_directories(cppfront_cpp2util INTERFACE "${JEGP_CPPFRONT_INCLUDE_DIRECTORIES}")
add_executable(cppfront_cppfront IMPORTED)
add_executable(cppfront::cppfront ALIAS cppfront_cppfront)
set_target_properties(cppfront_cppfront PROPERTIES IMPORTED_LOCATION "${JEGP_CXX2_COMPILER}") |
Great! One little note, this will suffice: add_library(cppfront::cpp2util INTERFACE IMPORTED)
target_include_directories(cppfront::cpp2util INTERFACE "${JEGP_CPPFRONT_INCLUDE_DIRECTORIES}")
add_executable(cppfront::cppfront IMPORTED)
set_target_properties(cppfront::cppfront PROPERTIES IMPORTED_LOCATION "${JEGP_CXX2_COMPILER}")
|
I have switched to using |
I wonder if it's in scope and you're willing to refactor the CMake support for cppfront so that it could be used as a module.
My objective is for this project to be able to be used by https://github.com/JohelEGP/jegp.cmake_modules/#jegpcpp2. As a consequence, it'd be easy to integrate into Compiler Explorer: https://godbolt.org/z/Pq48G6T7f. Even if CE starts supporting the compilation of the generated C++ source, it won't integrate with its CMake project feature due to CMake's lack of support for Cpp2 in CMake.
As for the implementation, the most obvious place seems to be https://github.com/modern-cmake/cppfront/blob/main/cmake/CppfrontHelpers.cmake, which contains the important helpers to make this work. The most obvious challenge is the use of the target
cppfront::cppfront
. This suggests that an indirection to make it anIMPORTED
target instead might viable. That could be done by detecting preexisting support for cppfront, as opposed to compiling it like the mainCMakeLists.txt
, in a similar fashion to the Cpp2 and cppfront variables used to detect support at https://github.com/JohelEGP/jegp.cmake_modules/#variables.I'd have loved for this project to replace https://github.com/JohelEGP/jegp.cmake_modules/#jegpcpp2, but it's scope also extends to Cpp2 rather than just cppfront.
The text was updated successfully, but these errors were encountered: