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
4 changes: 4 additions & 0 deletions .github/workflows/build-vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ jobs:
run:
../openFrameworks/apps/projectGenerator/scripts/vs/test_cmdline.sh

- name: Test existing-project GUI settings and update arguments
shell: pwsh
run: node --test ../openFrameworks/apps/projectGenerator/scripts/test_gui_project_settings.cjs

- name: Build emptyExample and allAddonsExample
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/master'
shell: bash
Expand Down
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 "124"
#define OFPROJECTGENERATOR_MINOR_VERSION "125"
#define OFPROJECTGENERATOR_PATCH_VERSION "0"

#define PG_VERSION (OFPROJECTGENERATOR_MAJOR_VERSION "." OFPROJECTGENERATOR_MINOR_VERSION "." OFPROJECTGENERATOR_PATCH_VERSION)
Expand Down
23 changes: 16 additions & 7 deletions commandLine/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <set>
#include <string>
#include <cstdlib>
#include <stdexcept>

enum optionIndex { UNKNOWN,
HELP,
Expand Down Expand Up @@ -68,7 +69,7 @@ constexpr option::Descriptor usage[] = {

{ CLEANNAME_DISABLE, 0, "n", "cleanname", option::Arg::Optional, " --cleanname, -n \tcleanname" },

{ DEFINES, 0, "D", "defines", option::Arg::Optional, " --defines, -D \tpreprocessor defines list (such as OF_USE_ANGLE=1,MY_FLAG)" },
{ DEFINES, 0, "D", "defines", option::Arg::Optional, " --defines, -D \tpreprocessor defines list (such as OF_USE_ANGLE=1,MY_FLAG); --defines= clears saved project defines" },
{ POSTBUILD, 0, "P", "postbuild", option::Arg::Optional, " --postbuild, -P \tscript to run after the project compiles (Xcode run script / VS post-build event)" },
{ MSYS2ENV, 0, "k", "msys2env", option::Arg::Optional, " --msys2env, -k \tMSYS2 environment for the msys2 / VSCode targets: ucrt64 (default) | mingw64 | clang64 | clangarm64" },
{ EMSCRIPTEN_WASM, 0, "W", "emscripten-wasm", option::Arg::Optional, " --emscripten-wasm, -W \temscripten WebAssembly: 32 (default) | 64 (wasm64, MEMORY64), written to config.make PROJECT_EMSCRIPTEN_WASM" },
Expand Down Expand Up @@ -107,6 +108,7 @@ bool bFrameworksPassedIn = false;
vector<string> systemLibs;
bool bSystemLibsPassedIn = false;
vector<string> defines;
bool bDefinesPassedIn = false;
string postBuildScript;
string emscriptenWasm; // empty keeps the project's config.make value
string appVersion; // empty keeps the project's value
Expand Down Expand Up @@ -288,8 +290,9 @@ void updateProject(const fs::path & path, const string & target, bool bConsiderP
project->setEmscriptenWasm(emscriptenWasm);
project->setAppVersion(appVersion, appBuild);
project->setAppBundleId(appBundleId);
project->setProjectDefinesPassed(bDefinesPassedIn);
project->setSystemFrameworks(frameworks, bFrameworksPassedIn, systemLibs, bSystemLibsPassedIn);
project->create(path, templateName);
if (!project->create(path, templateName)) throw std::runtime_error("could not update project: " + path.string());

if (bConsiderParameterAddons && bAddonsPassedIn) {
for (auto & addon : addons) {
Expand All @@ -313,7 +316,7 @@ void updateProject(const fs::path & path, const string & target, bool bConsiderP
for (auto & srcPath : srcPaths) {
project->addSrcRecursively(srcPath);
}
project->save();
if (!project->save()) throw std::runtime_error("could not save project: " + path.string());
}
}

Expand Down Expand Up @@ -728,8 +731,13 @@ int pgMain(int argc, char ** argv) {
}
}

if (options[DEFINES].count() > 0 && options[DEFINES].arg != NULL) {
defines = ofSplitString(options[DEFINES].arg, ",", true, true);
if (options[DEFINES].count() > 0) {
if (options[DEFINES].arg != NULL) {
bDefinesPassedIn = true;
defines = ofSplitString(options[DEFINES].arg, ",", true, true);
} else {
ofLogWarning() << "missing defines value; keeping the project's defines (use --defines= to clear them)";
}
}

if (options[EMSCRIPTEN_WASM].count() > 0 && options[EMSCRIPTEN_WASM].arg != NULL) {
Expand Down Expand Up @@ -938,8 +946,9 @@ int pgMain(int argc, char ** argv) {
project->setEmscriptenWasm(emscriptenWasm);
project->setAppVersion(appVersion, appBuild);
project->setAppBundleId(appBundleId);
project->setProjectDefinesPassed(bDefinesPassedIn);
project->setSystemFrameworks(frameworks, bFrameworksPassedIn, systemLibs, bSystemLibsPassedIn);
project->create(projectPath, templateName);
if (!project->create(projectPath, templateName)) return EXIT_FAILURE;
if(bAddonsPassedIn){
for (auto & addon : addons) {
project->addAddon(addon);
Expand All @@ -960,7 +969,7 @@ int pgMain(int argc, char ** argv) {
for (auto & s : srcPaths) {
project->addSrcRecursively(s);
}
project->save();
if (!project->save()) return EXIT_FAILURE;
}
ofLogNotice() << "project created! ";
nProjectsCreated += 1;
Expand Down
Loading
Loading