123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- cmake_minimum_required(VERSION 3.0)
- project(ex1
- VERSION 0.1
- LANGUAGES CXX)
- ###########
- # Debug or Release
- ###########
- if (NOT CMAKE_BUILD_TYPE)
- ## set default to Debug
- set(CMAKE_BUILD_TYPE RelWithDebInfo) # override with -DCMAKE_BUILD_TYPE=Release
- message("==> CMAKE_BUILD_TYPE empty. Changing it to Debug.")
- else()
- message("==> CMAKE_BUILD_TYPE == ${CMAKE_BUILD_TYPE}.")
- endif()
- ## set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -DGLIBCXX_FORCE_NEW")
- ## https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_macros.html
- ## During Debug, use debug version of libstdc++ (asserts on access to invalid iterators, etc!)
- ## set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
- ##############
- # C++ Standard
- ##############
- # set(CMAKE_CXX_STANDARD 14)
- # C++17 gives me transform
- set(CMAKE_CXX_STANDARD 17)
- set(CMAKE_CXX_EXTENSIONS ON)
- ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
- # add log_setup log
- FIND_PACKAGE( Boost 1.60 COMPONENTS program_options log_setup log REQUIRED )
- INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
- # We only need the one header file.
- # if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/json)
- # message("***")
- # message("*** ERROR/MISSING *** please run: git clone https://github.com/nlohmann/json.git --depth 1")
- # message("***")
- # endif()
- # add_subdirectory(json)
- if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/googletest)
- message("***")
- message("*** ERROR/MISSING *** please run: git clone https://github.com/google/googletest.git --depth 1")
- message("***")
- endif()
- add_subdirectory(googletest)
- option(gtest_build_samples "Build gtest's sample programs." OFF)
- option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
- ### TESTS
- add_executable(test-galaxy test-galaxy.cpp galaxy.cpp config.cpp utils.cpp buysell.cpp)
- add_dependencies(test-galaxy gtest)
- target_link_libraries(test-galaxy gtest_main ${Boost_LIBRARIES})
- add_executable(test-director test-director.cpp galaxy.cpp utils.cpp buysell.cpp director.cpp dispatchers.cpp boxes.cpp scripts.cpp config.cpp ansicolor.cpp)
- add_dependencies(test-director gtest)
- target_link_libraries(test-director gtest_main ${Boost_LIBRARIES})
- enable_testing()
- add_test(NAME test-galaxy
- COMMAND test-galaxy)
- add_test(NAME test-director
- COMMAND test-director)
- # dispatchers.cpp
- ADD_EXECUTABLE( twproxy twproxy.cpp utils.cpp session.cpp boxes.cpp director.cpp galaxy.cpp dispatchers.cpp scripts.cpp buysell.cpp config.cpp ansicolor.cpp)
- TARGET_LINK_LIBRARIES( twproxy ${Boost_LIBRARIES} pthread)
- target_precompile_headers(twproxy PRIVATE pch.hpp)
|