Where are the compiler options hidden?

Discuss how to use the Diamond Editor
Post Reply
seasoned_geek
Posts: 123
Joined: Thu Jun 11 2020 12:18 pm

Where are the compiler options hidden?

Post by seasoned_geek »

I really hate each and every project having to use a different build system. Honestly, I get tired of chasing my tail.

Somewhere, somehow, there are a list of compiler options for Diamond. I can't find them. I can tell you that it is missing the option that flags

if (a = b)

as an error. Qt adds this to their projects by default (so it seems) but Diamond is missing it. I don't remember what it is, but I went looking for where to add it and got really frustrated with this CMake process.

Where are the compiler options hidden in this build system?

seasoned_geek
Posts: 123
Joined: Thu Jun 11 2020 12:18 pm

Re: Where are the compiler options hidden?

Post by seasoned_geek »

aaargh

There currently are no options, just whatever the default is.
I did a bunch of digging and added this for Linux

Code: Select all

elseif(CMAKE_SYSTEM_NAME MATCHES "(Linux|OpenBSD|FreeBSD|NetBSD|DragonFly)")
   include(GNUInstallDirs)

   set(CMAKE_INSTALL_RPATH "\$ORIGIN")

   # lots of warnings and all warnings as errors
   add_compile_options(-Wall -Wextra -pedantic -Werror)

elseif(MSVC)
I got burned by only one = inside an if (). One of my "recent" clients banned "Yoda Code" and I got out of the habit.

barbara
Posts: 281
Joined: Sat Apr 04 2015 2:32 am

Re: Where are the compiler options hidden?

Post by barbara »

We do not set compiler options in CopperSpice. Developers should have the freedom to adjust these options for each project they are building. Some may want warnings on and others do not. It is not our position to force users to confirm to our settings.

We use this same philosophy for building Diamond. I would suggest passing your options in a bash script and not change the CMake file, which would of course be over written when you fetch from github again.

( Noticed note your pedantic setting is missing the -W )

# configure script
export CXXFLAGS="-Wall -Wextra -Wpedantic -Werror"

cmake -G "Ninja" .

seasoned_geek
Posts: 123
Joined: Thu Jun 11 2020 12:18 pm

Re: Where are the compiler options hidden?

Post by seasoned_geek »

Thanks for the notice. I got no messages about the missing w.

I understand your philosophy, but coming from the medical device world, one is not allowed to use environment variables for compiler options. Too high a risk and cannot be verified by external auditors.

I have a fork here: https://github.com/RolandHughes/diamond

So I won't be overwritten anyway. Might become an issue when I have this ready to be merged into Diamond. Far too much has changed for it to ever be a Diff-able merge. I have Themes about the way I want. Even have this file to test importing with.

Code: Select all

{
    "theme-color-back": "185,195,197",
    "theme-color-currentLineBack": "215,222,222",
    "theme-color-gutterBack": "209,222,209",
    "theme-color-gutterText": "0,0,0",
    "theme-color-text": "0,0,0",
    "theme-name": "newGrey",
    "theme-protected": false,
    "theme-syntax-class": [
        50,
        false,
        "132,0,198"
    ],
    "theme-syntax-comment": [
        50,
        true,
        "0,0,255"
    ],
    "theme-syntax-constant": [
        50,
        false,
        "85,85,127"
    ],
    "theme-syntax-func": [
        50,
        false,
        "212,0,212"
    ],
    "theme-syntax-key": [
        75,
        false,
        "5,20,152"
    ],
    "theme-syntax-mline": [
        50,
        true,
        "0,0,255"
    ],
    "theme-syntax-quote": [
        50,
        false,
        "44,118,49"
    ],
    "theme-syntax-type": [
        50,
        false,
        "152,6,26"
    ]
}
Just name it anything with a .diamond_theme extension.

Working on the EDT keypad support now.

Post Reply