Skip to content

GLM Preprocessor Definitions to Project #8352

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

Merged
merged 7 commits into from
Mar 8, 2025

Conversation

NickHardeman
Copy link
Contributor

Wrapping glm defines in if statements to avoid re-definition using project preprocessor definitions.
Will be editing projects to add GLM_FORCE_CTOR_INIT and GLM_ENABLE_EXPERIMENTAL preprocessor defines to projects.
As discussed in this thread #6530

@NickHardeman
Copy link
Contributor Author

Defines were not added for tvOS since the project/tvOS/CoreOF.xcconfig did not have GCC_PREPROCESSOR_DEFINITIONS and I do not have a proper way to test.
And did not update the qtCreator project since I am not familiar with qtCreator.

@NickHardeman NickHardeman marked this pull request as ready for review March 6, 2025 20:30
@NickHardeman NickHardeman added this to the 0.12.1 milestone Mar 6, 2025
@NickHardeman NickHardeman mentioned this pull request Mar 6, 2025
54 tasks
@ofTheo
Copy link
Member

ofTheo commented Mar 7, 2025

It would be good to test that the defines come through at the project level.
I think the Xcode ones will as the Project.xcconfig includes the OF config, but not sure about VS and makefile common.

@NickHardeman
Copy link
Contributor Author

NickHardeman commented Mar 7, 2025

I tested Xcode, make on macOS and Emscripten on macOS using the following class included in ofApp.h that does not include ofMain.h.
Emsripten worked after I edited the makefile common.
VS, Linux and iOS still need to be tested properly.
Another test will be using the PG with an addon that has defines in the addon config.

TestGLMSrc.zip

#pragma once
#include <string>
#include <iostream>
#include <glm/vec3.hpp>
#include <sstream>

class TestGLM {
public:
	
	TestGLM() {
		std::stringstream ss;
#if defined(GLM_FORCE_CTOR_INIT)
		ss << "GLM_FORCE_CTOR_INIT defined.";
#else
		ss << "xxxx GLM_FORCE_CTOR_INIT xxxx NOT defined.";
#endif
		std::cout << ss.str() << std::endl;
		
		add("constructor");
	}
	
	void add(std::string aname) {
		glm::vec3 a, b;
		glm::vec3 c = 0.5f * (a + b);
		std::cout << aname << " c: " << c.x << " a: " << a.x << " b: " << b.x;
	}
	
	glm::vec3 ma, mb;
	glm::vec3 mc = 0.5f * (ma + mb);
    
};

@NickHardeman
Copy link
Contributor Author

Checking on VS 2022, the preprocessor macros are coming in and it prints as defined in the sample TestGLMSrc code above.
image

@ofTheo ofTheo merged commit 791e812 into openframeworks:master Mar 8, 2025
15 checks passed
@ofTheo
Copy link
Member

ofTheo commented Mar 8, 2025

Thanks!!!

@NickHardeman NickHardeman deleted the glm-preprocessor-defines branch March 8, 2025 22:26
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