diff --git a/CMakeLists.txt b/CMakeLists.txt index 73da61c..617ea7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,7 @@ project(FROSTBITE) enable_testing() -set(PROJECT_NAME "Frostbite") +set(PROJECT_NAME "FROSTBITE") set(PROJECT_Version 0.1) set(PROJECT_LIBS) @@ -117,12 +117,19 @@ set(CUTTOWN_SRC_FILES CuttownTest/mainWindow.h ) -add_library(snowlib STATIC ${SNOWLIB_SRC_FILES}) +add_library(snowlib SHARED ${SNOWLIB_SRC_FILES}) add_executable(testApp ${TESTAPP_SRC_FILES}) -target_link_libraries(testApp snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main opengl32.lib) +if(WIN32) +target_link_libraries(testApp snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main OpenGL32.lib) +else() +target_link_libraries(testApp snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main GL) +endif() add_executable(cuttownTest ${CUTTOWN_SRC_FILES}) -target_link_libraries(cuttownTest snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main opengl32.lib Qt6::Widgets) +if(WIN32) +target_link_libraries(cuttownTest snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main OpenGL32.lib Qt6::Widgets) +else() +target_link_libraries(cuttownTest snowlib ${Boost_LIBRARIES} ${GLEW_LIBRARIES} SDL2::SDL2 SDL2::SDL2main GL Qt6::Widgets) +endif() set_target_properties(cuttownTest PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=${Qt6Core_DIR}\\..\\..\\..\\bin;${Qt6Core_DIR}\\..\\..\\..\\plugins\\platforms") - diff --git a/CuttownTest/mainWindow.h b/CuttownTest/mainWindow.h index df14436..2ee76f4 100644 --- a/CuttownTest/mainWindow.h +++ b/CuttownTest/mainWindow.h @@ -1,5 +1,3 @@ - - #pragma once #include diff --git a/README.md b/README.md index 62be02e..7aa70f1 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ -Building -======== +# Building -For windows, I use vcpkg to install packages. See https://github.com/Microsoft/vcpkg +## Windows + +### Visual Studio with vcpkg +Use `vcpkg` to install packages. See https://github.com/Microsoft/vcpkg ``` > git clone https://github.com/Microsoft/vcpkg.git @@ -13,21 +15,21 @@ Linux:~/$ ./bootstrap-vcpkg.sh .\vcpkg integrate install ``` -you will want to install the following packages as follows: +You will want to install the following packages as follows: ``` vcpkg install sdl2:x64-windows glm:x64-windows glew:x64-windows boost:x64-windows ``` -Then you can open the directory in visual studio and it will be recognised as a cmake project. -Whether you use the open folder functionality or call cmake on the command line you will need to -set the toolchain file to the vcpkg one. This lives in the vcpkg directory under `scripts\buildsystems\vcpkg.cmake` +Then you can open the directory in Visual Studio and it will be recognised as a CMake project. +Whether you use the open folder functionality or call `cmake` on the command line you will need to +set the toolchain file to the `vcpkg` one. This lives in the `vcpkg` directory under `scripts\buildsystems\vcpkg.cmake` https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#cmake-toolchain-file -note that if you do `vcpkg integrate install` then you don't need to set the toolchain when using visual studio 2019 +Note that if you do `vcpkg integrate install` then you don't need to set the toolchain when using visual studio 2019 -## Qt specifics +### Qt specifics Installing Qt from the installer requires some mods to work. The path to Qt is hardcoded in the cmake file for the moment and when running from Visual Studio Code you need something like the following in the launch config so that the @@ -37,4 +39,16 @@ DLLs are found. "env": { "path": "C:\\Qt\\6.0.2\\msvc2019_64\\bin;%PATH%" } -``` \ No newline at end of file +``` + +## Linux + +### CMake + +From the base directory: +``` +mkdir build +cd build +cmake .. +make -j$(nproc) +```