Generation of ui_ headers from ui files fails

Report any problems with CopperSpice
Post Reply
Tobxon
Posts: 1
Joined: Wed Feb 22 2023 10:31 pm

Generation of ui_ headers from ui files fails

Post by Tobxon »

Hey,

I am currently trying to move from Qt6 to Copperspice, because I appreciate the more modern style.

But I can't get my basic test project to run.
It seems that the generation of the ui_ header from my ui file is not working, but I can't figure out why.

This is the error message I get:
>------ Build All started: Project: basic_Copperspice_project, Configuration: x64-debug ------
[1/4] Generating ui_MainWindow.h
FAILED: BCS_GUI/ui_MainWindow.h E:/Dev/Builds/basic_Copperspice_project/BCS_GUI/ui_MainWindow.h
cmd.exe /C "cd /D E:\Dev\Builds\basic_Copperspice_project\BCS_GUI && E:\Dev\Installs\copperspice\bin\uic.exe MainWindow.ui -o E:/Dev/Builds/basic_Copperspice_project/BCS_GUI/ui_MainWindow.h"
File 'MainWindow.ui' is not valid

ninja: build stopped: subcommand failed.

Build All failed.
The ui file is created with CS Designer and just a basic MainWindow with a text label. So there should be nothing special about it.
The code of it is here:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="windowTitle" stdset="0">
   <string>MainWindow</string>
  </property>
  <property name="geometry" stdset="0">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>640</width>
    <height>480</height>
   </rect>
  </property>
  <widget class="QWidget" name="centralwidget">
   <widget class="QLabel" name="label">
    <property name="text" stdset="0">
     <string>Welcome</string>
    </property>
    <property name="geometry" stdset="0">
     <rect>
      <x>280</x>
      <y>170</y>
      <width>47</width>
      <height>13</height>
     </rect>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry" stdset="0">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>640</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <resources/>
 <connections/>
</ui>
I am not completly sure what is needed to figure out whats going wrong here.Therefore I offer the CMakeLists.txt files I currently use.
top level CMakeLists.txt:

Code: Select all

cmake_minimum_required(VERSION 3.16...3.23)

project(basic_Copperspice_project 
	VERSION 0.1.0 
	DESCRIPTION "This is a template Project for Copperspice GUI applications."
	LANGUAGES CXX
)

include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckTypeSize)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 20)

# location for binary files
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_subdirectory(BCS_GUI)
CMakeLists.txt in "BCS_GUI" subfolder:

Code: Select all

find_package(CopperSpice REQUIRED)

# run uic to generate ui_*.h source files
COPPERSPICE_RESOURCES(
    MainWindow.ui
)

add_executable(BCS_GUI
    GUI_main.cpp
    MainWindow.cpp
    MainWindow.ui
)

target_sources(BCS_GUI
    PRIVATE
        MainWindow.hpp
)

target_link_libraries(BCS_GUI
   CopperSpice::CsCore
   CopperSpice::CsGui
)

# Copy the libraries and plugins necessary for our application to our install path.
cs_copy_library(CsCore)
cs_copy_library(CsGui)

cs_copy_plugins(CsGui)
I hope I posted everything needed to help me and someone has the patience to dig into this with me.
Tell me if more information are needed.
barbara
Posts: 447
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: Generation of ui_ headers from ui files fails

Post by barbara »

Just checking if you were able to review the build files from our KitchenSink demo program. The CMake files need to be set up precisely and it seems like this is where you are having difficulties.

You may also want to look at the first few example program on our Journal. The full source code and build files are provided. https://journal.copperspice.com

If you are still having an issue please let us know.

Barbara
Post Reply