-
Notifications
You must be signed in to change notification settings - Fork 40
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
Codeblocks generation error #463
Comments
Hi @ovenpasta, Thanks for giving a try to FRUT!
I think you misunderstood what <?xml version="1.0" encoding="UTF-8"?>
<JUCERPROJECT id="HgTYRQ" name="LinuxOnlyApp" projectType="consoleapp" jucerVersion="5.4.2">
<MAINGROUP id="xkAArJ" name="LinuxOnlyApp">
<GROUP id="{9B88DEC0-3AE7-1B81-3370-F41E4B94E9A3}" name="Source">
<FILE id="fLvRxG" name="Main.cpp" compile="1" resource="0" file="Source/Main.cpp"/>
</GROUP>
</MAINGROUP>
<EXPORTFORMATS>
<LINUX_MAKE targetFolder="Builds/LinuxMakefile" extraDefs="BUILD_WITH_MAKE=1">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/>
<CONFIGURATION isDebug="0" name="Release"/>
</CONFIGURATIONS>
<MODULEPATHS/>
</LINUX_MAKE>
<CODEBLOCKS_LINUX targetFolder="Builds/CodeBlocksLinux" extraDefs="BUILD_WITH_CODEBLOCKS=1">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug"/>
<CONFIGURATION isDebug="0" name="Release"/>
</CONFIGURATIONS>
<MODULEPATHS/>
</CODEBLOCKS_LINUX>
</EXPORTFORMATS>
<MODULES/>
<LIVE_SETTINGS>
<WINDOWS/>
</LIVE_SETTINGS>
<JUCEOPTIONS JUCE_STRICT_REFCOUNTEDPOINTER="1"/>
</JUCERPROJECT> When we use # This file was generated by Jucer2Reprojucer from "LinuxOnlyApp.jucer"
cmake_minimum_required(VERSION 3.4)
project("LinuxOnlyApp")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../FRUT/cmake")
include(Reprojucer)
set(LinuxOnlyApp_jucer_FILE
"${CMAKE_CURRENT_LIST_DIR}/LinuxOnlyApp.jucer"
)
jucer_project_begin(
JUCER_VERSION "5.4.2"
PROJECT_FILE "${LinuxOnlyApp_jucer_FILE}"
PROJECT_ID "HgTYRQ"
)
jucer_project_settings(
PROJECT_NAME "LinuxOnlyApp"
PROJECT_VERSION "1.0.0"
PROJECT_TYPE "Console Application"
BUNDLE_IDENTIFIER "com.yourcompany.LinuxOnlyApp"
CXX_LANGUAGE_STANDARD "C++14"
)
jucer_project_files("LinuxOnlyApp/Source"
# Compile Xcode Binary
# Resource Resource
x . . "Source/Main.cpp"
)
jucer_export_target(
"Linux Makefile"
EXTRA_PREPROCESSOR_DEFINITIONS
"BUILD_WITH_MAKE=1"
)
jucer_export_target_configuration(
"Linux Makefile"
NAME "Debug"
DEBUG_MODE ON
)
jucer_export_target_configuration(
"Linux Makefile"
NAME "Release"
DEBUG_MODE OFF
)
jucer_export_target(
"Code::Blocks (Linux)"
EXTRA_PREPROCESSOR_DEFINITIONS
"BUILD_WITH_CODEBLOCKS=1"
)
jucer_export_target_configuration(
"Code::Blocks (Linux)"
NAME "Debug"
DEBUG_MODE ON
ARCHITECTURE "64-bit (-m64)"
)
jucer_export_target_configuration(
"Code::Blocks (Linux)"
NAME "Release"
DEBUG_MODE OFF
ARCHITECTURE "64-bit (-m64)"
)
jucer_project_end() Now, depending on the CMake generator (more precisely, the value of
find_package(JUCE COMPONENTS juce_audio_utils)
add_executable(AudioPlayer ...)
target_link_libraries(AudioPlayer PRIVATE
JUCE::juce_audio_basics::sources
JUCE::juce_audio_devices::sources
JUCE::juce_audio_formats::sources
JUCE::juce_audio_processors::sources
JUCE::juce_audio_utils::sources
JUCE::juce_core::sources
JUCE::juce_data_structures::sources
JUCE::juce_events::sources
JUCE::juce_graphics::sources
JUCE::juce_gui_basics::sources
JUCE::juce_gui_extra::sources
) I am currently working on such a |
(After more than a year, here is a better answer, which also closes this issue) Since if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_EXTRA_GENERATOR STREQUAL "CodeBlocks") # true when calling `cmake -G "CodeBlocks - *"`
set(exporter "Code::Blocks (Linux)")
else()
set(exporter "Linux Makefile")
endif()
endif() The default CMake generator on Linux is Upgrading to CLion 2019.3 might also solve the problem. See https://blog.jetbrains.com/clion/2019/10/clion-2019-3-eap-ninja-cmake-generators/ for more details. |
just to keep consistency, as mentioned in another thread, updating CLion does not solve the problem fully (not even using 2020.1 EAP, which I also have installed). Even though CLion does support other exporters in terms of loading the project and building the targets, it doesn't know how to correctly do code parsing/refactoring with those exports, and debugger support is also not complete. So even though this is a CLion-related bug, it could be fixed for all IDEs in present or future by not associating build instructions for a particular OS (Mac, iOS, Linux) with a generator/IDE - that 'coupling' was one of my main reasons to get away from the Projucer. |
If a project does both If you have a better solution to decide between the "Linux Makefile" and "Code::Blocks (Linux)" exporters, then please let me know, I'll be very happy to implement it right away. |
Definitely, if you decouple the step of setting linux-related variables into the targets from the part where you parse the projucer project, you can make it work regardless of which default target you choose for Linux, and even make it work manually if no such target exist. Pseudo code:
|
This will be super confusing for people who are expecting Imagine I have a project that only supports the "Code::Blocks (Linux)" exporter and that does: jucer_export_target(
"Code::Blocks (Linux)"
EXTRA_PREPROCESSOR_DEFINITIONS
"ENABLE_SECRET_FEATURE=1"
) and I run With your solution, |
I think you misunderstood my intention, no current behaviour should be changed for people using FRUT on projucer project. The actual logic of picking which target to draw from just needs to happen before adding the cmake targets. No need to add secret features or anything like that. The logic should like that, roughly:
|
Just to be clear, if your projucer project didn't have any linux targets at all, those variables will never be filled and a target won't be added at all, which is how I'd expect it to work (you can show a message about that... but not fail since it's possible having no linux targets for some sub project is the desired behavior. |
"You need to choose what to add before adding it". Seems a bit tautological, but makes sense. Unless you are using "target" to mean two different things and then I don't know what you actually mean.
Whose choosing? Where is it defined? How can users of
This contradicts with the peudo code you wrote in #463 (comment), which would always add a target on Linux. This makes it hard for me to understand what you want. |
Hi, having problems with clion... but also with others...
Where did the string "Code::Blocks (Linux)" came from?
here is the official string for the generators:
https://cmake.org/cmake/help/latest/generator/CodeBlocks.html#codeblocks
I saw that the code in Reprojucer.cmake improperly uses that string to check for the generator
but it should be "CodeBlocks - Unix Makefiles"...
I've even succeded cross compiling to mingw64 using mxe cmake toolchain with some hacks to the Reprojucer.cmake script. Much painful!
The text was updated successfully, but these errors were encountered: