]> code.bitgloo.com Git - clyne/stmdspgui.git/commitdiff
building with mingw
authorClyne Sullivan <clyne@bitgloo.com>
Mon, 16 May 2022 21:03:15 +0000 (17:03 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Mon, 16 May 2022 21:03:15 +0000 (17:03 -0400)
Makefile
source/file.cpp
source/main.cpp

index 81e580d2162b48a0af44f7a2ac11b25cfec113c9..fdf87d64bb73dbda79d6c02c02c2157564f1eae2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,26 +1,32 @@
+#linux: CXXFILES += source/serial/src/impl/unix.cc source/serial/src/impl/list_ports/list_ports_unix.cc
+#linux: LDFLAGS = -lSDL2 -lGL -lpthread
+
+CROSS = x86_64-w64-mingw32-
+CXX = $(CROSS)g++
+
 CXXFILES := \
     source/serial/src/serial.cc \
-    source/serial/src/impl/unix.cc \
-    source/serial/src/impl/list_ports/list_ports_linux.cc \
+    source/serial/src/impl/win.cc \
+    source/serial/src/impl/list_ports/list_ports_win.cc \
     $(wildcard source/imgui/backends/*.cpp) \
     $(wildcard source/imgui/*.cpp) \
     $(wildcard source/stmdsp/*.cpp) \
     $(wildcard source/*.cpp)
 
 OFILES := $(patsubst %.cc, %.o, $(patsubst %.cpp, %.o, $(CXXFILES)))
-OUTPUT := stmdspgui
+OUTPUT := stmdspgui.exe
 
-#CXXFLAGS := -std=c++20 -O2 \
-#            -Isource -Isource/imgui -Isource/stmdsp -Isource/serial/include
-CXXFLAGS := -std=c++20 -ggdb -O0 -g3 \
+CXXFLAGS := -std=c++20 -O2 \
             -Isource -Isource/imgui -Isource/stmdsp -Isource/serial/include \
-            -Wall -Wextra -pedantic
+            -Wall -Wextra -pedantic \
+            -DSTMDSP_WIN32 -Wa,-mbig-obj
+LDFLAGS = -mwindows -lSDL2 -lopengl32 -lsetupapi -lole32
 
 all: $(OUTPUT)
 
 $(OUTPUT): $(OFILES)
        @echo "  LD    " $(OUTPUT)
-       @g++ $(OFILES) -o $(OUTPUT) -lSDL2 -lGL -lpthread
+       @$(CXX) $(OFILES) -o $(OUTPUT) $(LDFLAGS)
 
 clean:
        @echo "  CLEAN"
@@ -28,9 +34,9 @@ clean:
 
 %.o: %.cpp
        @echo "  CXX   " $<
-       @g++ $(CXXFLAGS) -c $< -o $@
+       @$(CXX) $(CXXFLAGS) -c $< -o $@
 
 %.o: %.cc
        @echo "  CXX   " $<
-       @g++ $(CXXFLAGS) -c $< -o $@
+       @$(CXX) $(CXXFLAGS) -c $< -o $@
 
index fe5dafb09abce7b6b9647d7732c9d3858ddb0c04..b4332f4b26ac9d1fa10318ce7fb0f661c1cfb85d 100644 (file)
@@ -104,7 +104,7 @@ void fileRenderMenu()
 
         if (ImGui::BeginMenu("Open Example")) {
             for (const auto& file : fileExampleList) {
-                if (ImGui::MenuItem(file.filename().c_str())) {
+                if (ImGui::MenuItem(file.filename().string().c_str())) {
                     fileCurrentPath = file.string();
                     openCurrentFile();
 
index e8641bc77a38eacaf16ae4f537bc93a50008a607..d6277b7c6296bd67a454e2173f70e1afb57d5d3d 100644 (file)
@@ -47,7 +47,7 @@ static ImFont *fontMono = nullptr;
 
 static void renderWindow();
 
-int main(int, char **)
+int main(int argc, char *argv[])
 {
     if (!guiInitialize())
         return -1;