diff --git a/CMakeLists.txt b/CMakeLists.txt index b53f761..0db45da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,4 +13,5 @@ include(diplomat.cmake) qt_standard_project_setup() +add_subdirectory(src) add_subdirectory(ui) diff --git a/ui/impl.cmake b/src/CMakeLists.txt similarity index 88% rename from ui/impl.cmake rename to src/CMakeLists.txt index 636739e..c366673 100644 --- a/ui/impl.cmake +++ b/src/CMakeLists.txt @@ -32,7 +32,7 @@ add_custom_target(build_impl DEPENDS "${impl_basename}.a" ) -add_library(photon_light_impl STATIC IMPORTED) +add_library(photon_light_impl STATIC IMPORTED GLOBAL) set_target_properties(photon_light_impl PROPERTIES IMPORTED_LOCATION "${impl_basename}.a" @@ -48,11 +48,16 @@ set(bindings add_custom_command( OUTPUT ${bindings} COMMAND ${diplomat} cpp "${bindings_dir}" - MAIN_DEPENDENCY "${CMAKE_SOURCE_DIR}/src/lib.rs" + MAIN_DEPENDENCY "lib.rs" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" VERBATIM ${diplomat_cmake_args} ) +# HACK ensure CMake *actually adds* the command above +add_custom_target(codegen_impl + DEPENDS ${bindings} +) + target_sources(photon_light_impl INTERFACE ${bindings}) target_include_directories(photon_light_impl INTERFACE "${bindings_dir}") diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index abc617e..c77b221 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,5 +1,3 @@ -include(impl.cmake) - qt_add_executable(photon-light src/main.cxx src/main_window.cxx