From a0a1633f118ea21bf4a115dea7d3cc477f6b9df8 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Sun, 4 Apr 2021 04:37:33 +0530 Subject: [PATCH 01/14] find_package for SDL2 and SDL2_image --- .../CMakeLists.txt | 16 +- AXIOM_Remote_Firmware_Visualizer/Main.cpp | 1 + .../cmake/FindSDL2.cmake | 175 ++++++++++++++++++ .../cmake/FindSDL2_image.cmake | 102 ++++++++++ 4 files changed, 287 insertions(+), 7 deletions(-) create mode 100644 AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2.cmake create mode 100644 AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2_image.cmake diff --git a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt index af4074fa..5e23eb83 100644 --- a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt +++ b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt @@ -6,14 +6,16 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") find_package(SDL2 REQUIRED) +find_package(SDL2_image REQUIRED) # Fix for ArchLinux, see https://bbs.archlinux.org/viewtopic.php?id=235931 -if("${SDL2_LIBRARIES}" STREQUAL "") - SET(SDL2_LIBRARIES SDL2::SDL2) -ELSE() - string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) -ENDIF() -include_directories(${SDL2_INCLUDE_DIRS}) +# if("${SDL2_LIBRARIES}" STREQUAL "") +# SET(SDL2_LIBRARIES SDL2::SDL2) +# ELSE() +# string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) +# ENDIF() +include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_image_INCLUDE_DIRS}) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/..") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/../Firmware/") @@ -46,4 +48,4 @@ file(COPY images DESTINATION ${CMAKE_BINARY_DIR}) file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(${PROJECT_NAME} ${FIRMWARE_SOURCES} ${IMGUI_SOURCES} ${GL3W_SOURCES} ${VISUALIZER_SOURCES}) # ${BOOTLOADER_SOURCES}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} SDL2_image GL dl) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} SDL2 SDL2_image ${OPENGL_LIBRARIES}) diff --git a/AXIOM_Remote_Firmware_Visualizer/Main.cpp b/AXIOM_Remote_Firmware_Visualizer/Main.cpp index 3c8b3985..9499c7aa 100644 --- a/AXIOM_Remote_Firmware_Visualizer/Main.cpp +++ b/AXIOM_Remote_Firmware_Visualizer/Main.cpp @@ -11,6 +11,7 @@ #include #include +#define SDL_MAIN_HANDLED #include #include diff --git a/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2.cmake b/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2.cmake new file mode 100644 index 00000000..0dc42c95 --- /dev/null +++ b/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2.cmake @@ -0,0 +1,175 @@ + +# This module defines +# SDL2_LIBRARY, the name of the library to link against +# SDL2_FOUND, if false, do not try to link to SDL2 +# SDL2_INCLUDE_DIR, where to find SDL.h +# +# This module responds to the the flag: +# SDL2_BUILDING_LIBRARY +# If this is defined, then no SDL2main will be linked in because +# only applications need main(). +# Otherwise, it is assumed you are building an application and this +# module will attempt to locate and set the the proper link flags +# as part of the returned SDL2_LIBRARY variable. +# +# Don't forget to include SDLmain.h and SDLmain.m your project for the +# OS X framework based version. (Other versions link to -lSDL2main which +# this module will try to find on your behalf.) Also for OS X, this +# module will automatically add the -framework Cocoa on your behalf. +# +# +# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration +# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library +# (SDL2.dll, libsdl2.so, SDL2.framework, etc). +# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. +# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value +# as appropriate. These values are used to generate the final SDL2_LIBRARY +# variable, but when these values are unset, SDL2_LIBRARY does not get created. +# +# +# $SDL2DIR is an environment variable that would +# correspond to the ./configure --prefix=$SDL2DIR +# used in building SDL2. +# l.e.galup 9-20-02 +# +# Modified by Eric Wing. +# Added code to assist with automated building by using environmental variables +# and providing a more controlled/consistent search behavior. +# Added new modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). +# Also corrected the header search path to follow "proper" SDL guidelines. +# Added a search for SDL2main which is needed by some platforms. +# Added a search for threads which is needed by some platforms. +# Added needed compile switches for MinGW. +# +# On OSX, this will prefer the Framework version (if found) over others. +# People will have to manually change the cache values of +# SDL2_LIBRARY to override this selection or set the CMake environment +# CMAKE_INCLUDE_PATH to modify the search paths. +# +# Note that the header path has changed from SDL2/SDL.h to just SDL.h +# This needed to change because "proper" SDL convention +# is #include "SDL.h", not . This is done for portability +# reasons because not all systems place things in SDL2/ (see FreeBSD). + +#============================================================================= +# Copyright 2003-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# message("") + +SET(SDL2_PATH "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32") + +SET(SDL2_SEARCH_PATHS + ~/Library/Frameworks + /Library/Frameworks + /usr/local + /usr + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + ${SDL2_PATH} +) + +FIND_PATH(SDL2_INCLUDE_DIR SDL.h + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES include/SDL2 include + PATHS ${SDL2_SEARCH_PATHS} +) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PATH_SUFFIXES lib64 lib/x64 lib) +else() + set(PATH_SUFFIXES lib/x86 lib) +endif() + +FIND_LIBRARY(SDL2_LIBRARY_TEMP + NAMES SDL2 + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES ${PATH_SUFFIXES} + PATHS ${SDL2_SEARCH_PATHS} +) + +IF(NOT SDL2_BUILDING_LIBRARY) + IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") + # Non-OS X framework versions expect you to also dynamically link to + # SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms + # seem to provide SDL2main for compatibility even though they don't + # necessarily need it. + FIND_LIBRARY(SDL2MAIN_LIBRARY + NAMES SDL2main + HINTS + $ENV{SDL2DIR} + PATH_SUFFIXES ${PATH_SUFFIXES} + PATHS ${SDL2_SEARCH_PATHS} + ) + ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") +ENDIF(NOT SDL2_BUILDING_LIBRARY) + +# SDL2 may require threads on your system. +# The Apple build may not need an explicit flag because one of the +# frameworks may already provide it. +# But for non-OSX systems, I will use the CMake Threads package. +IF(NOT APPLE) + FIND_PACKAGE(Threads) +ENDIF(NOT APPLE) + +# MinGW needs an additional link flag, -mwindows +# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows +IF(MINGW) + SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW") +ENDIF(MINGW) + +IF(SDL2_LIBRARY_TEMP) + # For SDL2main + IF(NOT SDL2_BUILDING_LIBRARY) + IF(SDL2MAIN_LIBRARY) + SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP}) + ENDIF(SDL2MAIN_LIBRARY) + ENDIF(NOT SDL2_BUILDING_LIBRARY) + + # For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa. + # CMake doesn't display the -framework Cocoa string in the UI even + # though it actually is there if I modify a pre-used variable. + # I think it has something to do with the CACHE STRING. + # So I use a temporary variable until the end so I can set the + # "real" variable in one-shot. + IF(APPLE) + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa") + ENDIF(APPLE) + + # For threads, as mentioned Apple doesn't need this. + # In fact, there seems to be a problem if I used the Threads package + # and try using this line, so I'm just skipping it entirely for OS X. + IF(NOT APPLE) + SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT}) + ENDIF(NOT APPLE) + + # For MinGW library + IF(MINGW) + SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP}) + ENDIF(MINGW) + + # Set the final string here so the GUI reflects the final state. + SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") + # Set the temp variable to INTERNAL so it is not seen in the CMake GUI + SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") +ENDIF(SDL2_LIBRARY_TEMP) + +# message("") + +INCLUDE(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) diff --git a/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2_image.cmake b/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2_image.cmake new file mode 100644 index 00000000..fd2b752b --- /dev/null +++ b/AXIOM_Remote_Firmware_Visualizer/cmake/FindSDL2_image.cmake @@ -0,0 +1,102 @@ +# Locate SDL_image library +# +# This module defines: +# +# :: +# +# SDL2_IMAGE_LIBRARIES, the name of the library to link against +# SDL2_IMAGE_INCLUDE_DIRS, where to find the headers +# SDL2_IMAGE_FOUND, if false, do not try to link against +# SDL2_IMAGE_VERSION_STRING - human-readable string containing the version of SDL_image +# +# +# +# For backward compatibility the following variables are also set: +# +# :: +# +# SDLIMAGE_LIBRARY (same value as SDL2_IMAGE_LIBRARIES) +# SDLIMAGE_INCLUDE_DIR (same value as SDL2_IMAGE_INCLUDE_DIRS) +# SDLIMAGE_FOUND (same value as SDL2_IMAGE_FOUND) +# +# +# +# $SDLDIR is an environment variable that would correspond to the +# ./configure --prefix=$SDLDIR used in building SDL. +# +# Created by Eric Wing. This was influenced by the FindSDL.cmake +# module, but with modifications to recognize OS X frameworks and +# additional Unix paths (FreeBSD, etc). + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# Copyright 2012 Benjamin Eikel +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +SET(SDL2_PATH "C:/Program Files/mingw-w64/x86_64-8.1.0-posix-seh-rt_v6-rev0/mingw64/x86_64-w64-mingw32") + +find_path(SDL2_IMAGE_INCLUDE_DIR SDL_image.h + HINTS + ENV SDL2IMAGEDIR + ENV SDL2DIR + PATH_SUFFIXES SDL2 + # path suffixes to search inside ENV{SDLDIR} + include/SDL2 include + PATHS ${SDL2_IMAGE_PATH} + ) + +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(VC_LIB_PATH_SUFFIX lib/x64) +else() + set(VC_LIB_PATH_SUFFIX lib/x86) +endif() + +find_library(SDL2_IMAGE_LIBRARY + NAMES SDL2_image + HINTS + ENV SDL2IMAGEDIR + ENV SDL2DIR + PATH_SUFFIXES lib ${VC_LIB_PATH_SUFFIX} + PATHS ${SDL2_IMAGE_PATH} + ) + +if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h") + file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") + file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") + string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") + set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) + unset(SDL2_IMAGE_VERSION_MAJOR_LINE) + unset(SDL2_IMAGE_VERSION_MINOR_LINE) + unset(SDL2_IMAGE_VERSION_PATCH_LINE) + unset(SDL2_IMAGE_VERSION_MAJOR) + unset(SDL2_IMAGE_VERSION_MINOR) + unset(SDL2_IMAGE_VERSION_PATCH) +endif() + +set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) +set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) + +include(FindPackageHandleStandardArgs) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_image + REQUIRED_VARS SDL2_IMAGE_LIBRARIES SDL2_IMAGE_INCLUDE_DIRS + VERSION_VAR SDL2_IMAGE_VERSION_STRING) + +# for backward compatibility +set(SDLIMAGE_LIBRARY ${SDL2_IMAGE_LIBRARIES}) +set(SDLIMAGE_INCLUDE_DIR ${SDL2_IMAGE_INCLUDE_DIRS}) +set(SDLIMAGE_FOUND ${SDL2_IMAGE_FOUND}) + +mark_as_advanced(SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR) From fbae70a00c6565c9820814a3379012626b50007d Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Sun, 4 Apr 2021 07:44:19 +0530 Subject: [PATCH 02/14] manjaro settings uncommented. --- AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt index 5e23eb83..77da56e0 100644 --- a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt +++ b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt @@ -9,12 +9,16 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") find_package(SDL2 REQUIRED) find_package(SDL2_image REQUIRED) + # Fix for ArchLinux, see https://bbs.archlinux.org/viewtopic.php?id=235931 -# if("${SDL2_LIBRARIES}" STREQUAL "") -# SET(SDL2_LIBRARIES SDL2::SDL2) -# ELSE() -# string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) -# ENDIF() +if(NOT WIN32) + if("${SDL2_LIBRARIES}" STREQUAL "") + SET(SDL2_LIBRARIES SDL2::SDL2) + ELSE() + string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) + ENDIF() +endif() + include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_image_INCLUDE_DIRS}) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/..") From 5c9e775f9de9d19b33b0c68c1d2d153058bc49df Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Sun, 4 Apr 2021 08:15:02 +0530 Subject: [PATCH 03/14] SDL2_image readded in linker library --- AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt index 77da56e0..ff9a46e5 100644 --- a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt +++ b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt @@ -52,4 +52,4 @@ file(COPY images DESTINATION ${CMAKE_BINARY_DIR}) file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(${PROJECT_NAME} ${FIRMWARE_SOURCES} ${IMGUI_SOURCES} ${GL3W_SOURCES} ${VISUALIZER_SOURCES}) # ${BOOTLOADER_SOURCES}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} SDL2 SDL2_image ${OPENGL_LIBRARIES}) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} SDL2 SDL2_image) From cfc0cfabfc7a26b8fb2093eff5e22354314573b8 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Sun, 4 Apr 2021 15:53:30 +0530 Subject: [PATCH 04/14] found source of glerror 1282,in win build --- AXIOM_Remote_Firmware_Visualizer/Main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/Main.cpp b/AXIOM_Remote_Firmware_Visualizer/Main.cpp index 9499c7aa..0cd82430 100644 --- a/AXIOM_Remote_Firmware_Visualizer/Main.cpp +++ b/AXIOM_Remote_Firmware_Visualizer/Main.cpp @@ -75,7 +75,7 @@ void Initialization(SDL_Window** window) void SetupGL(SDL_Window* window, SDL_GLContext& glContext) { - gl3wInit(); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); @@ -83,7 +83,10 @@ void SetupGL(SDL_Window* window, SDL_GLContext& glContext) glContext = SDL_GL_CreateContext(window); SDL_GL_MakeCurrent(window, glContext); - + + gl3wInit(); + GLenum error = glGetError(); + std::cout<< error << "\n"; // Set black background glClearColor(0, 0, 0, 1); From 31f2ba08120d770b4bf6b3fa59aa27462df137f0 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Sun, 4 Apr 2021 17:15:15 +0530 Subject: [PATCH 05/14] added cross platform support in cmake of vis --- .../CMakeLists.txt | 20 +++++++++++++------ AXIOM_Remote_Firmware_Visualizer/Main.cpp | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt index ff9a46e5..e6b2b02c 100644 --- a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt +++ b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt @@ -6,12 +6,15 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic") -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") -find_package(SDL2 REQUIRED) -find_package(SDL2_image REQUIRED) +if(WIN32) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") + find_package(SDL2_image REQUIRED) + include_directories(${SDL2_image_INCLUDE_DIRS}) +endif() +find_package(SDL2 REQUIRED) # Fix for ArchLinux, see https://bbs.archlinux.org/viewtopic.php?id=235931 -if(NOT WIN32) +if(UNIX) if("${SDL2_LIBRARIES}" STREQUAL "") SET(SDL2_LIBRARIES SDL2::SDL2) ELSE() @@ -19,7 +22,7 @@ if(NOT WIN32) ENDIF() endif() -include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_image_INCLUDE_DIRS}) +include_directories(${SDL2_INCLUDE_DIRS}) INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/..") INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/../Firmware/") @@ -52,4 +55,9 @@ file(COPY images DESTINATION ${CMAKE_BINARY_DIR}) file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(${PROJECT_NAME} ${FIRMWARE_SOURCES} ${IMGUI_SOURCES} ${GL3W_SOURCES} ${VISUALIZER_SOURCES}) # ${BOOTLOADER_SOURCES}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} SDL2 SDL2_image) + +if(WIN32) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} SDL2 SDL2_image) +elseif(UNIX) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} SDL2_image GL dl) +endif() \ No newline at end of file diff --git a/AXIOM_Remote_Firmware_Visualizer/Main.cpp b/AXIOM_Remote_Firmware_Visualizer/Main.cpp index 0cd82430..eed26445 100644 --- a/AXIOM_Remote_Firmware_Visualizer/Main.cpp +++ b/AXIOM_Remote_Firmware_Visualizer/Main.cpp @@ -85,8 +85,6 @@ void SetupGL(SDL_Window* window, SDL_GLContext& glContext) SDL_GL_MakeCurrent(window, glContext); gl3wInit(); - GLenum error = glGetError(); - std::cout<< error << "\n"; // Set black background glClearColor(0, 0, 0, 1); From 0e4c18726519cc4f2807632f686fb51d24eda19e Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Wed, 7 Apr 2021 13:30:25 +0530 Subject: [PATCH 06/14] Added Readme instructions for windows Build of Visualizer --- AXIOM_Remote_Firmware_Visualizer/Main.cpp | 3 +-- AXIOM_Remote_Firmware_Visualizer/README.md | 30 ++++++++++++++++++++-- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/Main.cpp b/AXIOM_Remote_Firmware_Visualizer/Main.cpp index eed26445..001848f6 100644 --- a/AXIOM_Remote_Firmware_Visualizer/Main.cpp +++ b/AXIOM_Remote_Firmware_Visualizer/Main.cpp @@ -75,8 +75,6 @@ void Initialization(SDL_Window** window) void SetupGL(SDL_Window* window, SDL_GLContext& glContext) { - - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, 0); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); @@ -85,6 +83,7 @@ void SetupGL(SDL_Window* window, SDL_GLContext& glContext) SDL_GL_MakeCurrent(window, glContext); gl3wInit(); + // Set black background glClearColor(0, 0, 0, 1); diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 2ec800e7..345315e7 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -1,4 +1,4 @@ -# AXIOM Remote Firmware Visualizer +

AXIOM Remote Firmware Visualizer

## About @@ -12,10 +12,28 @@ The **imgui** library is embedded as git module, so you need to execute: to initialize it. -## Building +## Installing Required Packages for Build + +### For Linux Build * Install required packages: **cmake, libsdl2-dev, libsdl2-image-dev** * Open terminal, usual shortcut under Linux is **Ctrl+Alt+T** + +### For Windows Build + +* Install cmake on windows
+ Download Link of Cmake for windows +* Install a C++ compiler.
+ Download Link For Minimalist GNU for Windows +* Download SDL2 and SDL2_image for your compiler.
+ Download Link of SDL2 for Minimalist GNU for Windows
+ Download Link of SDL2_image for Minimalist GNU for Windows +* Copy the content (include,bin and lib folder) of SDL2 and SDL2_image, and paste it into your compiler installed Directory
+ +## Running the Visualizer + +### For Linux Build + * **cd** into **/AXIOM_Remote_Firmware_Visualizer** * **mkdir build** * **cd build** @@ -23,6 +41,14 @@ to initialize it. * **make -j4** * **./AXIOM_Remote_Firmware_Visualizer** +### For Windows Build + +* **cd** into **/AXIOM_Remote_Firmware_Visualizer** +* **mkdir build** +* **cd build** +* **cmake "MinGW Makefiles" ..** +* **mingw32-make -j4** +* **./AXIOM_Remote_Firmware_Visualizer.exe** These steps above can be done in one go with the **build.sh** script From b8d8336dd0d2ceef62481c18afd89fd6e939710c Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:34:08 +0530 Subject: [PATCH 07/14] updated readme, with required folder and directory names --- .../CMakeLists.txt | 2 +- AXIOM_Remote_Firmware_Visualizer/README.md | 23 ++++++++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt index e6b2b02c..1d82b4f1 100644 --- a/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt +++ b/AXIOM_Remote_Firmware_Visualizer/CMakeLists.txt @@ -57,7 +57,7 @@ file(COPY shaders DESTINATION ${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(${PROJECT_NAME} ${FIRMWARE_SOURCES} ${IMGUI_SOURCES} ${GL3W_SOURCES} ${VISUALIZER_SOURCES}) # ${BOOTLOADER_SOURCES}) if(WIN32) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} SDL2 SDL2_image) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} -g ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} SDL2 SDL2_image) elseif(UNIX) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SDL2_LIBRARIES} SDL2_image GL dl) endif() \ No newline at end of file diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 345315e7..15103417 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -22,13 +22,24 @@ to initialize it. ### For Windows Build * Install cmake on windows
- Download Link of Cmake for windows + Download Link of Cmake for windows
* Install a C++ compiler.
- Download Link For Minimalist GNU for Windows -* Download SDL2 and SDL2_image for your compiler.
+ Download Link For Minimalist GNU for Windows
+* Download SDL2 and SDL2_image library for your compiler, and extract the **tar.gz** file.
Download Link of SDL2 for Minimalist GNU for Windows
- Download Link of SDL2_image for Minimalist GNU for Windows -* Copy the content (include,bin and lib folder) of SDL2 and SDL2_image, and paste it into your compiler installed Directory
+ Download Link of SDL2_image for Minimalist GNU for Windows
+* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
+ *For the above downloaded Minimalist GNU compiler,the folder named is ```x86_64-w64-mingw32```*
+* Paste the copied content, into your your installed compiler directories (both x86 and x64)
+ *For the above downloaded Minimalist GNU compiler, compiler directories are as follows,*
+ ```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
+ ```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` + + + + + + ## Running the Visualizer @@ -46,7 +57,7 @@ to initialize it. * **cd** into **/AXIOM_Remote_Firmware_Visualizer** * **mkdir build** * **cd build** -* **cmake "MinGW Makefiles" ..** +* **cmake -G "MinGW Makefiles" ..** * **mingw32-make -j4** * **./AXIOM_Remote_Firmware_Visualizer.exe** From d44aedc72af56cb45323215272e90800a8993a04 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 14:43:34 +0530 Subject: [PATCH 08/14] improved windows installation instructions --- AXIOM_Remote_Firmware_Visualizer/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 15103417..f233af13 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -30,7 +30,7 @@ to initialize it. Download Link of SDL2_image for Minimalist GNU for Windows
* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
*For the above downloaded Minimalist GNU compiler,the folder named is ```x86_64-w64-mingw32```*
-* Paste the copied content, into your your installed compiler directories (both x86 and x64)
+* Paste the copied content, into your installed compiler directories (both x86 and x64)
*For the above downloaded Minimalist GNU compiler, compiler directories are as follows,*
```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` From 6b4df034aba769e3c91ad5b27b51a9d0025b204c Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 15:33:08 +0530 Subject: [PATCH 09/14] edited path of c++ complier in windows build --- AXIOM_Remote_Firmware_Visualizer/README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index f233af13..97017be9 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -32,14 +32,8 @@ to initialize it. *For the above downloaded Minimalist GNU compiler,the folder named is ```x86_64-w64-mingw32```*
* Paste the copied content, into your installed compiler directories (both x86 and x64)
*For the above downloaded Minimalist GNU compiler, compiler directories are as follows,*
- ```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
- ```mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` - - - - - - + ```Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
+ ```Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` ## Running the Visualizer From 4c11e38d095cd1bf76323c0ee87a17ce30aab31a Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 17:35:38 +0530 Subject: [PATCH 10/14] updated download path for sdl2_image in windows build in docs --- AXIOM_Remote_Firmware_Visualizer/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 97017be9..a7fd1bf7 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -27,13 +27,13 @@ to initialize it. Download Link For Minimalist GNU for Windows
* Download SDL2 and SDL2_image library for your compiler, and extract the **tar.gz** file.
Download Link of SDL2 for Minimalist GNU for Windows
- Download Link of SDL2_image for Minimalist GNU for Windows
+ Download Link of SDL2_image for Minimalist GNU for Windows
* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
*For the above downloaded Minimalist GNU compiler,the folder named is ```x86_64-w64-mingw32```*
* Paste the copied content, into your installed compiler directories (both x86 and x64)
*For the above downloaded Minimalist GNU compiler, compiler directories are as follows,*
- ```Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
- ```Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` + ```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
+ ```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` ## Running the Visualizer From 6edb8627a8e2567d706685b536d8c8d1b96816c1 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 17:40:47 +0530 Subject: [PATCH 11/14] Installation instruction for c++ compiler in windows build --- AXIOM_Remote_Firmware_Visualizer/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index a7fd1bf7..33365f4b 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -24,7 +24,8 @@ to initialize it. * Install cmake on windows
Download Link of Cmake for windows
* Install a C++ compiler.
- Download Link For Minimalist GNU for Windows
+ Download Link For Minimalist GNU for Windows
+ ***Note: while installing, select x86_x64 Architecture, not i686*** * Download SDL2 and SDL2_image library for your compiler, and extract the **tar.gz** file.
Download Link of SDL2 for Minimalist GNU for Windows
Download Link of SDL2_image for Minimalist GNU for Windows
From 68b292cabe6421ec1b1744a27ec6474f20bdbd82 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 17:43:18 +0530 Subject: [PATCH 12/14] highlighted instructions --- AXIOM_Remote_Firmware_Visualizer/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 33365f4b..064dd358 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -30,9 +30,9 @@ to initialize it. Download Link of SDL2 for Minimalist GNU for Windows
Download Link of SDL2_image for Minimalist GNU for Windows
* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
- *For the above downloaded Minimalist GNU compiler,the folder named is ```x86_64-w64-mingw32```*
+ ***For the above downloaded Minimalist GNU compiler,the folder named is*** ```x86_64-w64-mingw32```*
* Paste the copied content, into your installed compiler directories (both x86 and x64)
- *For the above downloaded Minimalist GNU compiler, compiler directories are as follows,*
+ ***For the above downloaded Minimalist GNU compiler, compiler directories are as follows,***
```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32``` From 7613f03120881488763ecc197202c927ace622ef Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 17:46:29 +0530 Subject: [PATCH 13/14] Update README.md --- AXIOM_Remote_Firmware_Visualizer/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index 064dd358..d8ee6e13 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -30,7 +30,7 @@ to initialize it. Download Link of SDL2 for Minimalist GNU for Windows
Download Link of SDL2_image for Minimalist GNU for Windows
* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
- ***For the above downloaded Minimalist GNU compiler,the folder named is*** ```x86_64-w64-mingw32```*
+ ***For the above downloaded Minimalist GNU compiler,the folder named is*** ```x86_64-w64-mingw32```
* Paste the copied content, into your installed compiler directories (both x86 and x64)
***For the above downloaded Minimalist GNU compiler, compiler directories are as follows,***
```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
From 11501289d46487226b2fa103c4d8c4230972dac7 Mon Sep 17 00:00:00 2001 From: Aman <54789531+eppisai@users.noreply.github.com> Date: Mon, 12 Apr 2021 22:22:31 +0530 Subject: [PATCH 14/14] English improved in windows build instruction --- AXIOM_Remote_Firmware_Visualizer/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/AXIOM_Remote_Firmware_Visualizer/README.md b/AXIOM_Remote_Firmware_Visualizer/README.md index d8ee6e13..a32fc466 100644 --- a/AXIOM_Remote_Firmware_Visualizer/README.md +++ b/AXIOM_Remote_Firmware_Visualizer/README.md @@ -22,17 +22,17 @@ to initialize it. ### For Windows Build * Install cmake on windows
- Download Link of Cmake for windows
+ Download link of cmake for windows
* Install a C++ compiler.
- Download Link For Minimalist GNU for Windows
+ Download link For Minimalist GNU for Windows
***Note: while installing, select x86_x64 Architecture, not i686*** * Download SDL2 and SDL2_image library for your compiler, and extract the **tar.gz** file.
- Download Link of SDL2 for Minimalist GNU for Windows
+ Download link of SDL2 for Minimalist GNU for Windows
Download Link of SDL2_image for Minimalist GNU for Windows
* In the extracted folder of ***SDL2***, ***SDL2_image*** search for folder with your compiler name and copy all the content inside it (**include**,**bin** and **lib** folder)
- ***For the above downloaded Minimalist GNU compiler,the folder named is*** ```x86_64-w64-mingw32```
+ ***For the above downloaded Minimalist GNU compiler,the folder name is*** ```x86_64-w64-mingw32```
* Paste the copied content, into your installed compiler directories (both x86 and x64)
- ***For the above downloaded Minimalist GNU compiler, compiler directories are as follows,***
+ ***For the above downloaded Minimalist GNU, compiler directories are as follows,***
```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64```
```ProgramFiles\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\x86_64-w64-mingw32```