version1.0
This commit is contained in:
parent
acba119d14
commit
1f749a2975
@ -1,38 +1,13 @@
|
|||||||
cmake_minimum_required(VERSION 3.7.2)
|
cmake_minimum_required(VERSION 3.7.2)
|
||||||
|
|
||||||
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
|
|
||||||
message(FATAL_ERROR "In-source builds are disabled.
|
|
||||||
Please create a subfolder called build and use `cmake ..` inside it.
|
|
||||||
NOTE: cmake will now create CMakeCache.txt and CMakeFiles/*.
|
|
||||||
You must delete them, or cmake will refuse to work.")
|
|
||||||
endif()
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "bin" "doc" "CMakeFiles" "lib" "include")
|
|
||||||
|
|
||||||
project(GUI)
|
project(GUI)
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
# enable clang_tidy
|
|
||||||
set(CMAKE_CXX_CLANG_TIDY "clang-tidy;-checks=*")
|
|
||||||
set(CMAKE_CXX_CLANG_TIDY clang-tidy;-header-filter=.;-checks=*;)
|
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES src/*.cpp)
|
|
||||||
file(GLOB_RECURSE HEADERS src/*.h)
|
|
||||||
file(GLOB_RECURSE TESTS test/*.cpp)
|
|
||||||
|
|
||||||
set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library")
|
|
||||||
|
|
||||||
include_directories(${LIB_PATH}/include)
|
|
||||||
add_executable(GUI ${SOURCES} ${HEADERS} main/main.cpp)
|
add_executable(GUI ${SOURCES} ${HEADERS} main/main.cpp)
|
||||||
|
|
||||||
target_link_libraries(GUI ${LIB_PATH}/lib/liblibrary.a)
|
set(FLTK_SKIP_FLUID true)
|
||||||
|
find_package(FLTK REQUIRED)
|
||||||
|
include_directories(${FLTK_INCLUDE_DIR})
|
||||||
|
target_link_libraries(${PROJECT_NAME} ${FLTK_BASE_LIBRARY} ${FLTK_PLATFORM_DEPENDENT_LIBS})
|
||||||
|
|
||||||
#TODO: add fltk here
|
|
||||||
|
|
||||||
enable_testing()
|
|
||||||
find_package(Catch2 REQUIRED)
|
|
||||||
add_executable(UnitTests ${SOURCES} ${HEADERS} ${TESTS})
|
|
||||||
target_link_libraries(UnitTests Catch2::Catch2)
|
|
||||||
|
|
||||||
include(CTest)
|
|
||||||
include(Catch)
|
|
||||||
catch_discover_tests(UnitTests)
|
|
||||||
|
@ -1,5 +1,28 @@
|
|||||||
#include "../src/demo.h"
|
#include <FL/Fl.H>
|
||||||
|
#include <FL/Fl_Window.H>
|
||||||
|
#include <FL/Fl_Button.H>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
int main() {
|
|
||||||
return test();
|
using namespace std;
|
||||||
|
|
||||||
|
void button_cb(Fl_Widget* wid){
|
||||||
|
Fl_Button* but = (Fl_Button*)wid;
|
||||||
|
|
||||||
|
if(but->label()=="&Good job"){
|
||||||
|
but->label("&Click me");
|
||||||
|
} else
|
||||||
|
but->label("&Good job");
|
||||||
|
but->redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
Fl_Window win(300,200,"Testing");
|
||||||
|
int i = 7;
|
||||||
|
win.begin();
|
||||||
|
Fl_Button but(20,150,70,30,"&Click me");
|
||||||
|
win.end();
|
||||||
|
but.callback(button_cb);
|
||||||
|
win.show();
|
||||||
|
return Fl::run();
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user