Compare commits

..

4 Commits

Author SHA1 Message Date
ab8bfb4e8e successfully compiled on win11 2021-11-20 00:30:34 +08:00
d7da8be039 tmp update 2021-11-19 23:57:33 +08:00
c139e608ed !1 update master
Merge pull request !1 from yizhangss/yzhang
2021-11-02 13:00:24 +00:00
pi
137c0147c6 add build 2020-08-30 15:18:23 +08:00
6 changed files with 68 additions and 45 deletions

3
.gitignore vendored
View File

@ -1,4 +1,4 @@
# Prerequisites # Prerequisites
*.d *.d
# Compiled Object files # Compiled Object files
@ -33,5 +33,4 @@
# Mac folder # Mac folder
.DS_Store .DS_Store
build_mac/
build/ build/

View File

@ -1,9 +1,12 @@
cmake_minimum_required(VERSION 3.15.2) cmake_minimum_required(VERSION 3.15.2)
#
project(GM3D_GUI VERSION 0.3 LANGUAGES CXX)
#set(CMAKE_CXX_COMPILER /usr/local/bin/g++-10) message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
set(CMAKE_BUILD_TYPE "Release") # CMake WindowsC:/Program\ Files/${Project_Name} Linux/Unix/usr/local
#set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_THREAD_SAFE -D_REENTRANT -O2 -Wunused-command-line-argument -lpthread -framework Cocoa --std=c++11") message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
# CMake
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
project(GM3D_GUI VERSION 0.2 LANGUAGES CXX) #
add_subdirectory(src/)
add_subdirectory(src)

View File

@ -1,39 +1,10 @@
aux_source_directory(. DIR_SRC) aux_source_directory(. DIR_SRC)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) add_executable(gm3d ${DIR_SRC})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -O2")
# NOTE: Don't include the path in MACOSX_BUNDLE_ICON_FILE -- this is
# the property added to Info.plist
# <key>CFBundleIconFile</key>
# <string>logo</string>
set(MACOSX_BUNDLE_ICON_FILE Logo_ZY)
# And this part tells CMake where to find and install the file itself
set(myApp_ICON ${PROJECT_SOURCE_DIR}/assert/logo/Logo_ZY.icns)
# set_source_files_properties would create Resources folder to store icns
# The folder is at same path where Info.plist located
set_source_files_properties(${myApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
#add_executable(gm3d_gui WIN32 MACOSX_BUNDLE ${DIR_SRC})
add_executable(gm3d MACOSX_BUNDLE ${DIR_SRC} ${myApp_ICON})
# openmp
find_package(OpenMP REQUIRED)
if (OpenMP_CXX_FOUND)
message(STATUS "OpenMP Found.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
#target_link_libraries(gm3d PUBLIC OpenMP::OpenMP_CXX)
endif()
#find_library(FLTK_LIBRARY libfltk.a /usr/local/Cellar/fltk/1.3.5/lib)
# #
include_directories(/opt/homebrew/include) include_directories(E:/Library/include)
include_directories(/usr/local/include)
# #
find_library(FLTK_LIBRARY fltk HINTS /opt/homebrew/lib) find_library(FLTK_LIBRARY fltk HINTS E:/Library/lib)
target_link_libraries(gm3d ${FLTK_LIBRARY} OpenMP::OpenMP_CXX) target_link_libraries(gm3d ${FLTK_LIBRARY})

39
src/CMakeLists.txt.backup Normal file
View File

@ -0,0 +1,39 @@
aux_source_directory(. DIR_SRC)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -O2")
# NOTE: Don't include the path in MACOSX_BUNDLE_ICON_FILE -- this is
# the property added to Info.plist
# <key>CFBundleIconFile</key>
# <string>logo</string>
set(MACOSX_BUNDLE_ICON_FILE Logo_ZY)
# And this part tells CMake where to find and install the file itself
set(myApp_ICON ${PROJECT_SOURCE_DIR}/assert/logo/Logo_ZY.icns)
# set_source_files_properties would create Resources folder to store icns
# The folder is at same path where Info.plist located
set_source_files_properties(${myApp_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
#add_executable(gm3d_gui WIN32 MACOSX_BUNDLE ${DIR_SRC})
add_executable(gm3d MACOSX_BUNDLE ${DIR_SRC} ${myApp_ICON})
# 添加openmp的编译命令 设置编译选项
find_package(OpenMP REQUIRED)
if (OpenMP_CXX_FOUND)
message(STATUS "OpenMP Found.")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS}")
#target_link_libraries(gm3d PUBLIC OpenMP::OpenMP_CXX)
endif()
#find_library(FLTK_LIBRARY libfltk.a /usr/local/Cellar/fltk/1.3.5/lib)
# 添加头文件地址
include_directories(/opt/homebrew/include)
include_directories(/usr/local/include)
# 添加动态库地址
find_library(FLTK_LIBRARY fltk HINTS /opt/homebrew/lib)
target_link_libraries(gm3d ${FLTK_LIBRARY} OpenMP::OpenMP_CXX)

View File

@ -8,7 +8,7 @@
#include "iomanip" #include "iomanip"
#include "stdio.h" #include "stdio.h"
#include "stdlib.h" #include "stdlib.h"
#include "unistd.h" //#include "unistd.h"
#include "vector" #include "vector"
#include "map" #include "map"
#include "algorithm" #include "algorithm"

View File

@ -1,12 +1,23 @@
#ifndef _PROGRESS_BAR_ #ifndef _PROGRESS_BAR_
#define _PROGRESS_BAR_ #define _PROGRESS_BAR_
#include <sys/ioctl.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <cstring> #include <cstring>
#include <thread> #include <thread>
#include <chrono> #include <chrono>
#if defined _WINDOWS || __WIN32__
#include <windows.h>
#else
#include <sys/ioctl.h>
#include <unistd.h>
#endif
#define TOTAL_PERCENTAGE 100.0 #define TOTAL_PERCENTAGE 100.0
#define CHARACTER_WIDTH_PERCENTAGE 4 #define CHARACTER_WIDTH_PERCENTAGE 4