Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commandLine/src/defines.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define OFPROJECTGENERATOR_MAJOR_VERSION "0"
#define OFPROJECTGENERATOR_MINOR_VERSION "113"
#define OFPROJECTGENERATOR_MINOR_VERSION "114"
#define OFPROJECTGENERATOR_PATCH_VERSION "0"

#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)
Expand Down
34 changes: 34 additions & 0 deletions commandLine/src/projects/visualStudioProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,40 @@ void visualStudioProject::addDefine(const string& define, LibType libType) {
// }
}

// OF_USE_GLON12[=1] / OF_USE_GLON12_WARP[=1] -> <OF_USE_GLON12>1</OF_USE_GLON12> etc in the Globals PropertyGroup
void visualStudioProject::addPropertyDefine(const string & define) {
static const std::set<string> properties { "OF_USE_GLON12", "OF_USE_GLON12_WARP" };
auto eq = define.find('=');
string name = ofTrim(define.substr(0, eq));
if (!properties.count(name)) return;
string value = eq == string::npos ? "1" : ofTrim(define.substr(eq + 1));

pugi::xml_node globals = doc.select_node("//PropertyGroup[@Label='Globals']").node();
if (!globals) {
ofLogWarning(LOG_NAME) << "no Globals PropertyGroup, not setting " << name;
return;
}
pugi::xml_node node = globals.child(name.c_str());
if (!node) node = globals.append_child(name.c_str());
node.text().set(value.c_str());
ofLogVerbose(LOG_NAME) << "MSBuild property " << name << " = " << value;

// the build fails without them too (openFrameworksCommon.props), say so now
if (name == "OF_USE_GLON12" && value == "1") {
fs::path bin { getOFRoot() / "libs" / "glon12" / "bin" / "vs" };
std::vector<string> found;
for (const auto & arch : { "x64", "ARM64", "ARM64EC" }) {
if (fs::exists(bin / arch / "opengl32.dll")) found.emplace_back(arch);
}
if (found.empty()) {
ofLogError(LOG_NAME) << "no GLon12 files found in " << bin.string()
<< " - download glon12 in projectGenerator: downloads > Modular libraries > glon12 > Download selected (or apothecary: TYPE=vs ./apothecary update glon12)";
} else {
ofLogVerbose(LOG_NAME) << "GLon12 files found for " << ofJoinString(found, ", ");
}
}
}

void visualStudioProject::ensureDllDirectoriesExist() {
std::vector<fs::path> dirs { { "dll/x64" }, { "dll/ARM64" }, { "dll/ARM64EC" } };
for (const auto & dir : dirs) {
Expand Down
3 changes: 3 additions & 0 deletions commandLine/src/projects/visualStudioProject.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class visualStudioProject : public baseProject {
addDefine(define, RELEASE_LIB);
addDefine(define, DEBUG_LIB);
projectDefines.emplace_back(define);
addPropertyDefine(define);
}

void addLDFLAG(const std::string& ldflag, LibType libType = RELEASE_LIB) override {}
Expand Down Expand Up @@ -58,4 +59,6 @@ class visualStudioProject : public baseProject {
void addCompileOption(const string& nodeName, const string& value, const string& delimiter, LibType libType = RELEASE_LIB);

void addClCompileAsC(const string & srcFileString, const string & folderString);
// defines openFrameworksCommon.props also reads as MSBuild properties (OF_USE_GLON12 copies the GLon12 DLLs, OF_USE_GLON12_WARP selects WARP)
void addPropertyDefine(const string & define);
};
19 changes: 14 additions & 5 deletions frontend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,9 @@ function generate() {
// renderer choice adds its OF_USE_* define on top of whatever the user typed manually
const rendererDefines = {
angle: 'OF_USE_ANGLE=1',
dawn: 'OF_USE_DAWN=1'
dawn: 'OF_USE_DAWN=1',
glon12: 'OF_USE_GLON12=1',
glon12warp: 'OF_USE_GLON12=1,OF_USE_GLON12_WARP=1'
};
const rendererChoice = $('#rendererDropdown').dropdown('get value');
const customDefinesText = $('#customDefines').val().trim();
Expand Down Expand Up @@ -1418,12 +1420,19 @@ function enableAdvancedMode(isAdvanced) {
//$("#advancedToggle").prop('checked', defaultSettings['advancedMode'] );
}

// renderer choice (OF_USE_ANGLE / OF_USE_DAWN) only applies to the Xcode-based
// osx/ios/macos (mega iOS/tvOS/macOS) targets, and is an advanced-only option
// renderer choice is advanced-only: OF_USE_ANGLE / OF_USE_DAWN for the Xcode-based
// osx/ios/macos (mega iOS/tvOS/macOS) targets, OF_USE_GLON12 for vs
function updateRendererFieldVisibility() {
const rendererPlatforms = ['osx', 'ios', 'macos'];
const selectedPlatforms = ($("#platformsDropdown input").val() || '').trim().split(',');
if (defaultSettings.advancedMode && selectedPlatforms.some((p) => rendererPlatforms.includes(p))) {
const apple = selectedPlatforms.some((p) => ['osx', 'ios', 'macos'].includes(p));
const vs = selectedPlatforms.includes('vs');
$('#rendererDropdown .item[data-value="angle"], #rendererDropdown .item[data-value="dawn"]').toggle(apple);
$('#rendererDropdown .item[data-value="glon12"], #rendererDropdown .item[data-value="glon12warp"]').toggle(vs);
const renderer = $('#rendererDropdown').dropdown('get value');
if ((['angle', 'dawn'].includes(renderer) && !apple) || (['glon12', 'glon12warp'].includes(renderer) && !vs)) {
$('#rendererDropdown').dropdown('set exactly', 'default');
}
if (defaultSettings.advancedMode && (apple || vs)) {
$('#rendererField').show();
} else {
$('#rendererField').hide();
Expand Down
6 changes: 4 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,15 @@
<input type="hidden" id="rendererValue" value="default">
<i class="dropdown icon"></i>
<div class="text">Default (OpenGL / OpenGL ES)</div>
<!-- labels assume the Metal backend since this field is currently only
shown for osx/ios/macos - update if/when Linux/Windows ANGLE-Vulkan
<!-- angle / dawn labels assume the Metal backend (only shown for osx/ios/macos),
glon12 is only shown for vs - update if/when Linux/Windows ANGLE-Vulkan
or Dawn-Vulkan packages are actually available to build against -->
<div class="menu">
<div class="item" data-value="default">Default (OpenGL / OpenGL ES)</div>
<div class="item" data-value="angle">ANGLE - Auto OpenGL to Metal</div>
<div class="item" data-value="dawn">Dawn - Auto OpenGL to WebGPU/Metal</div>
<div class="item" data-value="glon12">GLon12 - OpenGL to Direct3D 12 (Mesa)</div>
<div class="item" data-value="glon12warp">GLon12 - WARP software (no GPU driver)</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions frontend/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "projectGenerator",
"productName": "projectGenerator",
"version": "0.106.0",
"version": "0.107.0",
"description": "Build electron GUI openFrameworks projectGenerator",
"license": "MIT",
"main": "index.js",
Expand Down
11 changes: 11 additions & 0 deletions scripts/vs/test_cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,15 @@ if [[ $errorcode -ne 0 ]]; then
exit $errorcode
fi

echo "Test -DOF_USE_GLON12=1 sets the MSBuild property"
./"${EXE_FILE}" -o"../openFrameworks" -p"vs" -D"OF_USE_GLON12=1" "../openFrameworks/apps/myApps/testingGLon12"
errorcode=$?
if [[ $errorcode -ne 0 ]]; then
exit $errorcode
fi
if ! grep -q "<OF_USE_GLON12>1</OF_USE_GLON12>" "../openFrameworks/apps/myApps/testingGLon12/testingGLon12.vcxproj"; then
echo "OF_USE_GLON12 property missing from testingGLon12.vcxproj"
exit 1
fi

echo "Successful projectGenerator tests for [vs]"
Loading