Skip to content
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

CMake and C89 #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

CMake and C89 #11

wants to merge 2 commits into from

Conversation

SamuelMarks
Copy link

@SamuelMarks SamuelMarks commented Nov 25, 2021

WiP

@fennecdjay Can you take a look? - Getting some errors…

@fennecdjay
Copy link
Member

Taking a look rn.
I'm not understanding the previous run errors atm.

@fennecdjay
Copy link
Member

part of it is that you added the files generated by flex and bison in gitignore.
These files are supposed to be shipped in the repo.
The .y and .l files are used for developement.

@SamuelMarks
Copy link
Author

@fennecdjay So I use your flex and bison files to generate, see:

find_package(BISON)
find_package(FLEX)

BISON_TARGET(MyParser
        gwion.y
        "${CMAKE_CURRENT_SOURCE_DIR}/parser.c"
        DEFINES_FILE "${CMAKE_SOURCE_DIR}/include/lexer.h"
        # COMPILE_FLAGS "-Wno-yacc"
)
FLEX_TARGET(MyScanner
        gwion.l
        "${CMAKE_CURRENT_SOURCE_DIR}/lexer.c"
        COMPILE_FLAGS "--header-file=${CMAKE_SOURCE_DIR}/include/lexer.h")
ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)

The generated files, depending on the version, will have absolute paths inside (e.g., on my macOS Xcode version), or special workarounds (Windows).

Anyway I get an error when this runs. Here are the cmake docs for the command:
https://cmake.org/cmake/help/latest/module/FindFLEX.html
https://cmake.org/cmake/help/latest/module/FindBISON.html

@fennecdjay
Copy link
Member

re reading this PR, I think should avoid generating from the .y and .l file.
They require a recent flex/bison versions.
Choice was made to ship them

@SamuelMarks
Copy link
Author

@fennecdjay Which version of flex and bison are you using?

From /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:

bison (GNU Bison) 2.3
flex 2.6.4 Apple(flex-34)

@fennecdjay
Copy link
Member

flex 2.6.4
bison (GNU Bison) 3.7.2.51-de63

@SamuelMarks
Copy link
Author

Okay I can just switch to:

find_package(BISON 3.7.2 REQUIRED)
find_package(FLEX 2.6.4 REQUIRED)

…and use vcpkg or some sort of system package manager (that's actually up-to-date)

@fennecdjay
Copy link
Member

closed as inactive

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants