diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0442d88f..01797e68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,8 +29,8 @@ jobs: - name: Build Library, CLI Application and Tests run: | - cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DENABLE_UNIT_TESTING=1 -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake - cmake --build build -j $(nproc) + cmake --preset release -DENABLE_UNIT_TESTING=ON + cmake --build --preset release -j $(nproc) - name: Run Tests run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 35629af9..d576aea4 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(OpenOrCadParser) +project(OpenOrCadParser VERSION 0.1.0) option(ENABLE_UNIT_TESTING "Enable unit testing" OFF) diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..dc314e00 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,23 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "release", + "displayName": "Config Release", + "description": "Configures Release Version", + "binaryDir": "build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + } + ], + "buildPresets": [ + { + "name": "release", + "displayName": "Build Release", + "description": "Builds Release Version", + "configurePreset": "release" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index 5027dc24..84ce77ff 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,10 @@ git clone https://github.com/microsoft/vcpkg.git ./vcpkg/bootstrap-vcpkg.sh # Set path to vcpkg -VCPKG_DIR=$(realpath ./vcpkg) +VCPKG_ROOT=$(realpath ./vcpkg) + +# Allow parallel builds +export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc) # Get OpenOrCadParser git clone https://github.com/Werni2A/OpenOrCadParser.git @@ -47,8 +50,8 @@ git clone https://github.com/Werni2A/OpenOrCadParser.git cd OpenOrCadParser # Build -cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake -cmake --build build +cmake --preset release +cmake --build --preset release ``` ## Dependencies diff --git a/build_and_test.sh b/build_and_test.sh index f3070ec4..f1f0d245 100755 --- a/build_and_test.sh +++ b/build_and_test.sh @@ -13,8 +13,8 @@ python3 test/py/testing.py -g 1 -d repos.yaml -u test/src/generated_tests -t tes echo Building Applications... # Build applications -cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=../../../vcpkg/scripts/buildsystems/vcpkg.cmake -cmake --build build -j $(nproc) +cmake --preset release -DENABLE_UNIT_TESTING=ON +cmake --build --preset release echo Running Unit Tests... diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 93ab8dcf..bdcd1708 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -107,3 +107,34 @@ target_link_libraries(${NAME_LIB} PRIVATE spdlog::spdlog_header_only tinyxml2::tinyxml2 ) + +set_target_properties(${NAME_LIB} PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR} +) + +include(GNUInstallDirs) + +install(TARGETS ${NAME_LIB} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser +) + +# Install library headers +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser) + +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/Enums/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser/Enums) + +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/Primitives/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser/Primitives) + +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/Streams/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser/Streams) + +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/Structures/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser/Structures) + +file(GLOB HEADERS ${LIB_INCLUDE_DIR}/Win32/*.hpp) +install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/OpenOrCadParser/Win32) diff --git a/vcpkg.json b/vcpkg.json index a11e6d5f..a8e89abf 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,5 +1,5 @@ { - "name": "open-orcad-parser", + "name": "openorcadparser", "version": "0.1.0", "dependencies": [ "boost-program-options", @@ -9,7 +9,11 @@ "magic-enum", "nameof", "spdlog", - "tinyxml2" + "tinyxml2", + { + "name": "vcpkg-cmake", + "host": true + } ], "builtin-baseline": "4d9c5616fe02f0f9d253a11c94f9f582b91115ee" } \ No newline at end of file